Skip to content
This repository has been archived by the owner on May 19, 2018. 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
Merged

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

merged 2 commits into from
Sep 15, 2016

Conversation

TimothyGu
Copy link
Contributor

@TimothyGu 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.

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
Copy link
Contributor Author

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
Copy link
Member

hzoo commented Sep 7, 2016

@TimothyGu yeah sounds good

@TimothyGu
Copy link
Contributor Author

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

hzoo pushed a commit to babel/babel that referenced this pull request Sep 12, 2016
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
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
@TimothyGu TimothyGu deleted the strict-function-params branch September 15, 2016 18:00
panagosg7 pushed a commit to panagosg7/babel that referenced this pull request Jan 17, 2017
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants