IWANABETHATGUY
1c117eb20d
fix: avoid print extra semicolon after accessor property ( #4199 )
...
## Before
```js
export default class Foo { @x @y accessor #aDef = 1 }
```
**output**
```bash
Original:
export default class Foo { @x @y accessor #aDef = 1 }
Printed:
export default class Foo {
accessor #aDef=1;;
}
```
2024-07-11 20:16:02 +08:00
Dunqing
bbe5dede07
refactor(semantic): set current_scope_id to scope_id in enter_scope ( #4193 )
...
close : #4170
2024-07-11 08:45:35 +00:00
Dunqing
7f1adddaf0
refactor(semantic): correct scope in CatchClause ( #4192 )
...
close : #4186
CatchClause has two scopes. The first one is `CatchClause`, which will add a `CatchParameter` to it. The second one is `Block`, which will add binding that declares in the current block scope.
The spec has a syntax error about `CatchParameter`
- It is a Syntax Error if any element of the BoundNames of CatchParameter also occurs in the LexicallyDeclaredNames of Block.
2024-07-11 08:45:30 +00:00
Boshen
ca0b4fa08a
refactor(tasks): clean up test files and remove libs.txt ( #4172 )
2024-07-10 17:38:06 +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
Luca Bruno
5731e3957f
refactor(ast)!: store span details inside comment struct ( #4132 )
...
This tweaks `Comment` definition in order to internally store the start
and end position of its span.
Closes: https://github.com/oxc-project/oxc/issues/4069
2024-07-09 23:23:43 +08:00
DonIsaac
2f53bdf72d
feat(semantic): check for abstract ClassElements in non-abstract classes ( #4127 )
...
feat(semantic): check for abstract ClassElements in non-abstract classes
chore: update coverage snapshots
2024-07-09 03:35:32 +00:00
DonIsaac
3a0f2aa7ef
feat(parser): check for illegal modifiers in modules and namespaces ( #4126 )
2024-07-09 02:54:06 +00:00
Don Isaac
c4ee9f8ec6
feat(semantic): check for abstract initializations and implementations ( #4125 )
2024-07-08 17:30:16 -04:00
Don Isaac
0f026089d1
fix(semantic): bind TSImportEqualsDeclarations ( #4100 )
...
Closes #4091
2024-07-08 14:03:47 +08:00
DonIsaac
e386b62331
feat(semantic): check for invalid type import assignments ( #4097 )
...
Adds checks to `TSImportEqualsDeclaration` for invalid use of `import type` modifier.
```ts
import { Foo } from './foo'
namespace Bar {
export class Baz {}
}
import type A = Foo.Baz; // not allowed
import type B = Bar.Baz; // not allowed
import type C = require('./c'); // allowed
```
2024-07-08 03:14:22 +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
Boshen
243c9f35b0
refactor(parser): use function instead of trait to parse list with rest element ( #4028 )
...
closes #3887
2024-07-02 13:43:14 +00:00
Boshen
1dacb1fc5b
refactor(parser): use function instead of trait to parse delimited lists ( #4014 )
...
relates #3887
The rest of the list parsing trait implementations involves ... parsing
`rest`, which I'll refactor in another PR.
2024-07-02 14:47:56 +08:00
Boshen
23038ad8f8
fix(codegen): print TSFunctionType inside TSTypeAssertion ( #3999 )
2024-07-01 14:44:35 +00: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
Dunqing
51e54f902c
fix(codegen): should print TSModuleDeclarationKind instead of just module ( #3957 )
2024-06-29 05:24:36 +00:00
underfin
9e8709f06e
fix(sourcemap): should add tokens for unordered span ( #3941 )
...
close: https://github.com/oxc-project/oxc/issues/3843
2024-06-27 20:24:22 +08:00
Boshen
275349a9fe
fix(parser): parse function type parameter name accessor ( #3926 )
...
fixes #3910
2024-06-26 13:34:24 +00:00
Boshen
3db2553dc2
refactor(parser): improve parsing of TypeScript type arguments ( #3923 )
2024-06-26 07:16:18 +00:00
Boshen
4cf3c7645f
refactor(parser): improve parsing of TypeScript types ( #3903 )
...
- [x] fix everything
2024-06-26 05:58:16 +00:00
Boshen
187f0782c1
refactor(parser): improve parsing of parse_function_or_constructor_type ( #3892 )
...
part of #3502
2024-06-25 03:43:02 +00:00
Dunqing
ef82c78a72
fix(parser): trailing comma is not allowed in ParenthesizedExpression ( #3885 )
...
close : #3878
The implementation is copied from `SeparatedList`'s `print_list`.
```diff
fn parse_list(&mut self, p: &mut ParserImpl<'a>) -> Result<()> {
p.expect(self.open())?;
let mut first = true;
while !p.at(self.close()) && !p.at(Kind::Eof) {
if first {
first = false;
} else {
p.expect(self.separator())?;
- if p.at(self.close()) {
- break;
- }
}
self.parse_element(p)?;
}
p.expect(self.close())?;
Ok(())
}
```
2024-06-24 14:56:32 +00:00
Boshen
13754cbd3d
fix(parser): change diagnostic to "modifier cannot be used here" ( #3853 )
2024-06-23 15:14:27 +00:00
Boshen
ae09a97a09
refactor(ast)!: remove Modifiers from ts nodes ( #3846 )
2024-06-23 19:44:35 +08:00
Boshen
1af5ed3d89
refactor(ast)!: replace Modifiers with declare and const on EnumDeclaration ( #3845 )
2024-06-23 10:34:55 +00:00
Boshen
0673677317
refactor(ast)!: replace Modifiers with declare on Function ( #3844 )
2024-06-23 10:34:54 +00:00
Boshen
ee6ec4ee57
refactor(ast)!: replace Modifiers with declare and abstract on Class ( #3841 )
2024-06-23 10:34:53 +00:00
Boshen
9b38119ec9
refactor(ast)!: replace Modifiers with declare on VariableDeclaration ( #3839 )
...
part of #2958
2024-06-23 10:34:52 +00:00
Don Isaac
d5f6aeb1ca
feat(semantic): check for illegal symbol modifiers ( #3838 )
2024-06-23 12:36:09 +08:00
Dunqing
dc8e2b8dc0
feat(coverage/transpile): compare error message ( #3789 )
2024-06-20 10:13:36 +00:00
Boshen
4e9d8a5585
chore: fix some nightly clippy warnings
2024-06-19 00:53:58 +08:00
Boshen
051ceb6539
chore: improve some format by running cargo +nightly fmt
2024-06-19 00:48:30 +08:00
Boshen
5c38a0fd69
feat(codegen)!: new code gen API ( #3740 )
...
This PR introduces two type alias to avoid the confusing const generic `pub struct Codegen<'a, const MINIFY: bool>`
* CodeGenerator - Code generator without whitespace removal.
* WhitespaceRemover - Code generator with whitespace removal.
Usage is changed to a builder pattern:
```rust
CodeGenerator::new()
.enable_comment(...)
.enable_sourcemap(...)
.build(&program);
```
2024-06-18 15:50:12 +00:00
Boshen
5a99d30eba
feat(codegen): improve codegen formatting ( #3735 )
2024-06-18 11:10:36 +00:00
Boshen
bf9b38a197
feat(codegen): improve codegen formatting ( #3731 )
2024-06-18 04:14:10 +00:00
Boshen
38a75e559b
feat(coverage): improve codegen ( #3729 )
2024-06-18 02:53:09 +00:00
Boshen
41b3c24f98
feat(coverage): snapshot isolated declarations dts emit ( #3723 )
2024-06-17 18:31:03 +00:00
Dunqing
889198ae60
fix(coverage/transpiler): diff comparison results are reversed ( #3727 )
...
<img width="963" alt="image" src="https://github.com/oxc-project/oxc/assets/29533304/fbec74bc-e06e-42f3-9963-f2fdce3ae784 ">
2024-06-17 16:47:05 +00:00
Dunqing
0fbecdcd81
fix(isolated-declarations): should be added to references, not bindings ( #3726 )
2024-06-17 16:47:02 +00:00
Boshen
0b8098a442
feat(napi): isolated-declaration ( #3718 )
2024-06-17 13:06:00 +00:00
Boshen
815260ed2f
refactor(isolated-declarations): decouple codegen ( #3715 )
2024-06-17 11:45:29 +00:00
Boshen
87c3282deb
chore(transformer-dts): change crate to oxc_isolated_declarations ( #3713 )
2024-06-17 11:14:13 +00:00
Boshen
982e6f08df
chore: make println and eprintln opt-in ( #3712 )
...
I noticed accidental `println` can be merged, which isn't really nice.
2024-06-17 10:40:34 +00:00
Boshen
da1e2d0e9b
fix(codegen): improve typescript codegen ( #3708 )
...
Remaining issues are tracked in https://github.com/oxc-project/oxc/issues/3692
2024-06-17 09:34:54 +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