77 Commits

Author SHA1 Message Date
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
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
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
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
Brian Ng
17f2a2036c Allow namespace exotic to be exported as default (#474) 2017-04-19 13:59:49 +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
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
Andy
0545173f66 Test runner: Detect extra property in 'actual' but not in 'expected'. (#407)
* Test runner: Detect extra property in 'actual' but not in 'expected'.

Also update all expected.json where this would result in errors.

* Include rmExpected.js script in case it is needed again
2017-03-19 22:03:11 +01:00
Daniel Tschinder
4a813dc51a Revert "Disable failing tests (fixed in 7.0)"
This reverts commit 4c88cfe7651148e61fdbc8b7b8d2f8e615db4178.
2017-03-10 13:51:24 +01:00
Daniel Tschinder
90f2b12569 Merge branch 'master' into 7.0
* master:
  Disable failing tests (fixed in 7.0)
2017-03-10 13:51:05 +01:00
Daniel Tschinder
4c88cfe765
Disable failing tests (fixed in 7.0) 2017-03-10 13:50:53 +01:00
Daniel Tschinder
68e8550e84
Merge branch 'master' into 7.0
* master:
  Upgrade flow to 0.41
  Throw error if new.target is used outside of a function (#402)
  Fix watch command (#403)
  Update yarn lock
  Fix parsing of class properties (#351)

# Conflicts:
#	src/parser/statement.js
#	test/fixtures/experimental/class-constructor-call/illegal-key/options.json
2017-03-10 13:47:45 +01:00
Kevin Gibbons
81056eeee7 Fix parsing of class properties (#351) 2017-03-10 12:43:45 +01:00
Andrew Levine
aec4beff0c Don't parse class properties without initializers when classProperties is disabled and Flow is enabled (#300) 2017-03-01 11:55:24 +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
Henry Zhu
b0f8405b52 Revert "Don't parse class properties without initializers when classProperties plugin is disabled, and Flow is enabled" (#376) 2017-02-23 09:50:25 -05:00
Kevin Gibbons
561d4f74b0 Forbid semicolons after decorators in classes (#352) 2017-02-22 16:24:40 +01:00
Brian Ng
ad8d520406 Ensure takeDecorators is called on exported class (#358) 2017-02-22 16:22:38 +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
c79dd953ea Fix #304 and #309 (#339) 2017-02-10 15:36:46 +01:00
Brandon Dail
56928dca66 [7.0] Remove ForAwaitStatement, add await flag to ForOfStatement (#349)
* Remove ForAwaitStatement, add await flag to ForOfStatement

* Set await flag for all ForOfStatements
2017-02-09 17:37:03 -05: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
Andrew Levine
9929baaca8 Don't parse class properties without initializers when classProperties is disabled and Flow is enabled (#300) 2017-01-23 23:56:39 +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
Brian Ng
c5462e1a30 Remove classConstructorCall plugin (#291) 2017-01-16 10:49:42 +01:00
Andrew Levine
cec8bc0354 Add some test coverage for decorators stage-0 plugin (#250) 2017-01-05 22:07:40 +01: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
Moti Zilberman
b5877f04b1 Fix up #172 (#177)
* Update two esprima tests to the new "expected TOKEN" messages

* Update dynamic-import to use "expected (" error message
2016-10-14 16:50:07 -04:00
Moti Zilberman
d3af158ba5 Annotate more errors with expected token (#172)
Expanding on #150, this allows `unexpected()` to accept the expected token type instead of a message string.
This overload is then used in a couple more places (that independently implement a logic similar to `expect()`'s) to construct an `Unexpected token, expected FOO` message.
2016-10-14 16:10:09 -04:00
Jordan Gensler
c63c1bc728 [dynamic-import] Implementing import() syntax (#163) 2016-10-14 14:54:21 -04:00
Daniel Tschinder
d4d6d05d25 Slightly better error messages (#150)
* Slightly better errors

Instead of "Unexpected token" we now print
"Unexpected token, expected <type.label>"
2016-10-12 10:38:26 -04:00
Kai Cataldo
7dd45f7465 Check for duplicate named exports in exported rest elements/properties (#164) 2016-10-10 10:10:16 -04:00
Henry Zhu
5bac6e8ad9 Temporary rollback for erroring on trailing comma with spread (#154) 2016-10-01 20:08:25 -04:00
Daniel Tschinder
7877829fcb Add static errors for object rest (#149)
* Fix parsing object rest

This makes object-rest-spread behave according to spec and only
allow one rest operator and enforces it to be the last
param in the object.

Also move all object-rest-spread tests to a own folder.

* Show nicer error messages
2016-09-30 11:37:55 -04:00
Moti Zilberman
4e1fbd48d5 Add support for computed class property names (#120) (#121) 2016-09-21 21:24:59 -04:00
Daniel Tschinder
abf6ca8e5e Add tests for export extensions (#127)
The case which includes a namespaced and default import was not tested yet
2016-09-15 19:24:11 +02:00
Daniel Tschinder
2cfae60b15 Fix issues with default object params in async functions (#96)
This change allows async functions to have a spread argument which
defines a default value.
2016-08-23 17:19:49 -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
97325592fa Fix exponential operator to behave according to spec (#75) 2016-07-17 11:08:12 +02:00
Henry Zhu
d4cd0bf7b7 Actually remove it.. 2016-05-02 22:44:50 -04:00
Henry Zhu
c81db57b03 Remove unused file
Ref f81c281fc4 (commitcomment-17331315)
2016-05-02 22:43:47 -04:00
Kevin Smith
f81c281fc4 Parse for-await statements when asyncGenerators plugin is active 2016-04-05 13:33:49 -04:00
Shuhei Kagawa
29a6578658 parse parameter decorators 2016-03-25 14:04:33 +09:00