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

Output semicolons after assignments, to fix ambiguous lua output in some cases #416

Closed
wants to merge 6 commits into from

Conversation

natnat-mc
Copy link
Contributor

The following code generates invalid lua code:

import bind from grasp
(bind stmt) color: "Red"
local bind
bind = grasp.bind
(bind(stmt))({ -- this is line 99
  color = "Red"
})

The lua interpeter is unable to parse this, because this could be either a new statement or a function call. To fix this, a semicolon would need to be inserted.

Full code this is from: https://gist.github.com/daelvn/3f3677b31af2752992fe16617bba3d2e
Discussion on the MS Discord: https://discordapp.com/channels/454435414044966913/454435533792346142/705499136035651599

This PR aims to fix this by appending a semicolon to all assignments. Sadly, this also changes all files output my moonc and broke all tests based on output string match, which I've patched to accomodate for this change.

@natnat-mc
Copy link
Contributor Author

See #417, which does this better

@natnat-mc natnat-mc closed this Apr 30, 2020
@natnat-mc natnat-mc deleted the semicolon branch May 1, 2020 11:38
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

1 participant