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

SimpleAssigns target should be StaticAssignable, not Node #195

Open
faultyserver opened this issue Jun 8, 2018 · 0 comments
Open

SimpleAssigns target should be StaticAssignable, not Node #195

faultyserver opened this issue Jun 8, 2018 · 0 comments
Labels
good first issue An issue that provides a good intro to working with the Myst codebase. Be helpful! semantics.parser Any issue relating to changing the semantics of parser code. semantics Generic label for semantics issues. All semantics issues should have this tag.

Comments

@faultyserver
Copy link
Member

I'm pretty sure that SimpleAssign is only created when the left-hand side is a StaticAssignable (e.g., Var, Const, or Underscore). If the target is a pattern, then it becomes a MatchAssign, and if it is some method chain (e.g. x.y = 2), then it is converted into a Call to the y= method with x as the receiver.

With that, I think that the target property of SimpleAssign nodes can be restricted from Node to StaticAssignable. That guarantee is helpful when doing semantic analysis (i.e., myst-typecheck :) and avoids the need to downcast it whenever it is referenced.

@faultyserver faultyserver added semantics Generic label for semantics issues. All semantics issues should have this tag. good first issue An issue that provides a good intro to working with the Myst codebase. Be helpful! semantics.parser Any issue relating to changing the semantics of parser code. labels Jun 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue An issue that provides a good intro to working with the Myst codebase. Be helpful! semantics.parser Any issue relating to changing the semantics of parser code. semantics Generic label for semantics issues. All semantics issues should have this tag.
Projects
None yet
Development

No branches or pull requests

1 participant