Sosuke Suzuki
0eb2853732
[ts] Support override modifiers for parameter properties ( #13428 )
2021-06-10 22:29:38 +02:00
Huáng Jùnliàng
b1fe831e4a
fix: disallow JSX tag after non-null assertion ( #13449 )
2021-06-10 15:07:47 -04:00
Huáng Jùnliàng
d3f4c22c28
update test fixtures ( #13440 )
...
* update test fixtures
* chore: typo
2021-06-09 11:48:29 -04:00
Huáng Jùnliàng
b9c1884a58
Reduce exprAllowed usage ( #13431 )
2021-06-09 16:36:09 +02:00
Federico Ciardi
a64d08c101
fix(parser): correctly parse record and tuple tokens ( #13418 )
...
* fix(parser): correctly parse token location for `#{` and `#[`
* fix: `bar` tokens
* fix: don't parse record and tuple pipe closing tokens as operators
2021-06-08 20:58:48 -04:00
Eyoatam Tamirat
56db172b0e
fix(@babel/parser): fix tokenizer context update code ( #13422 )
...
* fix(`@babel/parser`): fix `_function` update code
* fmt
2021-06-08 08:26:50 -04:00
Tony Gorez
a0369fdbfa
fix: throw when async() call param is object with assignement ( #13410 )
2021-06-03 16:12:15 +02:00
Huáng Jùnliàng
b8175ec060
Relax import assertion key-is-type constraint ( #13409 )
2021-06-02 07:51:56 -04:00
Huáng Jùnliàng
b281fe352c
Use set in parser scope ( #13408 )
...
* chore: rename benchmark
* perf: back parser scope names storage by set
* chore: add benchmark
2021-06-01 10:35:19 -04:00
Huáng Jùnliàng
cbad50ac1d
Faster checkReservedWord ( #13386 )
...
* perf: faster parser scope check
* perf: early return for identifier length > 10
* perf: early return for normal identifier names
* chore: add benchmark
* Update packages/babel-parser/src/parser/expression.js
2021-06-01 08:42:23 -04:00
Huáng Jùnliàng
ae3f5d905a
Back parser state exportedIdentifiers by set ( #13406 )
2021-06-01 07:17:30 -04:00
Yosuke Ota
0b29b5c2c0
Add support for d flag of regex literals in parser ( #13396 )
2021-05-31 08:34:53 -04:00
Huáng Jùnliàng
079f8cd5bc
fix: disallow surrogate in the end of contextual name ( #13377 )
2021-05-26 22:57:59 -04:00
Huáng Jùnliàng
acf2a10899
Faster tokenizer lookahead ( #13341 )
...
* refactor: simplify token context structure
* add benchmark
* perf: return a sub-state on tokenizer lookahead
* Update packages/babel-parser/src/tokenizer/index.js
Co-authored-by: Brian Ng <bng412@gmail.com>
* Update packages/babel-parser/src/tokenizer/index.js
Co-authored-by: Brian Ng <bng412@gmail.com>
* remove irrelevant comment
* fix: guard curPosition with isLookahead
* add test cases
Co-authored-by: Brian Ng <bng412@gmail.com>
2021-05-25 21:12:38 -04:00
Sosuke Suzuki
d6a5f6190d
[ts] Default typeAnnotation of TSTypePredicate to null ( #13354 )
2021-05-23 20:12:42 +02:00
Huáng Jùnliàng
461ba2531a
refactor: add parse*Literal parser routines ( #13333 )
...
* refactor: simplify parseLiteral interface
* refactor: extract specific methods on parsing literals
* fix: avoid StringLiteral type comparison
* add test cases
* fix: remove redundant node
* Update packages/babel-parser/src/plugins/flow/index.js
Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com>
* update test fixtures
* fix: refine parseLiteral typings
Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com>
2021-05-19 16:00:24 -04:00
Huáng Jùnliàng
2a5b23186a
perf: minimize identifier lookahead when parsing let ( #13328 )
2021-05-18 08:19:58 -04:00
Huáng Jùnliàng
0d0950f341
fix: preserve tokensLength in tryParse ( #13326 )
...
* fix: preserve tokensLength in tryParse
* Apply suggestions from code review
Co-authored-by: Brian Ng <bng412@gmail.com>
Co-authored-by: Brian Ng <bng412@gmail.com>
2021-05-17 15:32:12 -04:00
Nicolò Ribaudo
c2181343f1
Parse let declarations whose id starts with \ ( #13325 )
2021-05-17 08:46:59 -05:00
Huáng Jùnliàng
b3d35cd412
[Babel 8]: remove module attributes parser/generator support ( #13308 )
...
* breaking: remove support of moduleAttributes
* Update packages/babel-parser/src/plugin-utils.js
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
* chore: remove todo comments
* make prettier happy
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-05-14 09:55:40 -04:00
Sosuke Suzuki
b2d9156cc6
Update to Prettier 2.3 ( #13288 )
2021-05-10 15:34:13 +02:00
Sosuke Suzuki
1d54419ec4
Parse attributes of import expression with estree plugin ( #13284 )
...
* Parse attributes of import expression with estree plugin
* Add tests
* Update packages/babel-parser/src/types.js
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2021-05-07 16:37:20 -04:00
Huáng Jùnliàng
a8fea4037d
Faster identifier tokenizing ( #13262 )
...
* add benchmark
* perf: faster identifier tokenizing
- Mover iterator identifier parsing to the Flow plugin
- If the character is an identifier start, pass it to readWord1
2021-05-06 18:47:19 -04:00
Huáng Jùnliàng
a387973821
Refactor private name tokenizing ( #13256 )
...
* add benchmark
* refactor: create tt.privateName token for private names
* add backward compat privateName = hash + name to Babel 7
* perf: get private name SV from token value
* chore: tweak benchmark file
* chore: update test fixtures
* convert tt.privateName to PrivateIdentifier
* perf: avoid most isPrivateName call
* Update packages/babel-parser/src/parser/expression.js
Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
* perf: use inlinable codePointAtPos
* make prettier happy
Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
2021-05-06 09:46:09 -04:00
Huáng Jùnliàng
278193b6f7
fix: update chunkStart on missing unicode escape ( #13261 )
2021-05-06 08:31:11 -04:00
Sosuke Suzuki
ef87648f3f
Parse static blocks with typescript plugin ( #13243 )
...
* Support static blocks with typescript
* Add tests
* Reuse isStatic var
* Disallow parsing static blocks with modifiers
* Add tests
* Raise recoverable errors
* Address review
* Add tests for static static {}
2021-05-03 16:17:08 -04:00
Stuart Cook
fa01fbe052
Parse for await (async of ...) ( #13244 )
2021-05-01 18:00:21 +02:00
Huáng Jùnliàng
28d7442aae
Parse async do expressions ( #13043 )
...
* parse async do expressions
* add test cases
* update test fixtures
* chore: add syntax-async-do-expressions
* generater support
* fix: do not transform async do expressions
* chore: add asyncDoExpressions to missing plugin helpers
* update ast types
* add more test cases
* throw when asyncDoExpressions is enabled but not doExpressions
* avoid add parentheses for async do expressions
* address review comments
* chore: update parser typings
2021-04-28 18:26:01 +02:00
Sosuke Suzuki
7f5b212322
babel-parser: Add new typescript plugin option dts: boolean ( #13113 )
2021-04-28 18:24:18 +02:00
Nicolò Ribaudo
22b0eb038f
[ts] Enforce order for the override modifier ( #13209 )
...
* [ts] Enforce order for the `override` modifier
* generator
* Add more checks
* Update TS tests
2021-04-28 18:21:31 +02:00
George Zahariev
8433cd0c05
Support parsing Flow's Optional Indexed Access Types ( #13224 )
2021-04-28 18:21:31 +02:00
Nicolò Ribaudo
57daba85aa
Parse string export names by default (moduleStringNames) ( #13195 )
...
* Parse string epxort names by default (`moduleStringNames`)
* Remove remaining references
2021-04-28 18:21:31 +02:00
Huáng Jùnliàng
ceaab0bae7
Parse class fields and private methods by default ( #13175 )
...
* feat: materialize class features
* chore: move testcases to es2022
* chore: update test fixtures
* chore: remove classPr\w+ from options.json
* chore: remove empty options.json
* update flow test allowlist
* update typescript allowlist
2021-04-28 18:21:31 +02:00
Sosuke Suzuki
b116865077
Use this.isThisParam in typescript parser ( #13163 )
2021-04-28 18:21:31 +02:00
Sosuke Suzuki
c949660b34
babel-parser: Deep freeze for makeErrorTemplates ( #13142 )
2021-04-28 18:21:31 +02:00
Sosuke Suzuki
7484b51e56
Support TS 4.3 get/set type members ( #13089 )
...
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-04-28 18:21:31 +02:00
Sosuke Suzuki
2521c666f7
Add internal ESLint rule for consistent parser error messages ( #13130 )
2021-04-28 18:21:31 +02:00
Pig Fang
bf14a106ad
Support TS 4.3 override syntax in class ( #13097 )
...
* support TS 4.3 `override` syntax in class
* fix types
* fix types
* tweak error message
* update TypeScript commit
* split tests
* add more tests
* update allowlist
* disallow `override` with `declare`
* disallow `override` in non-sub class
* update TypeScript allowlist
* rename error message key
* add more tests
2021-04-28 18:21:31 +02:00
Sosuke Suzuki
f8aa32f767
Support parsing Flow's Indexed Access Types ( #13053 )
2021-04-28 18:21:31 +02:00
Pig Fang
eac0259ce2
Support TS 4.3 static index signature in classes ( #13096 )
2021-04-28 18:21:31 +02:00
Sosuke Suzuki
0ee98139a6
Introduce parser error codes ( #13033 )
2021-04-28 18:21:31 +02:00
Huáng Jùnliàng
10f4d08efb
refactor: avoid parsing logic on locations ( #13200 )
2021-04-25 09:15:48 -04:00
Federico Ciardi
368bf893fa
[ts] raise SyntaxError for declare before getter/setter ( #13143 )
...
* fix: raise `SyntaxError` for `declare` before getter/setter
* fix: allow `declare` when class property name is `get` or `set`
2021-04-17 23:00:24 +02:00
Federico Ciardi
42e630e8a2
Allow trailing comma after rest parameter in TSDeclareFunction ( #13101 )
...
* fix(ts): allow trailing comma after rest parameter in `TSDeclareFunction`
* Apply code review changes
Co-Authored-By: Nicolò Ribaudo <7000710+nicolo-ribaudo@users.noreply.github.com>
2021-04-06 18:36:17 +02:00
Federico Ciardi
7fe3ebf4db
fix: raise SyntaxError for unparenthesized assert and assign ( #13099 )
...
* fix: raise `SyntaxError` for unparenthesized assert and assign
* chore
2021-04-06 16:07:13 +02:00
Huáng Jùnliàng
8efbac4a5d
fix: the LHS in for-of loop should not start with let ( #13049 )
...
* fix: the LHS in for-of loop should not start with let
* Update packages/babel-parser/src/parser/statement.js
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-03-29 16:54:23 -04:00
Huáng Jùnliàng
0067fd9e02
Disallow await before exponential ( #12441 )
...
* refactor: move unary exponential check to parseMaybeUnary
* fix: disallow await before exponential
* add test cases
2021-03-25 11:20:47 -04:00
Federico Ciardi
4f727139ec
fix(ts): Allow parenthesized "assert and assign" ( #12933 )
...
Co-authored-by: Nicolò Ribaudo <7000710+nicolo-ribaudo@users.noreply.github.com>
2021-03-22 17:00:03 +01:00
Sosuke Suzuki
beb7cf8b24
Sort error keys with ESLint ( #13020 )
2021-03-18 21:01:57 +01:00
Huáng Jùnliàng
0988c471e9
Parse type imports in TSImportEqualsDeclaration ( #12962 )
2021-03-14 23:34:49 +01:00