79 Commits

Author SHA1 Message Date
laoxiong
a8021fafc4 chore: add comment for whitespace char code (#676) 2017-08-16 21:51:56 +02:00
Nicolò Ribaudo
eee1a3854e Alow regex after "of" in for(...of...) (#579)
Fixes #456
2017-08-03 09:11:31 -05: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
Henry Zhu
88298536c5 Revert "Distinguish between ternary's : and arrow fn's return type (#573)"
This reverts commit a9a55fbd3fcb0dcd83758549dfd2c4fa3d0dcaa2.
2017-06-27 15:58:57 -04:00
Nicolò Ribaudo
a9a55fbd3f Distinguish between ternary's : and arrow fn's return type (#573)
* Distinguish between ternary's : and arrow fn's return type

* Correctly parse nested arrow functions inside conditional expressions

Defer the conversion of arrow function parameters to assignable nodes so that
it is possible to use the (invalid) ast to get the exact position of the (wrong)
arrow functions.

* Check params of arrow fns w/ type params or w/o return type

* Fix also async functions

* Add test from prettier

https://github.com/prettier/prettier/issues/2194

* Don't check arrow params if they are valid at the first attemp

* Use state instead of relying on the "noArrowParamsConversion" parameter

* Remove noArrowParamsConversion
2017-06-27 15:44:56 -04:00
Henry Zhu
39447b1cca Merge pull request #590 from peey/decorators-followup
Follow-up on Decorators PR
2017-06-27 15:34:44 -04:00
Peeyush Kushwaha
f2ad94d0e3 Incorporate suggestions from review 2017-06-27 22:46:43 +05:30
Peeyush Kushwaha
37fa77e84f Support decorator in decorator
Fixes #524
2017-06-23 18:10:16 +05:30
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
Daniel Tschinder
d605a9a4de Fix flow errors (#517) 2017-05-11 00:04:43 +02:00
Andy
1773ca7457 Type-check State (#492) 2017-05-10 21:55:09 +02:00
Brian Ng
d33c82781a Allow super in class properties (#499) 2017-05-02 14:41:10 -04:00
Andy
8288f7d9e4 Type-check tokenizer/types.js (#493) 2017-04-27 10:53:17 -04: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
Brian Ng
09bb9bc6be Fix parsing yield with dynamicImport (#383) 2017-02-28 12:43:34 -05: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
Raphael Mu
f25a2fbc78 add startLine option (#346) 2017-02-10 15:06: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
Sven SAULEAU
ed13a4ab05 Refactor tokenizer types file (#263)
* refactor(tokenizer): use class for keywork tokens

* refactor(tokenizer): re-use constacts in types

* refactor(tokenizer): binop token type

* feat(tokenizer): use beforeAndStartExpr for shortcut

* fix(tokenizer): typo in keywordTokenType

* refactor(tokenizer): don't use spread operator

* refactor(tokenizer): constant for isLoop, isAssign, prefix, postfix

* fix(tokenizer): remove constant beforeAndStartExpr

* style(tokenizer): space after comma
2017-01-10 20:22:56 +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
Vladimir Kurchatkin
3267e5f365 Don't set inType flag when parsing property names (#266)
* Don't set inType flag when parsing property names

* Add inPropertyName type definition

* Move inPropertyName check before this.curContext()
2017-01-05 12:25:57 +01:00
Gabe Levi
643124744f Optional names for function types and object type indexers (#197)
* Use .gitattributes to ignore files with weird newlines

* [Flow] Make parameter names in function types optional

* [Flow] Anonymous function types with single params can omit parens

* [Flow] Optional names for object indexer keys

* Add noAnonFunctionType explicitly to state

* Adjust gitattributes as files have been fixed
2016-11-09 16:22:53 +01:00
Daniel Tschinder
0d72a89df6 Fix flowtype and add inType to state (#189)
this improves the performance slightly
2016-10-17 10:45:46 -04:00
Daniel Tschinder
952d50faf9 Make exportIdentifiers and array so that base object properties are not accounted (#137) 2016-09-22 16:00:39 -04:00
Kai Cataldo
650e33376a Disallow duplicate named exports (#107)
fixes #69
2016-09-22 10:20:47 -04: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