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

Pretokenisation: usage of catch in promises: #1868

Closed
gfwilliams opened this issue Jun 25, 2020 · 0 comments
Closed

Pretokenisation: usage of catch in promises: #1868

gfwilliams opened this issue Jun 25, 2020 · 0 comments

Comments

@gfwilliams
Copy link
Member

E.setFlags({pretokenise:1})
//E.setFlags({pretokenise:0}) // this fixes it
function go() {
  Promise.resolve().then(function() {
    console.log("Ok");
  }).catch(function(e) {
    console.log("ERROR",e);
  });
}
go()
// Uncaught Error: Function "" not found!

http://forum.espruino.com/conversations/349928/#comment15371590
http://forum.espruino.com/conversations/349399/

So it's to do with catch being converted to a token even though in this case it's just a function name.

Easiest is just to make the EspruinoTools not tokenise 'catch' - but it's worth investigating to see if it's a deeper problem with pretokenisation

gfwilliams added a commit to espruino/EspruinoTools that referenced this issue Jun 26, 2020
gfwilliams added a commit to espruino/BangleApps that referenced this issue Jun 26, 2020
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

No branches or pull requests

1 participant