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

SyntaxError: ID/number following ID/number isn't valid JS #1745

Closed
gfwilliams opened this issue Jan 15, 2020 · 0 comments
Closed

SyntaxError: ID/number following ID/number isn't valid JS #1745

gfwilliams opened this issue Jan 15, 2020 · 0 comments

Comments

@gfwilliams
Copy link
Member

@gfwilliams gfwilliams commented Jan 15, 2020

As in http://forum.espruino.com/conversations/342660/#comment15061030

// works
let Y = {
  _y:0,
  get y () { return this._y }
};
print(Y.y);

// fails because of pretokenise
(function () {
  let X = {
    _x:0,
    get x () { return this._x }
  };
  print(X.x);
})();

While maybe ID after ID might not normally be valid JS, so as not to cause issues, get and set are not treated as reserved words so it is possible to have ID then ID. We should just silently handle it and insert a space.

gfwilliams added a commit to espruino/EspruinoTools that referenced this issue Jan 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.