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

Fixed JavaScript assignment operators generating error statements #250

Merged
merged 3 commits into from
May 18, 2024

Conversation

anfreshman
Copy link
Contributor

#246
hello, I want to try to fix this problem. I defined a new assignment statement generator, removed the assignment operator from BINARY_TOKENS, and added the latest assignment operator. I am not reproducing the above problem in the new version, so I think I have fixed the problem. I would appreciate it if you could review the code to confirm whether this pr can be merged, or if necessary, could you let me know what other necessary tests need to be performed?

… added a more complete assignment operator
@rohanpadhye
Copy link
Owner

Thanks for the contribution! I'll review this when I get some free cycles next, and merge if all looks good.

@rohanpadhye
Copy link
Owner

rohanpadhye commented May 14, 2024

Looks good at first glance! However, I noticed that while your code produces correct assignment statements of the form:

x = <expr>

It cannot produce assignment statements like this:

x[i] = <expr>

or:

x.a = <expr>

Can you update the generateAssignmentNode method to choose between identNode, objectProperty, or indexNode at the LHS?

Thanks.

@anfreshman
Copy link
Contributor Author

Thanks for pointing out my problem! I have updated and submitted a new version of the code. I noticed that generatePropertyNode and generateIndexNode already existed in the original code to generate objectProperty and indexNode, so I reused these two methods and randomly selected them among the three lhstype types. I would really appreciate it if you could review my code again

Copy link
Owner

@rohanpadhye rohanpadhye left a comment

Choose a reason for hiding this comment

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

This looks great! Thanks.

@anfreshman
Copy link
Contributor Author

Thanks!I am very happy to see this comment. Will this pr trigger the merge process next?

@rohanpadhye rohanpadhye merged commit 6915825 into rohanpadhye:master May 18, 2024
1 check passed
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.

None yet

2 participants