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
c3b992e031
Minor change in an error message
2017-06-23 22:04:35 +05:30
Peeyush Kushwaha
2c8fc75643
Add test case for decorated static method
2017-06-23 18:13:51 +05:30
Peeyush Kushwaha
37fa77e84f
Support decorator in decorator
...
Fixes #524
2017-06-23 18:10:16 +05:30
Karl Cheng
44d842c30b
Add private fields numeric name test
2017-06-23 18:34:59 +10: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
Karl Cheng
43dba7e7c1
Throw on attempt to delete a private field
...
Given that private fields can only be used within classes, any code
using them must be in a strict mode context. As private fields cannot
be deleted, throw an early SyntaxError.
2017-06-23 18:34:59 +10:00
Peeyush Kushwaha
add8e4ad13
Helpful error message for @dec export class
2017-06-23 02:19:08 +05:30
Henry Zhu
f976bdd21c
Merge pull request #587 from peey/decorators-stage-2
...
Decorators Stage 2 Parsing
2017-06-22 10:20:08 -04:00
Peeyush Kushwaha
d99618cdfe
renames files
2017-06-22 02:01:28 +05:30
Peeyush Kushwaha
e5fdb3448d
rename decoratorsStage2 -> decorators2
2017-06-22 02:00:36 +05:30
Peeyush Kushwaha
e1972baff5
Decorated classes/methods start where the decorator starts
2017-06-22 01:45:53 +05:30
Peeyush Kushwaha
04b40868f9
Add more tests; fix plugin conflict code
2017-06-19 23:45:57 +05:30
aardito2
ac936e315a
Fix comment attachment for call expressions ( #575 )
2017-06-18 22:57:42 +02:00
Peeyush Kushwaha
b60ac52ae6
Reorganize tests and add tests
...
Add tests for static properties and private properties
2017-06-18 02:00:13 +05:30
Peeyush Kushwaha
4f8ac6bada
Merge branch 'master' into decorators-stage-2
2017-06-18 01:33:16 +05:30
Peeyush Kushwaha
b7c1c559c7
Add test case for object properties
2017-06-18 01:30:46 +05:30
Peeyush Kushwaha
38c417e971
Reorganize tests; camelCase plugin name
2017-06-18 01:25:54 +05:30
Daniel Tschinder
e1e2c32bf3
Correctly put typeParameters on FunctionExpression ( #585 )
2017-06-17 15:43:31 -04:00
Peeyush Kushwaha
b5e23835ce
Disallow exports between decorator & class body
...
For stage 2 decorators
2017-06-17 18:12:14 +05:30
Peeyush Kushwaha
9c639743dd
Disallow in object literals, params, class props
...
And add tests to reflect the same
2017-06-17 17:49:33 +05:30
Peeyush Kushwaha
001044ffa7
Add tests for stage 2 decorators from PR#353
2017-06-17 13:33:42 +05:30
Daniel Tschinder
e11794c735
Add back shorthand field to Property ( #580 )
...
Also add some better types for estree
2017-06-17 01:05:32 +02:00
Nicolò Ribaudo
6b4fba4deb
The { after a function generic type annotation is a statement ( #578 )
...
This would have previously been interpreted as an expression,
because usually after ">" there can't be a statement.
Fixes #36
2017-06-15 09:39:39 -05:00
Daniel Tschinder
69cba43f82
Fix parsing of private fields ( #566 )
...
The computed key is not part of the spec.
key for ClassProperties is an Expression
Do not parse computed and literal keys for PrivateClassProperties
2017-06-06 11:42:07 -04:00
Sven SAULEAU
e064bb9135
Merge pull request #545 from xtuc/feat-optional-chaining
...
Optional Chaining: Stage 1 plugin
2017-06-05 23:13:16 +02:00
Henry Zhu
4c8f4a23db
add another test
2017-06-05 16:51:45 -04:00
Michal Srb
bbc3cd45cf
Fix location info on FunctionTypeParam nodes ( #565 )
2017-06-05 12:41:46 -04:00
Daniel Tschinder
0656717552
Fix stmt value being the raw value ( #557 )
2017-06-03 16:16:45 +02: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
Jan Olaf Krems
d4e842d4eb
Add plugin for import.meta proposal ( #544 )
...
* Add plugin for import.meta proposal
Fixes https://github.com/babel/babylon/issues/539
* Tests for assignment/mutation of import.meta
* Use correct identifier in failure message
* Simpler & more consistent script errors for import.meta
2017-05-30 19:28:51 -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
Rick Waldron
3ca75dc9ec
Adds test to ensure that numericSeparator plugin does not alter "_" handling in Identifier ( #548 )
2017-05-30 14:31:13 -05:00
Sven SAULEAU
b0386005c8
docs: NewExpression spec
2017-05-30 20:14:19 +02:00
Sven SAULEAU
9bcd85acf3
feat: CallExpression support
2017-05-30 20:12:43 +02:00
Sven SAULEAU
51bd87baa8
feat: use syntax plugin
2017-05-30 18:35:29 +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
aardito2
557696da3a
Fixed disappearing comments following a trailing comma on the last property of an object literal or the last argument of a call expression ( #478 )
2017-05-22 17:02:02 -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
Kevin Gibbons
6c4acecf00
Fix #437 : only prohibit 'export type from "module" ' when flow is enabled ( #438 )
...
* Only prohibit 'export type' when flow is enabled
* Fix lint
2017-05-19 10:05:44 +02:00
Brian Ng
dcef4012a0
Disallow SpreadElement inside dynamic import ( #529 )
...
* Disallow SpreadElement inside dynamic import
* tweak error message
2017-05-17 12:07:09 -04:00
Max Schaefer
b08fdf87e8
Fix handling of anonymous parameters in flowParseObjectTypeMethodish. ( #526 )
...
By analogy with `flowParseFunctionTypeParams` (cf. commit 407c97c9c2fe453fc2ae940c3d3b11c90d9dbc8e).
2017-05-16 22:53:13 +02:00
Daniel Tschinder
f6020aecbf
Convert argument of SpreadElement correctly to assignable ( #518 )
2017-05-11 00:45:08 +02:00
Alex Rattray
4e776bf00b
Better error message for anonymous class declarations ( #509 )
2017-05-10 21:26:38 +02:00
Brian Ng
9d1f819320
Allow flow class field to be named constructor ( #510 )
2017-05-10 16:18:08 +02:00
Brian Ng
d33c82781a
Allow super in class properties ( #499 )
2017-05-02 14:41:10 -04:00
Andy
9660f06b25
Don't add 'shorthand' property to ObjectMethod ( #506 )
2017-05-02 14:39:21 -04:00