100 Commits

Author SHA1 Message Date
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
Sven SAULEAU
c1702e1da6
fix: minor change 2017-05-30 20:16:13 +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
Andy
50694f99b1 Extract 'parseClassMember' method (#533) 2017-05-26 23:44:56 -04:00
Brian Ng
aad95c63ec Fix some flow unused warnings (#543) 2017-05-26 23:44:36 -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
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
Andy
aa78011666 Fix type check errors (#521) 2017-05-14 19:59:56 +02:00
Andy
d95b5fb83d Remove unused parameters from parseParenAndDistinguishExpression (#522) 2017-05-14 19:59:03 +02:00
Andy
a738870472 Type-check ExpressionParser (#488)
* Type-check ExpressionParser

* Improve test coverage
2017-05-11 16:30:21 +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
Andy
c4fb3fe742 Convert each file with parser methods to a class in an inheritance chain (#481) 2017-04-24 00:40:49 +02:00
Brian Ng
bc0719a145 Ensure non pattern shorthand props are checked for reserved words (#479) 2017-04-21 16:25:34 +02:00
Sven SAULEAU
b2fdd944fe
feat: add tests 2017-04-17 13:33:00 +02:00
Sven SAULEAU
0927e24ac6
Merge remote-tracking branch 'kristofdegrave/nullPropagation' into feat-optional-chaining 2017-04-17 13:21:35 +02:00
Sven SAULEAU
7b51979152
feat: add optional MemberExpression 2017-04-15 18:19:43 +02:00
Henry Zhu
9f7d9080cf remove babylon plugin for template revision since it's stage-4 (#426) 2017-03-22 14:05:56 -04:00
Arshabh Kumar Agarwal
964105e3fb Improves error message when super is called outside of constructor (#408) 2017-03-21 17:44:21 -04:00
Kevin Gibbons
2e467ef3bc 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:55:54 -04:00
Brian Ng
7a6d495704 Throw error if new.target is used outside of a function (#402) 2017-03-08 16:34:22 +01:00
Henry Zhu
5e0cce4974 Merge branch 'master' into 7.0 2017-02-28 14:37:13 -05:00
Brian Ng
09bb9bc6be Fix parsing yield with dynamicImport (#383) 2017-02-28 12:43:34 -05:00
Henry Zhu
8d90dc0d10 [7.0] Change RestProperty/SpreadProperty to RestElement/SpreadElement (#384)
* [7.0] Change RestProperty/SpreadProperty to RestElement/SpreadElement

* Fix rest element in array pattern at invalid location
2017-02-28 12:31:58 -05:00
Brian Ng
cd133ff8e1 Ensure consistent start args for parseParenItem (#386) 2017-02-28 12:56:56 +01:00
Daniel Tschinder
50ffa49201
Merge branch 'master' into 7.0
# Conflicts:
#	src/plugins/flow.js
2017-02-20 22:47:17 +01:00
Daniel Tschinder
2ef00a6631 Fix negative number literal typeannotations (#366)
* Fix negative number literal typeannotations

Also use parseLiteral() to parser string and number literal typeannotations
so that future changes (estree) to literals are also reflected to flow.

* Instead of invalid fallthrough throw immediately

* Increase coverage and better error mesage
2017-02-20 22:43:59 +01:00
Daniel Tschinder
d88befdd30
Merge branch 'master' into 7.0
# Conflicts:
#	src/parser/index.js
2017-02-12 13:32:06 +01:00
Daniel Tschinder
fac13290d7 Estree compatibility as plugin (#277)
* Initial estree support for ClassMethod

* Handle literals for estree

* Fix regex

* correct output of regexp and regenerate test

* Add tests for validation stuff with estree plugin

* Parse Properties correctly

This also refactors how babylon parses obj properties in general
so that this logic can be more easily extended.

* Run all throws-tests a second time with estree plugin

* Fix all throw tests

* Remove rebase conflict

* Correctly set kind

This ensures state.inMethod gets propagated correctly

* Add computed: false to methods with ident async

* Implement directive field on Directives

* Test invalid directives

* more tests
2017-02-12 12:48:41 +01: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
c79dd953ea Fix #304 and #309 (#339) 2017-02-10 15:36:46 +01:00
Daniel Tschinder
bc771bd0f9 Fix #336 by correctly setting arrow-param (#337) 2017-02-10 15:01:39 +01:00
Daniel Tschinder
4bd682e90b keywords are not allowed as local specifier (#307)
Also fix some error messages to be more specific
2017-02-10 14:58:44 +01:00
Daniel Tschinder
0309a5ba8a
Merge branch 'master' into 7.0
# Conflicts:
#	src/parser/statement.js
#	src/plugins/jsx/index.js
2017-01-27 23:12:20 +01:00
jeromew
898c4a7623 Add a parseExpression public method (#213) 2017-01-27 20:13:02 +01:00
Daniel Tschinder
b6c3b5aa83 Cleanup and splitup parser functions (#295)
This makes it easier to integrate the estree plugin.
2017-01-20 23:52:16 +01:00
Brian Ng
461ed45942 Fix parse error when destructuring set with default value (#317) 2017-01-20 22:21:40 +01:00
Daniel Tschinder
bd001767fb Revert "Temporary rollback for erroring on trailing comma with spread (#154)" (#290)
This reverts commit 5bac6e8ad99bcbf608f6df30d9942d6269f88fac.
2017-01-16 10:50:51 +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
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
Kai Cataldo
e260381e06 Throw error for reserved words enum and await (#195)
* Throw error for reserved words enum and await when source type is module

* Extract reserved word check into method

* Fix tests
2016-11-09 16:29:02 +01:00
Andrew Levine
01e984fd0f Allow "async" as identifier for object literal property shorthand (#187) 2016-10-17 10:33:18 -04:00
Moti Zilberman
9b6e243736 Raise error on duplicate definition of __proto__ (#183)
Spec: http://www.ecma-international.org/ecma-262/6.0/#sec-__proto__-property-names-in-object-initializers

This brings back to life a bit of dead code in Parser.prototype.checkPropClash, and enables several tests that were previously disabled.
2016-10-16 15:16:38 +02:00
Moti Zilberman
7c18bf83cc Increase test coverage (#175)
* 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"
2016-10-16 15:04:13 +02:00