81 Commits

Author SHA1 Message Date
Daniel Tschinder
775dcfa6d6 Improve performance by removing all spread/rest usages (#561) 2017-06-05 19:21:41 +02: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
Andy
50694f99b1 Extract 'parseClassMember' method (#533) 2017-05-26 23:44:56 -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
Andy
aa78011666 Fix type check errors (#521) 2017-05-14 19:59:56 +02:00
Andy
7a8b64c0d3 Type-check StatementParser (#489) 2017-05-11 16:28:12 +02:00
Alex Rattray
4e776bf00b Better error message for anonymous class declarations (#509) 2017-05-10 21:26:38 +02:00
Brian Ng
d33c82781a Allow super in class properties (#499) 2017-05-02 14:41:10 -04:00
Andy
3a6b77f374 Don't add 'await' property to ForInStatement (#504) 2017-05-02 14:37:58 -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
Daniel Tschinder
d1a5220b89 Add support for declare export + fixes (#224)
* Add support for declare export

* Do not allow declare module inside declare module

* Reallow module exports outside module

* Add handling of `declare export default`

Add check for multiple module.export declarations

* Disallow export let/const/type

Refactor parsing object properties to share more code and add support
for getters and setters

* Rename tests

* Update test fixtures

* Optimize for performance

* disallow declare export interface outside of module

* Refactor code to be more readable and less lookahead

* Add comments

* Add test for export star as

* Test for number literal getter/setter

* Add more tests

* Fix tests

* Allow union types and correctly eat semi after type

* Use non computed keys

* Fix tests
2017-04-21 14:41:59 +02:00
Brian Ng
17f2a2036c Allow namespace exotic to be exported as default (#474) 2017-04-19 13:59:49 +02: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
Brian Ng
c8c71684c4 Don't consume async when checking for async func decl (#377) 2017-03-01 12:11:48 -05: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
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
2dd57d17b9 Revert "Fix export default async function to be FunctionDeclaration" (#375) 2017-02-23 09:50:33 -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
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
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
Daniel Tschinder
d2faddf0d9 Fix export default async function to be FunctionDeclaration (#324) 2017-01-27 19:43:06 +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
b6c3b5aa83 Cleanup and splitup parser functions (#295)
This makes it easier to integrate the estree plugin.
2017-01-20 23:52:16 +01:00
Daniel Tschinder
d5cd2c3231 Allow imports in declare module (#315)
* Allow imports in declare module {}

* Rename bodyElement to bodyNode
2017-01-20 22:19:50 +01:00
Brian Ng
c5462e1a30 Remove classConstructorCall plugin (#291) 2017-01-16 10:49:42 +01:00
greenkeeper[bot]
68a173c97c Update eslint-config-babel to the latest version 🚀 (#299)
* chore(package): update eslint-config-babel to version 6.0.0

https://greenkeeper.io/

* Fix linting
2017-01-15 11:12:49 +01:00
Brian Ng
9d78213ab6 Improve error message on attempt to destructure named import (#288) 2017-01-14 15:38:30 +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
Jeff Morrison
9ea4e9dead Add support for Flow shorthand import type (#267) 2017-01-03 10:52:18 +01:00
Alex Rattray
68bb1c6598 Allow this.state.clone() when parsing decorators (#262)
Adding the line `this.state = this.state.clone();` in a parser plugin 
(specifically, in my case `parseExprAtom`)
would break decorators. 

This change fixes that.
2017-01-02 10:37:05 +01:00
Kai Cataldo
5fb4353778 Throw error when exporting non-declaration (#241)
* Throw error when exporting non-declaration

fixes #238

* Do check ahead of parsing export statement
2016-12-01 21:03:13 +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
Jordan Gensler
c63c1bc728 [dynamic-import] Implementing import() syntax (#163) 2016-10-14 14:54:21 -04:00
Daniel Tschinder
4c445fd5f8 Remove kcheck (#173) 2016-10-14 12:12:55 -04:00
Jeroen Engels
e14f93d1bb Fix crash when exporting with destructuring and sparse array (#170)
* Create reproducible crash when exporting with destructuring and sparse array

* Fix crash when exporting with destructuring and sparse array
2016-10-12 19:36:08 -04:00
Kai Cataldo
7dd45f7465 Check for duplicate named exports in exported rest elements/properties (#164) 2016-10-10 10:10:16 -04:00
Kai Cataldo
76e69277d7 Check for duplicate named exports in exported destructuring assignments (#144)
* Check for duplicate named exports in exported destructuring assignments

* Refactor duplicate error reporting

* Remove unnecessary check
2016-10-04 15:06:26 +02:00
Henry Zhu
1d04d12794 Don't do the duplicate check if not an identifier (#140) 2016-09-23 00:44:13 -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
Moti Zilberman
774e6b446b Rephrase "assigning/binding to rvalue" errors to include context (#119) (#123)
* Rephrase "assigning/binding to rvalue" error messages with context (#119)

* Fix code style in parser/lval.js

* istanbul ignore some unused branches in parser/lval.js

* Fix code style again in parser/lval.js
2016-09-22 12:02:20 -04:00
Kai Cataldo
650e33376a Disallow duplicate named exports (#107)
fixes #69
2016-09-22 10:20:47 -04:00
Moti Zilberman
4e1fbd48d5 Add support for computed class property names (#120) (#121) 2016-09-21 21:24:59 -04:00