Open b1conrad opened 2 years ago
One reported error is, «it's saying "SyntaxError: Unexpected token 'const'" but there's no 'const' in my code anywhere».
Melissa Robertson says, "I’ve run into that before, it means there is a syntax error in your code, but the parser isn’t picking up on it so it doesn’t fail until it starts generating the javascript under the hood".
Phil says, "The bug you uncovered is that a decl should never be allowed in the postlude. So, this should be illegal:
always {
x = 3
}
You can set an entity variable, but you can't bind names to values in the postlude.
So, the parser should have caught this, but didn't. Then the compiler generated illegal JavaScript, causing a JS parse error, which isn't helpful.
We'll be updating the parser to disallow decls in postludes to avoid this."
KRL doesn't allow name/value bindings except in a prelude or in a function definition. When these are tried in other places, the error messages are unclear/misleading and sometimes don't fail until JavaScript compilation. Need specific examples. But, see also, issue #528, which makes a case for such bindings in an
every
action block.KRL doesn't allow entity variable assignments anywhere but in a postlude. When one is attempted in a
defaction
the error message seen is "ParseError: Expected '('" which is not helpful.