Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(functions): return mutatble reference from add_block #18

Merged
merged 2 commits into from
Jul 12, 2022

Conversation

garritfra
Copy link
Owner

@garritfra garritfra commented Jun 29, 2022

Fixes #17

Description

Function::add_block() should return a reference to the created block.

Changes proposed in this pull request

  • Function::add_block() returns a reference to the created block
  • Deprecated Function::last_block(), since it's mostly unnecessary

ToDo

  • Proposed feature/fix is sufficiently tested
  • Proposed feature/fix is sufficiently documented
  • The "Unreleased" section in the changelog has been updated, if applicable

@garritfra garritfra linked an issue Jun 29, 2022 that may be closed by this pull request
@garritfra garritfra added the bug Something isn't working label Jun 29, 2022
@YerinAlexey
Copy link
Contributor

Function::last_block is useful for checking if the function always returns, for example

@garritfra
Copy link
Owner Author

Function::last_block is useful for checking if the function always returns, for example

But that can also be done via self.blocks.last(), which is hardly any more code to write.

@garritfra garritfra merged commit efdf1f5 into main Jul 12, 2022
@garritfra garritfra deleted the 17-functionadd_block-doesnt-return-added-block branch July 12, 2022 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Function::add_block() doesn't return added block?
2 participants