Skip to content

Disable function expressions #96

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

Merged
merged 3 commits into from
Oct 19, 2018
Merged

Disable function expressions #96

merged 3 commits into from
Oct 19, 2018

Conversation

yyc
Copy link
Contributor

@yyc yyc commented Oct 19, 2018

Right now, something like this is permitted(!!):

  map(function a(x) {
    return x + 1;
  }, list(1));

It's undocumented and messes up the environment model (no binding for a is created in the calling frame).
Happens because estree is converting it to a function expression (which we include as an undocumented feature) if it sees a function declaration where it expects an expression.

To make js-slang align with the spec, this PR disables both named and unnamed function definition expressions. Only arrow functions are allowed as an expression now.

@yyc yyc requested review from remo5000 and martin-henz October 19, 2018 12:33
@coveralls
Copy link

coveralls commented Oct 19, 2018

Pull Request Test Coverage Report for Build 185

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.04%) to 60.433%

Totals Coverage Status
Change from base Build 178: 0.04%
Covered Lines: 787
Relevant Lines: 1231

💛 - Coveralls

@yyc yyc merged commit 615fb51 into master Oct 19, 2018
remo5000 added a commit that referenced this pull request Oct 31, 2018
remo5000 added a commit that referenced this pull request Oct 31, 2018
* Revert "Disable function expressions (#96)"

This reverts commit 615fb51.

* Bump version
@thomastanck thomastanck deleted the disable-function-expressions branch December 9, 2018 06:32
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

Successfully merging this pull request may close these issues.

3 participants