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

Add field assignment #218

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft

Add field assignment #218

wants to merge 9 commits into from

Conversation

CohenArthur
Copy link
Member

@CohenArthur CohenArthur commented Aug 29, 2021

Closes #191

@CohenArthur CohenArthur marked this pull request as draft August 29, 2021 23:24
@CohenArthur
Copy link
Member Author

Since we are mutating an existing instance of "something", we might need to keep track of all instantiated variables in the context in order to mutate them later. This should be done in another PR

@CohenArthur
Copy link
Member Author

We can set a field's value in one of those two cases:

  • We just created a variable, and are mutating one of its fields.
  • We are mutating an argument given to a function

Thus, we can only keep track of variables to mutate via the scope map. We should be able to use the get_var and replace_var methods already present in it.

The only other problem remaining is to allow the mutation of a field of a field of a field... of a variable. Think vec3.point.x = 15. Which I am unsure how to resolve currently, as I'd like to avoid keeping a Box<dyn Instruction> as value in the FieldAssign struct

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.

Implement FieldAssign
1 participant