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

Validate expressions strictly. #1

Closed
2 tasks done
mbostock opened this issue Sep 9, 2016 · 0 comments
Closed
2 tasks done

Validate expressions strictly. #1

mbostock opened this issue Sep 9, 2016 · 0 comments

Comments

@mbostock
Copy link
Owner

mbostock commented Sep 9, 2016

Unfortunately vm.Script compiles a program, and it makes more sense for us to limit the result to an expression. We need to

  • wrap the expression in parens to make sure that ambiguous statements such as {} are correctly interpreted as expressions (and not a block statement) and that semicolons are not allowed
  • parse the expression using Esprima Acorn (because it supports preserveParens) to restrict programs to individual expression statements
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