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

return.value and return = #364

Merged
merged 3 commits into from
Feb 12, 2023
Merged

return.value and return = #364

merged 3 commits into from
Feb 12, 2023

Conversation

edemaine
Copy link
Collaborator

@edemaine edemaine commented Feb 12, 2023

I used what I learned from writing #359 to fix #361 and this time keep things particularly clean.

Extra features:

  • Simpler global ref resolution from break used as value for detecting broken loops, simpler global ref resolution #359 (necessary if return.value is used within a loop, and ret is used only outside)
  • Add parent pointers and findAncestor helper
  • Remove parent pointers during prune
  • CLI error handling when AST fails to JSON.stringify (helped figure out that I need the previous)
  • getIndent helper extracted from insertReturn
  • gatherRecursive gains a skipPredicate (not strictly necessary but convenient)
  • gatherRecursiveWithinFunction to search just within this function (probably would simplify autoVar code)
  • isFunction helper

Fixes `var broke` colliding with otherwise declared `broke` variable
@edemaine edemaine temporarily deployed to build February 12, 2023 20:00 — with GitHub Actions Inactive
source/parser.hera Outdated Show resolved Hide resolved
Copy link
Contributor

@STRd6 STRd6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just need to update the return value when matching skipPredicate to [].

@edemaine edemaine temporarily deployed to build February 12, 2023 20:28 — with GitHub Actions Inactive
@edemaine edemaine merged commit b4176c4 into main Feb 12, 2023
@edemaine edemaine deleted the return-assign branch February 12, 2023 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

return =
2 participants