assemblyscript
assemblyscript copied to clipboard
#1125 Fix parsing of unusual trailing expressions separated by whitespace
Concerning:
-
Is "unexpected token error" appropriate for this error?
-
Serialized source text still has ";". Is it OK?
-
[x] I've read the contributing guidelines
-
[x] I've added my name and email to the NOTICE file
I wonder whether this is only applicable to variables and returns. Another one that comes to mind is throw. Do you know what the spec says exactly for this case? If it runs deeper, perhaps a fix could be more general.
I wonder whether this is only applicable to variables and returns. Another one that comes to mind is throw. Do you know what the spec says exactly for this case? If it runs deeper, perhaps a fix could be more general.
I agree. I don't know the spec well but I should consider more deeply.
Anyway, this change counts some valid codes like below as an error.
function foo(): i32 {
return 123 }
I'll close this pullreq for now and reopen it after making more proper solution.
I read the spec but it's too complecated for me to handle all cases.
- https://tc39.es/ecma262/#sec-automatic-semicolon-insertion
Anyway, this pull req can fix issue #1125. If other cases are found, please replace tn.skip(Token.SEMICOLON) to this.checkRuleCompleted(tn).
Thanks :) There are likely more ASI-related issues, but seems good to have this merged for the (probably most prominent) cases covered herein.