Shrey Banga
8a775a32ba
Retain trailing comments in array expressions ( #10369 )
...
* Retain trailing comments in array expressions
This is a proposed fix for https://github.com/babel/babel/issues/10368
with a simple test.
* Move lastElement in the block where it's used
* Test trailing comment after array expression
* Don't move comments after the array expression
* Retain trailing comment after the array expression
2019-08-28 14:03:37 -04:00
Justin Ridgewell
1664cce681
Don't allow JSXNamespacedName to chain ( #10366 )
...
Eg, `namespace:foo.bar` used to parse but is invalid in the [spec](https://facebook.github.io/jsx/ ).
Also, allow `JSXNamespacedName` in the `JSXOpeningElement`/`JSXClosingElement` builders.
2019-08-26 13:16:22 -04:00
Nicolò Ribaudo
15aa511b8e
Do not register ambient classes to the TS scope ( #10352 )
2019-08-20 17:22:47 -05:00
Huáng Jùnliàng
75090f10e5
fix: assign comment to ObjectProperty only when inside an ObjectExpression ( #10292 )
...
Fixes #10230
2019-08-13 13:49:16 -05:00
Daniel Tschinder
4f0840ab88
Update dev dependencies and fix linting errors ( #10228 )
...
* chore: Uppate dev dependencies
* chore: Fix lint errors
* chore: Format options.json files
* chore: Fix stupid flow errors
* Update test262 whitelist
Seems test262-stream was updated and now these tests work.
2019-07-27 15:09:30 +02:00
Tan Li Hau
f588e4ec47
BigInt type for Flow ( #10091 )
...
* flow BigIntLiteralTypeAnnotation
* numericSeparator for flow test plugins
* fix flow tuple
* fix code review
2019-07-03 16:48:46 +02:00
James DiGioia
6b8a37c413
Implement f# pipeline in parser ( #9450 )
2019-06-30 12:53:22 +02:00
Nicolò Ribaudo
8bf9714d69
[legacy decorators] Allow decorating generator methods ( #9912 )
...
* [legacy decorators] Allow decorating generator methods
The old proposal used LeftHandSideExpression (instead of
AssignmentExpression) to satisfy this usecase:
e240cbc91a
* Update flow whitelist
2019-06-30 11:32:16 +02:00
Nicolò Ribaudo
ca67637da4
[@babel/parser] Add "allowUndeclaredExports" option ( #9864 )
...
Ref: https://github.com/babel/notes/blob/master/2019/04/09.md#export-changes-in-scope-pr-break-meteor-issue
2019-06-30 11:16:05 +02:00
Tan Li Hau
1d3f9815df
fix import typeof in declare module ( #10132 )
2019-06-26 13:37:16 -05:00
Pig Fang
11fa2461ce
Disallow "let" as name at lexical bindings ( #10099 )
...
* Disallow "let" as name at lexical bindings
* Simplify
* Clean up
2019-06-18 23:17:00 +02:00
Tan Li Hau
fdbbb743b6
flow - allow type parameter defaults in function declarations ( #10084 )
...
* flow - allow type parameter defaults in function declarations
* fix flow test
* add intern_comments option
* fix flow parser test
* remove allowdefault from flowParseTypeParameterDeclaration
* rename test cases
2019-06-15 12:31:12 +02:00
Nicolò Ribaudo
888b9f6940
Remove unused code in the TS parser plugin ( #10025 )
2019-05-25 08:46:01 +02:00
Daniel Tschinder
54d257c105
Fix location for optional params in arrow functions ( #9998 )
...
* Fix location with optional params in arrow functions
* add test
* Ensure rollup replaces NODE_ENV and create sourcemap in dev
* Ensure finishNod*() is never called twice on a node
* Fix check for already finished nodes
2019-05-21 18:53:13 +02:00
Matthew Robertson
9c06e4ed4d
avoid exceptions for control flow ( #9974 )
...
* avoid exceptions for control flow
* review feedback: remove conditional because we know it is "<"
* drop tsTryParseTypeArguments method
2019-05-21 17:23:53 +02:00
Daniel Tschinder
f5b8140580
Do not use lookahead when parsing construct signature declarations ( #9995 )
2019-05-20 23:27:41 -07:00
Daniel Tschinder
b1826bf0a0
Only compute Position if not already in state ( #9989 )
...
* Only compute Position if not already in state
* Prioritize start locations
2019-05-17 15:32:34 -07:00
Daniel Tschinder
3f0590de2a
Do not use lookahead when parsing jsx expression containers ( #9988 )
2019-05-16 17:27:07 -07:00
Daniel Tschinder
5661de5908
Do not use lookahead when parsing imports in declare module in flow ( #9987 )
2019-05-16 02:31:37 -07:00
Daniel Tschinder
c2d303f8be
Do not use lookahead when parsing declare module or declare module.exports in flow ( #9985 )
...
* Do not use lookahead when parsing declare module or declare module.exports in flow
* Improve code
2019-05-16 02:31:21 -07:00
Daniel Tschinder
4da7a01aa9
Avoid unnecessary work during lookahead ( #9982 )
...
* Do not call pushComment when doing lookahead
* Do no updateContext when doing lookahead
* Do not clone contexts anymore
2019-05-15 17:02:12 -07:00
Daniel Tschinder
47eb1ddfe0
Do not use lookahead when parsing dynamic import or import.meta ( #9983 )
2019-05-15 16:34:16 -07:00
Daniel Tschinder
85432e2c44
Remove guardedHandlers from ASTs ( #9979 )
2019-05-15 03:37:22 -07:00
Tan Li Hau
354666aa17
fix: allow shebang directive ( #9922 )
...
* fix: allow shebang directive
* Update packages/babel-parser/src/plugins/flow.js
* chore: prettier
2019-05-07 16:22:25 +02:00
Tan Li Hau
277a2620c6
allow directives and other comments before flow pragma ( #9891 )
2019-04-26 22:23:35 +02:00
Nicolò Ribaudo
30d507c915
Add TS support to @babel/parser's Scope ( #9766 )
...
* [parser] Allow plugins to extend ScopeHandler
* Directly extend Scope
* Don't use new.target to get the ScopeHandler
* [parser] Add TS enum support to the Scope
* Remove duplicated options in tests
* Fix
* Fix flow
* Rename tests
* Add tests
* Full typescript support in scope
* Remove BIND_SIMPLE_CATCH
SCOPE_SIMPLE_CATCH was used instead
* Export TS types
* Register function declarations
* Fix body-less functions and namespaces
1) Move this.scope.exit() for functions from parseFunctionBody to the callers.
Otherwise the scope of body-less functions was never closed.
Also, it is easier to track scope.exit() if it is near to scope.enter()
2) Register namespace ids for export
* Disallow redeclaration of enum with const enum
2019-04-26 14:19:53 +02:00
Nicolò Ribaudo
cf3668779c
Always register global bindings as exportable ( #9865 )
2019-04-26 10:50:12 +02:00
Brian Ng
d7757f6d08
Fix TypeScript readonly error location ( #9887 )
2019-04-23 10:47:22 -04:00
Tan Li Hau
4198d91b89
Fix: remove constant context type check for TS ( #9869 )
2019-04-23 10:46:23 -04:00
Devon Govett
338853b5d3
Fix parsing typescript bodiless methods with the estree plugin also enabled ( #9890 )
2019-04-23 09:20:42 -05:00
Daniel Tschinder
c7587c016e
Don't accept '\08' or '\09' in strict mode ( #9769 )
2019-04-01 19:41:50 -07:00
Daniel Tschinder
60d7e940e2
Fix merge error
2019-03-26 15:44:16 -07:00
Daniel Tschinder
6bc9e7ebda
Correctly check for-in and for-of loop for invalid left-hand side ( #9768 )
...
* Correctly check for-in and for-of loop for invalid left-hand side
* Overwrite with env variable
2019-03-26 15:32:14 -07:00
Daniel Tschinder
7f4427432c
Parse right-hand-side of for/of as an assignment expression ( #9767 )
2019-03-25 18:14:56 -07:00
Tan Li Hau
2867bbf195
[typescript] parsing template literal as type ( #9748 )
2019-03-25 23:21:11 +01:00
Daniel Tschinder
444daf9224
Optimize parseBindingAtom code to get better error messages ( #9762 )
2019-03-25 14:23:39 -07:00
Daniel Tschinder
d720c6cfff
Explicit labels for tokenTypes ( #9761 )
...
* Explicit labels for tokenTypes
* Fix test
* Fix test
2019-03-25 14:23:16 -07:00
Daniel Tschinder
aaefc83a6c
Allow HTML comments on first line ( #9760 )
2019-03-25 14:22:57 -07:00
Daniel Tschinder
ef0722b4b2
Fix compatibility between estree and TS plugin ( #9700 )
2019-03-23 16:47:50 -07:00
Nicolò Ribaudo
2201fd839b
Modules might be in loose mode when checking for undecl exports ( #9725 )
2019-03-20 17:57:12 -07:00
Daniel Tschinder
ab41cb2cda
Fix scope checks with enabled flow plugin ( #9719 )
2019-03-20 16:03:31 -07:00
Daniel Tschinder
48d66eb648
Correctly parse TS TypeAssertions around arrow functions ( #9699 )
2019-03-18 22:18:47 -07:00
Tan Li Hau
cc45608423
Add readonly to TypeScript type modifier ( #9529 )
...
* add readonly to TSTypeOperator
* add more test cases for readonly
2019-03-16 06:41:51 +01:00
Tan Li Hau
25a3825a1d
TypeScript Constant contexts ( #9534 )
...
* Add as const fixtures
* parse constant context
* parse constant context
* quick check for literal
* code review, better error message, check array elements
* Removed unneeded test cases
2019-03-16 06:40:39 +01:00
Daniel Tschinder
cf4bd8bb8d
Remove input and length from state ( #9646 )
2019-03-11 00:42:42 -07:00
Daniel Tschinder
d8a5329834
Reorganize token types and use a map for them ( #9645 )
2019-03-06 14:30:04 -08:00
Matt Tingen
e53be4b387
[TS] Allow context type annotation on getters/setters ( #9641 )
...
* Allow context type annotation on getters/setters
* Extract getAccessorsExpectedParamCount
2019-03-06 22:54:42 +01:00
Erik Arvidsson
fba5655a44
Parenthesized expressions ( #8025 )
...
* Add parser createParenthesizedExpressions option …
When set to `true` we create `ParenthesizedExpression` nodes instead of
setting `extra.parenthesized`.
* Also update babel-parser.d.ts
2019-03-06 22:43:36 +01:00
Daniel Tschinder
29999007f6
Disallow escape sequences in contextual keywords ( #9618 )
...
* Disallow escape sequences in async
* Disallow escape sequences in get, set and async in class
* invalid escape tests
* Update whitelist
* tests for async in parens
* Add test for invalid newline between params and arrow
* Move canInsertSemilcolon() into shouldPArseAsyncArrow
2019-03-05 17:20:36 -08:00
Mathias Bynens
54ba6d80c0
Update identifier parsing per Unicode v12 ( #9637 )
...
https://github.com/tc39/ecma262/issues/1467
https://github.com/tc39/ecma262/pull/1468
2019-03-05 17:05:03 +01:00