Skip to content

Conversation

@chrisrink10
Copy link
Member

Fixes #1180

Copy link
Member Author

Choose a reason for hiding this comment

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

Making FunctionContext type mutable so it can be changed during the analysis phase and older references to the same object remain valid.

The issue is that we could call AnalyzerContext.get_node_env() (which captures FunctionContext) before we know if a function is a generator. If the FunctionContext type is frozen and we have to replace the object (as by attr.assoc), the references in previous NodeEnvs would not be correct.

One downside of using a mutable type is that it is not hashable, so I had to suppress including NodeEnv from hash computations for nodes. This is not unlike the way a symbol's hash only depends on the name and namespace, not the attached metadata.

@chrisrink10 chrisrink10 marked this pull request as ready for review April 10, 2025 01:30
@chrisrink10 chrisrink10 merged commit 7d1d925 into main Apr 10, 2025
12 checks passed
@chrisrink10 chrisrink10 deleted the fix/async-generators branch April 10, 2025 01:45
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.

SyntaxError when defining Async Generators in Basilisp

1 participant