This repository has been archived by the owner. It is now read-only.

Implement ES2016 check for simple parameter list in strict mode #106

Merged
merged 2 commits into from Sep 15, 2016

Conversation

Projects
None yet
4 participants
@TimothyGu
Copy link
Contributor

TimothyGu commented Sep 4, 2016

Per e.g. ECMA-262 7th Edition § 14.1.2:

It is a Syntax Error if ContainsUseStrict of FunctionBody is true and IsSimpleParameterList of FormalParameters is false.

Similar clauses cover arrow functions, methods, and generator functions/methods, as well as async functions and async arrow functions.

A similar change was merged in Acorn as acornjs/acorn#424, but instead of erroring out on the strict mode directive like that PR does I feel erroring out on the parameter is clearer.

The removed Esprima test case is still present in Esprima, but their support for ES2016 is incomplete anyway.

TimothyGu added some commits Sep 4, 2016

Implement ES2016 check for simple parameter list in strict mode
See e.g. ECMA-262 7.0 14.1.2:

> It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
> IsSimpleParameterList of FormalParameters is false.

Similar clauses cover arrow functions, generator functions, methods, and
generator methods, as well as async functions and async arrow functions.
@TimothyGu

This comment has been minimized.

Copy link
Contributor Author

TimothyGu commented Sep 4, 2016

The Travis CI failure is due to some tests in Babel copied from Traceur that were written for ES2015 only.

Should I submit a PR to Babel that removes the tests first?

@hzoo

This comment has been minimized.

Copy link
Member

hzoo commented Sep 7, 2016

@TimothyGu yeah sounds good

@TimothyGu

This comment has been minimized.

Copy link
Contributor Author

TimothyGu commented Sep 11, 2016

@hzoo, PR to Babel submitted: babel/babel#4501

hzoo added a commit to babel/babel that referenced this pull request Sep 12, 2016

Remove ES2015 tests than do not parse in ES2016 (#4501)
These tests are originally from Traceur, which does not fully support
ES2016.

See babel/babylon#106 for a rationale why these code blocks are not
valid ES2016.
@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Sep 15, 2016

Current coverage is 94.38% (diff: 100%)

Merging #106 into master will decrease coverage by 2.39%

@@             master       #106   diff @@
==========================================
  Files            19         19          
  Lines          3130       3080    -50   
  Methods         320        325     +5   
  Messages          0          0          
  Branches        800        806     +6   
==========================================
- Hits           3029       2907   -122   
+ Misses          101         94     -7   
- Partials          0         79    +79   

Powered by Codecov. Last update dc56c0b...8238134

@danez danez merged commit 643d3f3 into babel:master Sep 15, 2016

3 checks passed

codecov/patch 100% of diff hit (target 96.77%)
Details
codecov/project Absolute coverage decreased by -2.39% but relative coverage increased by +3.22% compared to dc56c0b
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@TimothyGu TimothyGu deleted the TimothyGu:strict-function-params branch Sep 15, 2016

panagosg7 added a commit to panagosg7/babel that referenced this pull request Jan 17, 2017

Remove ES2015 tests than do not parse in ES2016 (babel#4501)
These tests are originally from Traceur, which does not fully support
ES2016.

See babel/babylon#106 for a rationale why these code blocks are not
valid ES2016.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.