Nicolò Ribaudo
9286cdb072
Re-enable disabled flow parser test ( #13661 )
2021-08-10 20:57:27 +02:00
doing-art
1229336fea
Fix parse error when using named import "as" with flow parser ( #13659 )
2021-08-10 20:55:21 +02:00
Nicolò Ribaudo
e721f61110
[flow] Fix parsing of arrows in conditional exprs in parens ( #13655 )
2021-08-10 20:46:38 +02:00
Nicolò Ribaudo
9d0aa1ec9d
Disallow <T>(a => b) when parsing Flow ( #13645 )
2021-08-10 19:09:23 +02:00
Nicolò Ribaudo
f9dcc4e4bb
Fix array destructuring elision parsing in TS arrow functions ( #13641 )
2021-08-05 21:47:30 +02:00
Yeonju Hwang
0671afcf87
[ts] support optional chain call with generic ( #13513 )
...
* support optional chain call with generic
* Add testcase handling new line
* allow only call if optional chain type parameter
* use exact error message
* add transform-typescript optional-chain call test
* use exact error message
* apply feedbacks
* Fix lint error
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-08-04 17:29:44 +02:00
Huáng Jùnliàng
d5b0d9e33d
Add attachComment parser option to disable comment attachment ( #13229 )
2021-08-04 17:04:22 +02:00
Nicolò Ribaudo
ddaf0d4296
Enable top-level await parsing by default ( #13387 )
2021-08-04 00:00:04 +02:00
Federico Ciardi
c35637e247
feat(ts): raise error for abstract property with initializer ( #13523 )
...
* feat: raise error for abstract property with initializer
* Improve tests
* Address review
* JLHwung review
* Update packages/babel-parser/src/plugins/typescript/index.js
* update test fixtures
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2021-08-03 23:50:27 +02:00
J. S. Choi
35e4e1f067
Hack-pipe proposal with % topic token ( #13416 )
...
Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com>
2021-08-03 23:30:16 +02:00
J. S. Choi
cd4b3fbffe
parser: Fix Hack/smart-pipe error positions ( #13426 )
2021-08-03 23:30:16 +02:00
J. S. Choi
6276853eb9
Add support for the "Hack" pipeline proposal ( #13191 )
...
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-08-03 23:30:16 +02:00
Nicolò Ribaudo
a254ea38a4
Enable ergonomic brand checks (#priv in) by default ( #13554 )
...
* Enable ergonomic brand checks by default in `@babel/parser`
* Enable ergonomic brand checks by default in `preset-env`
* Fix error position
* Update Babel 8 tests
2021-08-03 23:02:17 +02:00
Oleksandr T
b3ab4769d0
fix(ts): raise error for export default interface {} ( #13622 )
2021-08-02 18:16:01 +02:00
Nicolò Ribaudo
4a56387330
ts: Check if param is assignable when parsing arrow return type ( #13581 )
2021-07-26 17:58:10 +02:00
overlookmotel
dd942f92af
fix: parser strictMode option ( #13548 )
2021-07-20 10:42:04 -04:00
Nicholas Eveland
2c6db56696
Allow module block to start a member expression ( #13573 )
...
* Accept module in primaryExpression
* Add module blocks to primaryExpression
* Fix package.json
* Fix yarn.lock
* Fix yarn.lock
* Remove package.tgz file
2021-07-19 17:29:23 -04:00
Huáng Jùnliàng
6e57617138
Fix await binding error within static block ( #13088 )
...
* fix: allow await within SCOPE_FUNCTION under static block
* perf: scan scopeStack for once
* add new test case
* chore: update allowlist
2021-07-16 10:35:19 -04:00
Huáng Jùnliàng
79d3276f61
Overhaul comment attachment ( #13521 )
...
* refactor: inline pushComment
* chore: add benchmark cases
* perf: overhaul comment attachment
* cleanup
* update test fixtures
They are all bugfixes.
* fix: merge HTMLComment parsing to skipSpace
* perf: remove unattachedCommentStack
baseline 128 nested leading comments: 11_034 ops/sec ±50.64% (0.091ms)
baseline 256 nested leading comments: 6_037 ops/sec ±11.46% (0.166ms)
baseline 512 nested leading comments: 3_077 ops/sec ±2.31% (0.325ms)
baseline 1024 nested leading comments: 1_374 ops/sec ±3.22% (0.728ms)
current 128 nested leading comments: 11_027 ops/sec ±37.41% (0.091ms)
current 256 nested leading comments: 6_736 ops/sec ±1.39% (0.148ms)
current 512 nested leading comments: 3_306 ops/sec ±0.69% (0.302ms)
current 1024 nested leading comments: 1_579 ops/sec ±2.09% (0.633ms)
baseline 128 nested trailing comments: 10_073 ops/sec ±42.95% (0.099ms)
baseline 256 nested trailing comments: 6_294 ops/sec ±2.19% (0.159ms)
baseline 512 nested trailing comments: 3_041 ops/sec ±0.8% (0.329ms)
baseline 1024 nested trailing comments: 1_530 ops/sec ±1.18% (0.654ms)
current 128 nested trailing comments: 11_461 ops/sec ±44.89% (0.087ms)
current 256 nested trailing comments: 7_212 ops/sec ±1.6% (0.139ms)
current 512 nested trailing comments: 3_403 ops/sec ±1% (0.294ms)
current 1024 nested trailing comments: 1_539 ops/sec ±1.49% (0.65ms)
* fix: do not expose CommentWhitespace type
* add comments on CommentWhitespace
* add test case for #11576
* fix: mark containerNode be the innermost node containing commentWS
* fix: adjust trailing comma comments for Record/Tuple/OptionalCall
* fix: drain comment stacks in parseExpression
* docs: update comments
* add a new benchmark
* chore: containerNode => containingNode
* add more benchmark cases
* fix: avoid finishNodeAt in stmtToDirective
* finalize comment right after containerNode is set
* add testcase about directive
* fix: finish SequenceExpression at current pos and adjust later
* chore: rename test cases
* add new test case on switch statement
* fix: adjust comments after trailing comma of function params
* add comment attachment design doc
* misc fix
* fix: reset previous trailing comments when parsing async method/accessor
* chore: add more comment testcases
* fix flow errors
* fix: handle comments when parsing async arrow
* fix: handle comments when "static" is a class modifier
* fix flow errors
* fix: handle comments when parsing async function/do
* refactor: simplify resetPreviousNodeTrailingComments
* update test fixtures
2021-07-07 11:51:40 -04:00
Huáng Jùnliàng
8a3e0fd960
Async do expression should start at async ( #13534 )
2021-07-07 00:09:34 -04:00
Huáng Jùnliàng
bfd2f8f4b1
fix: disallow computed async/get/set keyword ( #13531 )
2021-07-07 00:25:57 +02:00
Federico Ciardi
9bad558d13
[babel 8] Use an identifier for TSTypeParameter.name ( #12829 )
2021-07-02 10:44:49 +02:00
Tony Gorez
b0fe6bdbc3
chore(parser): add test to handle optional paramteter in async call ( #13504 )
...
* chore(parser): add test to handle optional paramteter in async call
* chore(parser): add flow test
* chore(parser): add ts test
2021-06-23 11:11:06 -04:00
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
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
Yosuke Ota
0b29b5c2c0
Add support for d flag of regex literals in parser ( #13396 )
2021-05-31 08:34:53 -04:00
Nicolò Ribaudo
1341e560ff
Skip flow/typecasts/3 test on Node.js 6 ( #13382 )
2021-05-27 09:20:45 -05: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
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
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
2a3e35f026
chore: remove duplicate test262 parser tests ( #13241 )
2021-05-01 10:57:43 -04:00
Huáng Jùnliàng
0f2a1a8153
Add runFixtureTestsWithoutExactASTMatch in parser test runner ( #13227 )
2021-04-29 18:42:26 +02:00
Nicolò Ribaudo
a2ac2f39b5
Update @babel/parser fixtures
2021-04-28 18:41:10 +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