12 Commits

Author SHA1 Message Date
Daniel Tschinder
1b612148bf "yield" parsing inside function name and parameters (#689)
* Use parseFunctionParams to parse method parameters

* [funct] Set this.state.inGenerator before parsing the function name/params

This allows "yield" inside generator parameters to be actually
parsed as a yield expression

* [funct] Disallow yield in function parameters

* [arrow] "yield" can start an arrow function (e.g. "yield => {}")

* [arrow] Disallow YieldExpressions inside arrow parameters.

* [err msg] Disallow yield as fn name in strict mode using checkReservedWord.

So Babylon throws "yield is a reserved word" instead of
a custom "Binding yield in strict mode"

* [err msg] "X is reserved in strict mode" should have precedence over "X is reserved", since it is more specific.

This was observable if "checkKeywords" is true and the word is both a keyword and a reserved
word in strict mode

* Disallow "yield" as an identifier inside generators

* [tests] Add tests, update wrong esprima tests and enable disabled esprima tests

* [tests] Move uncategorized tests to es2015/yield

* [tests] Update test262 whitelist

* Fix regression introduced by 8c77073

* [tests] Update flow whitelist

* Fix flow errors
2017-11-01 16:05:18 +01:00
Brian Ng
29a4aea27b Update parsing flow type/typeof imports (#773)
* Remove extranneous backticks from type/typeof error message

* Add isLookaheadContextual util

* Update parsing flow type/typeof imports
2017-10-31 17:09:39 +01:00
Brian Ng
60ea39aa70 Fix export extensions handling of TS declare keyword (#757) 2017-10-14 15:25:42 -04:00
James Kyle
d9766932db Ensure no-overlap between Flow and TS node types (#710) 2017-09-25 15:42:33 -04:00
Karl Cheng
65bea96544 Add support for class private methods (#703)
* Add support for class private methods

This commit adds parser support for the TC39 Stage 2 Private Methods
proposal.

This commit also changes "key" in ClassPrivateProperty from an
Identifier to a PrivateName, as well as disallowing #constructor as a
valid private field name.

* Add tests for string literal get/set/async

These should be treated as regular methods and not special get/set/async
behaviour.

* Add tests for class private methods

This also removes a test from the Test262 whitelist that failed before
the changes for private methods support and now passes.

* Modify class private prop tests for PrivateName

* Add class private prop tests for #constructor

* Fix existing ASI test case failure
2017-09-06 18:09:12 -04:00
Daniel Tschinder
aec1bdb359 Enable no-case-declarations to prevent bugs and remove if (true) 2017-08-28 17:31:58 -04:00
Brian Ng
af2c974473
Fix TypeScript TypeParameterDeclaration location start values 2017-08-25 09:54:16 -05:00
James Henry
d0c7d7a8c7 Fix: Use parseExprAtom() for TS module id string (#684) 2017-08-20 10:38:55 -05:00
Andy
a39ea5dc9d Fix indentation in typescript.js (#665) [skip ci] 2017-08-08 22:44:20 -04:00
Andy
00ad6d8310 Fix conflict between "typescript" and "exportExtensions" plugins (#664)
* Fix conflict between "typescript" and "exportExtensions" plugins

* `==` -> `===`
2017-08-08 22:30:08 +02:00
Brian Ng
5180ecdca4 Use prettier (#600) 2017-06-28 12:41:42 -04:00
Andy
97c23461f9 TypeScript parser plugin (#523) 2017-06-28 10:57:50 -04:00