Commit Graph

157 Commits

Author SHA1 Message Date
camchenry 392752f63e fix(parser): handle import {type as as} correctly (#11488)
- closes https://github.com/oxc-project/oxc/issues/11484
2025-06-05 05:37:27 +00:00
Boshen be3bd8ce22 fix(parser): fix panic while parsing async await => {} in module (#11493)
fixes #11487
2025-06-05 05:01:20 +00:00
Boshen 7e884511bd feat(parser): syntax errors for decorators appearing in conflicting places (#11482)
fixes #11472

e.g.

```
@dec1 export @dec2 class C {}

@dec1 export default @dec2 class {}
```
2025-06-04 14:09:25 +00:00
Boshen e291191a1e fix(parser): fix panic when parsing export import (#11473)
fixes #11453
2025-06-04 09:00:02 +00:00
Boshen 4c9a9b35e0 fix(parser): guard against re-lex tokens when fatal error (#11023)
fixes #10977
2025-05-14 05:37:08 +00:00
camc314 2b02d84565 fix(parser): allow for(using using stmts (#10985)
fixes #10981
2025-05-14 04:57:57 +00:00
Boshen 2718f29fcf fix(parser): fix panic when the parser tries to re-lex >> (#10756)
fixes #10639
2025-05-01 15:04:48 +00:00
Boshen f803807968 fix(parser): fix crash when parsing for(in (#10640) 2025-04-27 15:42:11 +00:00
Boshen 7664bd0018 fix(parser): fix using asi (#10504)
fixes #10503

```ts
using
foo = bar()

await using
foo = bar()
```

should be parsed as

```ts
using;
foo = bar()

await using;
foo = bar()
```

not

```ts
using foo = bar()

await using foo = bar()
```
2025-04-19 05:28:30 +00:00
Dunqing bc54d1fabd fix(semantic): redeclare variable with function declaration inside the function should not throw error (#10160)
close: #10159
2025-04-01 13:05:30 +00:00
Dunqing a88eb5638e fix(parser): parsing errors occur when type parameters are followed by as or satisfies (#9553)
close: #9541
2025-03-05 06:09:39 +00:00
camc314 2c6e3f176f fix(parser): fix false positive parsing optional member expr (#9534)
closes #9525
2025-03-04 10:42:54 +00:00
camc314 01de74c2a2 fix(parser): correctly fail parsing when parsing foo.bar?. (#9499)
closes #9497

[swc](https://play.swc.rs/?version=1.11.5&code=H4sIAAAAAAAAA8tJLVEoSi0oylewVaiuteYCs%2FXS7PUAMGIdLBkAAAA%3D&config=H4sIAAAAAAAAA1WPSw7DIAwF9zkF8rrbdtE79BAWdSIifrKJVBTl7iUE0maH3xsz8jooBbNoeKq1PMsQkYX4nEsi2Sf8lARIOxTNJia49XaWvRrRCtVoOxpIyBOluiX3hoMNQajjLXPGmzH%2FC3VwkUnkCu4o%2BsnSVTc0JbjwXmrZDkk50qF%2FwA%2FqsvNjMPLqm4kXGrYvhlQioBQBAAA%3D)

[typescript](https://www.typescriptlang.org/play/?#code/PTAEAEBcGcFoDsD2BjAFgU2QawFABt1JQAndAB2MVAF5QBvAXwG4dSLEA6AMwH4Og)

[babel](https://babeljs.io/repl#?browsers=defaults%2C%20not%20ie%2011%2C%20not%20ie_mob%2011&build=&builtIns=false&corejs=3.21&spec=false&loose=false&code_lz=DYUwLgBATiAOUHsIF4IG8C-BuAUDeCAdAGYD8hQA&debug=false&forceAllTransforms=false&modules=false&shippedProposals=false&evaluate=false&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=env%2Creact%2Cstage-2%2Cstage-3&prettier=false&targets=&version=7.26.9&externalPlugins=&assumptions=%7B%7D)

[esbuild](https://esbuild.github.io/try/#dAAwLjI1LjAAAGxldCByZXBybyA9IHt9OwpyZXByby5mPy4)
2025-03-03 11:57:38 +00:00
Boshen bde412692d feat(parser): parse a ? b ? (c = 0) : d => 1 : (e = 2) : f => 3 (#9229)
closes #9215
2025-02-19 13:31:14 +00:00
branchseer f88acb331b fix(parser): allow line breaks between const and enum (#8193)
https://www.typescriptlang.org/play/?ts=5.7.2#code/MYewdgzgLgUApmArgWwAQEFUG8C+Mg
2024-12-31 08:45:17 +08:00
Boshen 1486849ec2 fix(semantic): syntax error for undeclared private field access (#7635)
closes #7582
2024-12-04 05:33:04 +00:00
Song Gao cf3415b0e4 chore(doc): replace main/master to tag/commit to make the url always accessible (#7298) 2024-11-16 21:00:30 +08:00
Boshen 0e4adc15dd feat(ast)!: remove invalid expressions from TSEnumMemberName (#7219) 2024-11-09 08:48:14 +00:00
DonIsaac f1551d64bc fix(semantic): ? on variable declaration type annotations is a syntax error (#5956)
Closes #5955
2024-09-22 00:01:47 +00:00
Boshen 1bc08e296e fix(coverage): parse babel unambiguously (#5579) 2024-09-07 10:49:00 +00:00
Boshen 603817bef9 feat(oxc)!: add SourceType::Unambiguous; parse .js as unambiguous (#5557)
See https://babel.dev/docs/options#misc-options for background on `unambiguous`

Once `SourceType::Unambiguous` is parsed, it will correctly set the returned `Program::source_type` to either `module` or `script`.
2024-09-07 10:48:58 +00:00
overlookmotel dc924892cc test: add trailing line breaks to conformance fixtures (#5541)
Continuation of #5537. Ensure all conformance fixture files have a trailing line break.
2024-09-06 12:55:17 +00:00
Boshen 10279f55d9 feat(parser): add syntax error for hyphen in JSXMemberExpression <Foo.bar-baz /> (#5440)
closes #5355
2024-09-04 14:09:06 +00:00
DonIsaac c2fa72571f feat(ast,parser): parse TSTypeAnnotations on AccessorProperty (#5179)
Closes #5177

While making this, I noticed an uncaught parse error for accessors: accessors cannot be optional. I'll add a fix for this in an up-stack PR.
2024-08-25 01:02:48 +00:00
heygsc ad2be97078 fix(semantic): incorrect semantic check for label has same name (#5041)
fix: #5036

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-08-23 10:36:12 +08:00
DonIsaac d5c4b190aa fix(parser): fix enum member parsing (#4543)
Closes #4449
2024-07-30 10:43:09 +00:00
lucab 9a87e41332 fix(parser): avoid crashing on invalid const modifier (#4267)
Followup on https://github.com/oxc-project/oxc/pull/3977, fixing one of the crashes at https://github.com/oxc-project/oxc/pull/3977.
2024-07-15 11:37:31 +00:00
DonIsaac 4a656c3a18 fix(lexer): incorrect lexing of large hex/octal/binary literals (#4072)
Closes #3347. Implementation follows the approach described by @overlookmotel [here](https://github.com/oxc-project/oxc/issues/3347#issuecomment-2119004288).
2024-07-10 16:39:10 +00:00
Boshen 28eeee0f71 fix(parser): fix asi error diagnostic pointing at invalid text causing crash (#4163) 2024-07-10 14:45:10 +00:00
Boshen 6e5447e5d5 chore(coverage): add test for huge binary expression and nested if statements (#4084)
relates https://github.com/oxc-project/backlog/issues/58
2024-07-08 00:15:26 +08:00
Boshen aaac2d8775 fix(codegen): preserve parentheses from AST instead calculating from operator precedence (#4055)
…operator precedence

Calculating from operator precedence is currently unsafe and will result
incorrect semantics.
2024-07-05 14:01:17 +08:00
DonIsaac 63f36daae0 feat(parser): parse modifiers with parse_modifiers (take 2) (#3977)
Same as #3948, with fixes for bugs found by @Boshen.
2024-06-30 03:46:34 +00:00
Boshen 14bc31ee74 Revert "feat(parser): parse modifiers with parse_modifiers (#3948)"
This reverts commit 7b38bde073.
2024-06-29 14:16:26 +08:00
DonIsaac 7b38bde073 feat(parser): parse modifiers with parse_modifiers (#3948)
Closes #3929
2024-06-29 05:29:47 +00:00
Boshen 275349a9fe fix(parser): parse function type parameter name accessor (#3926)
fixes #3910
2024-06-26 13:34:24 +00:00
Boshen d65c652700 feat(parser): display jsx mismatch error, e.g. <Foo></Bar> (#3696)
relates #3548 

I'll remove the closing name in a follow up PR.

The snapshot is incorrect, so I created a follow up issue:
https://github.com/oxc-project/oxc/issues/3697
2024-06-16 01:05:28 +08:00
Dunqing cf41513d28 fix(parser): parse const extends in arrow functions correctly (#3450)
close: #3443
2024-05-28 21:34:52 +08:00
Boshen 6078a6d292 fix(parser): fix lexer error while parsing parenthesized arrow expressions (#3400)
closes #3399
2024-05-24 09:59:17 +00:00
Boshen 9ced605487 refactor(parser): start porting arrow function parsing from tsc (#3340)
relates #3320
2024-05-18 22:35:29 +08:00
Boshen c4ccf9f4d8 fix(parser): parse DecoratorCallExpression when Arguments contains MemberExpression (#3265)
closes #3261
closes #3262

```
DecoratorCallExpression[Yield, Await] :
  DecoratorMemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
```
2024-05-14 03:18:41 +00:00
Boshen 798a1fde09 fix(parser): fix failed to parse JSXChild after JSXEmptyExpression (#2726)
fixes #2723
2024-03-15 13:39:20 +08:00
Boshen 86ee074678 fix(parser): remove all duplicated comments in trivia builder (#2689) 2024-03-12 17:51:22 +08:00
Boshen e2d2ce3369 feat(parser): parse decorators properly (#2603)
closes #2562
2024-03-04 19:30:41 +08:00
Dunqing 60db720fa6 feat(parser): parse import attributes in TSImportType (#2436)
close: #2394 

https://github.com/microsoft/TypeScript/blob/64d2eeea7b9c7f1a79edf42cb99f302535136a2e/src/compiler/types.ts#L2177-L2185

The corresponding test cases were skipped, so I manually added some
cases to misc

https://github.com/oxc-project/oxc/blob/f5db48237ff774d778bdb48e13950b5a8876f361/tasks/coverage/src/typescript.rs#L118-L121
2024-02-19 12:26:42 +08:00
Boshen 28daf83b19 feat(semantic): report no class name error (#2273)
closes #2144
2024-02-02 19:05:00 +08:00
Boshen 8d99a15ac9 feat(semantic): report error on optional variable declaration in TypeScript (#2261)
closes #2253
closes #2255
2024-02-02 14:13:10 +08:00
Boshen 2f5afff9bd fix(parser): fix crash on TSTemplateLiteralType in function return position (#2089)
```
interface Helpers {
  inspect(): `~~~~\n${string}\n~~~~`;
}
```
2024-01-19 23:14:05 +08:00
Dunqing b50c5ec623 fix(parser): unexpected ts type annotation in get/set (#1942)
fix: https://github.com/oxc-project/oxc/issues/1939
2024-01-08 15:07:43 +08:00
Boshen 2b4d1bf142 fix(parser): await in jsx expression
closes #1740
2023-12-19 20:23:16 +08:00
Boshen 1554f7c0d2 feat(parsr): parse let.a = 1 with error recovery (#1587) 2023-11-29 23:21:39 +08:00