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

babel-plugin-minify-constant-folding throws #245

Closed
kangax opened this issue Nov 2, 2016 · 2 comments · Fixed by #246
Closed

babel-plugin-minify-constant-folding throws #245

kangax opened this issue Nov 2, 2016 · 2 comments · Fixed by #246
Labels
babel This is an issue in the upstream project - Babel bug Confirmed bug

Comments

@kangax
Copy link
Member

kangax commented Nov 2, 2016

try {
  x({ 'toString': 0 } + '');
} 
catch(e) { }

Looks like we throw on path.evaluate() when trying to fold the constants. Should we just try-catch it?

/cc @boopathi

@kangax kangax added the bug Confirmed bug label Nov 2, 2016
@boopathi
Copy link
Member

boopathi commented Nov 2, 2016

Looks like we just have to fix path.evaluate then ... http://astexplorer.net/#/ZnK9C0caaf ... try catch around path.evaluate looks like a hectic workaround ... path.evaluate is used in every plugin of babili ...

@boopathi boopathi added the babel This is an issue in the upstream project - Babel label Nov 2, 2016
@kangax
Copy link
Member Author

kangax commented Nov 2, 2016

What would it return then? How do we differentiate between return value and something throwing?

kangax pushed a commit that referenced this issue Nov 3, 2016
* Fix path.evaluate for runtime errors in constant-folding (close #245)

* Move path.evaluate to separate helper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
babel This is an issue in the upstream project - Babel bug Confirmed bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants