* Increase test coverage
* Test for error when binding `this` in destructuring pattern
* Ignore coverage of inAsync check in parseAwait - already checked externally
* Ignore coverage of default case in checkPropClash
* Remove unused parameter isAsync from parseParenAndDistinguishExpression
* Ignore coverage of an `else` branch in flowParseTypeParameterDeclaration
* Flow: remove unused parameters to flowParseTypeAnnotatableIdentifier
* Flow: ignore coverage of pass-through throw statement in parseConditional
* Flow: Add test for error on property with type param
* Flow: ignore coverage of pass-through throw statements in parseMaybeAssign, parseArrow
* Add test for error on XML-style comment in module code
* Update test for error on method in object pattern
* Test for error: "Only '=' operator can be used for specifying default value"
* Fix parsing object rest
This makes object-rest-spread behave according to spec and only
allow one rest operator and enforces it to be the last
param in the object.
Also move all object-rest-spread tests to a own folder.
* Show nicer error messages
* Rephrase "assigning/binding to rvalue" error messages with context (#119)
* Fix code style in parser/lval.js
* istanbul ignore some unused branches in parser/lval.js
* Fix code style again in parser/lval.js
* Slightly simplify logic
* 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.
* This removes the exponentiationOperator as it is now in es2016
* Remove from tests
* Remove asyncFunctions and restructure test dirs
* Remove trailingFunctionCommas
The fix includes creating a new method on the parser called `parseArrow`.
This new function by default only checks if current position matches an
arrow. If it does returns the `node` otherwise `undefined`.
The flow plugin can then extend this function and correctly parse the typeAnnotation
and add it to the node.
With this change, in the flow plugin there is no need anymore to extend
`parseParenAndDistinguishExpression` and the arrow handling in `parseParenItem`
could also be removed, because it is all handled now in `parseArrow`.
Some existing tests were failing, because `extra->parentesized` is now missing,
but this is correct as it is now inline with parsing without flow annotation. No extra
is added for arrow function without type annotations.
In the expression-parser `this.next()` was replaced by a more specific
`this.expect(tt.parenL)`.
Removed `@flow` annotation from files that don't actually pass Flow check at the moment. These will be added back file by file once the files are properly converted to use Flow.
Closes#3064
I'm extremely stupid and didn't commit as I go. To anyone reading this
I'm extremely sorry. A lot of these changes are very broad and I plan on
releasing Babel 6.0.0 today live on stage at Ember Camp London so I'm
afraid I couldn't wait. If you're ever in London I'll buy you a beer
(or assorted beverage!) to make up for it, also I'll kiss your feet and
give you a back massage, maybe.