60 Commits

Author SHA1 Message Date
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
2bc124bf49
Fix some cases of keywords with escape sequences 2017-08-24 19:27:09 -05:00
laoxiong
a8021fafc4 chore: add comment for whitespace char code (#676) 2017-08-16 21:51:56 +02:00
Brian Ng
688a1e523e Fix parsing a <!-- b in modules (#626) 2017-07-14 09:16:31 -05:00
Brian Ng
63143ea5e9 Fix incorrect parsing of %* (#624) 2017-07-13 15:04:05 -05: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
William Horton
baa5f4dca7 Stage 2: BigInt (#588)
* Stage 2: BigInt

* Change plugin name to bigInt (camelcase).

* Update based on PR review, add test cases.

* Use hex for charCodes.
2017-06-27 23:35:57 -04:00
Daniel Tschinder
fecdb6feeb Make tokens optional (#563)
Adding tokens to the ast is significant slower and most tools
don't ever use them anyway
2017-06-27 23:26:24 -04:00
Karl Cheng
b4e06aa279 Fix parsing of nested classes with private fields
The parsing of private fields checks whether or not it is within a
class to determine if it is valid or not. However, the state.inClass
property is incorrect as it marks it as outside a class when the inner
class is closed.

This commit fixes this problem by replacing the state.inClass property
with a class nesting counter.
2017-06-23 18:34:59 +10:00
Daniel Tschinder
e982c0652c Fix v8 deopts (#581) 2017-06-17 11:41:23 -04:00
Justin Ridgewell
e1ec23cd3e Finish optionalChaining plugin 2017-06-03 01:20:40 -04:00
Henry Zhu
2dd624b44e Merge branch 'master' into feat-optional-chaining 2017-05-31 14:33:47 -04:00
Rick Waldron
2f5d146d54 Don't treat e, b, E, B as forbidden siblings for hex literals. (#549) 2017-05-30 18:14:31 -05:00
Sven SAULEAU
26096d6a3d
style: [skip ci] updated comment 2017-05-30 18:38:50 +02:00
Sven SAULEAU
d3bc8fcbdf
Merge branch 'master' into feat-optional-chaining 2017-05-29 18:43:40 +02:00
Rick Waldron
b344f62056 NumberLiteralSeparator: Stage 1 feature plugin. Closes gh-538 (#541)
* NumberLiteralSeparator: Stage 1 feature plugin

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>

* fix-up per review

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>

* nit: forbiddenNumericLiteralSeparatorSibling -> forbiddenNumericLiteralSeparatorSiblings

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>

* fix-up to change includes -> indexOf

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
2017-05-26 16:37:05 -04:00
Diego Ferreiro Val
01da62283c Modify grammar to support Private Fields proposal: (#260)
* Modify grammar to support Private Fields proposal:
- Adding optional plugin `classPrivateProperties`
- Adding PrivateName type identifier
- Adding ClassPrivateProperty to ClassBody
- Allow PrivateName in MemberExpression
- Allow PrivateName as a reference
- Adding tests

* Remove unnecesary liberal parameter

* Guarding for plugin dependecy for future versioning

* update spec.md [skip ci]

* move comment [skip ci]

* remove unused param [skip ci]

* Refactor PrivateName to contain Identifier in name property
2017-05-22 11:33:48 -04:00
Andy
1773ca7457 Type-check State (#492) 2017-05-10 21:55:09 +02:00
Andy
e1a06544bc Type-check utils (#491)
* Type-check utils

* Improve test coverage
2017-04-27 10:23:13 -04:00
Andy
34acecca2e Type-check CommentsParser and LocationParser (#484) 2017-04-25 16:07:01 -04:00
Andy
c4fb3fe742 Convert each file with parser methods to a class in an inheritance chain (#481) 2017-04-24 00:40:49 +02:00
Alex Kuzmenko
00d6db9fbb Fixed invalid number literal parsing (#473)
* Fixed invalid number literal parsing

* Don't ignore period or E characters after octal numbers
cherry-pick fix from acorn

* Fix tests
2017-04-21 15:22:50 +02:00
Andy
5e156310ca Type-check tokenizer/index.js (#460)
* Type-check tokenizer/index.js

* Update test baselines
2017-04-21 14:25:31 +02:00
Sven SAULEAU
0927e24ac6
Merge remote-tracking branch 'kristofdegrave/nullPropagation' into feat-optional-chaining 2017-04-17 13:21:35 +02:00
Alex Kuzmenko
22741a8068 Fix number parser (#433)
Fixed number parser #2

Added one more test
2017-04-03 22:25:29 +02:00
Kevin Gibbons
fab343e379 Add support for invalid escapes in tagged templates (#274)
Per the stage-3 TC39 proposal:
https://github.com/tc39/proposal-template-literal-revision
2017-03-21 16:50:34 -04:00
Kristof Degrave
1eaf01661b babel/babylon#328 babel/babylon#205 ?. as nullPropagation. For now it only works for member access. (.? or ?.[) If the object is undefined this will return undefined. If the object on which you want to access the property is defined, the value of the propery will be given back. 2017-02-11 21:20:15 +01:00
Kristof Degrave
b902fe6c7b ?. && ?[ as member access with nullPropagation. If the object is undefined this will return undefined. If the object on which you want to access the property is defined, the value of the propery will be given back. 2017-02-11 16:44:28 +01:00
Daniel Tschinder
b918554d73 Correct indent eslint rule config (#276)
* Change indent rule to correctly lint

* Remove rule again
2017-01-14 15:11:50 +01:00
greenkeeper[bot]
6773279039 Update eslint-config-babel to the latest version 🚀 (#273)
* chore(package): update eslint-config-babel to version 4.0.0

https://greenkeeper.io/

* Fix prefer-const

* Update package.json
2017-01-10 19:42:43 +01:00
Basil Hosmer
ddbda7dd04 exact object type annotations for Flow plugin (#104)
* exact object type annotations for Flow plugin

* Couple tweaks per suggestions

* s/==/===/

* add test for unexpected token in flowObjectType Semicolon
2016-09-13 10:07:23 -04:00
Daniel Tschinder
4506822180 Remove exponentiationOperator, asyncFunctions, trailingFunctionCommas (#98)
* This removes the exponentiationOperator as it is now in es2016

* Remove from tests

* Remove asyncFunctions and restructure test dirs

* Remove trailingFunctionCommas
2016-08-23 17:11:01 -04:00
Daniel Tschinder
88d7e2012c Fix lookahead to not add comments to arrays which are not cloned (#76)
We do not clone arrays in lookahead() but comments were added
to leading/trailing arrays during lookahead, leading to leak to the next next() call.

Also extracted parsing of JSXSpreadChild to own parse function.
2016-07-17 11:08:25 +02:00
Sebastian McKenzie
cf6e0d365e rename parser context types 2016-06-22 14:06:58 +01:00
Amjad Masad
b5315d4b27 Revert "Remove Flow annotations and pragmas"
This reverts commit 4252244d06b225ab26a02d52c04f9940a3e4d6a2.
2016-03-03 15:03:55 -08:00
Sam Goldman
08249b29e4 Remove weird codemod artifact 2016-02-28 13:23:28 -10:00
Sam Goldman
085361ad1a Remove Flow annotations and pragmas 2016-02-28 13:18:57 -10:00
Sebastian McKenzie
31f3eba4c1 Merge pull request #3361 from babel/klint
Switch to klint, fix some lint rules
2016-02-14 23:26:30 +00:00
Sebastian McKenzie
c9f9435445 Switch to klint, fix some lint rules 2016-02-14 23:25:14 +00:00
Logan Smyth
40e5f505f4 Properly fail to parse >== and <== - fixes T2921 2016-02-13 10:08:05 -08:00
Henry Zhu
5f0ece0bdb add some more flow types 2016-02-04 11:07:03 -05:00
Daniel Lo Nigro
20a483cd58 Fix Flow.
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
2015-11-15 21:30:22 -08:00
Jordan Klassen
021688e1c0 Remove unused second parameter of isIdentifierStart 2015-11-12 22:45:35 -08:00
Sebastian McKenzie
b909a81ab7 6.0.0
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.
2015-10-29 17:51:24 +00:00
Sebastian McKenzie
6d6ddf0bcd type annotate babylon 2015-09-23 15:59:41 +01:00
Sebastian McKenzie
59948c6649 add babylon hasFeature util method 2015-09-15 06:15:19 +01:00
Sebastian McKenzie
6e24626482 fix weird legacy acorn formatting 2015-08-24 15:31:41 -04:00
Sebastian McKenzie
032ca7ae1c never attempt to represent regexes natively 2015-08-24 15:31:30 -04:00