mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
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;;
}
```
This commit is contained in:
parent
e3e663bae4
commit
1c117eb20d
3 changed files with 9 additions and 2 deletions
|
|
@ -2491,7 +2491,6 @@ impl<'a, const MINIFY: bool> Gen<MINIFY> for AccessorProperty<'a> {
|
||||||
p.print_equal();
|
p.print_equal();
|
||||||
value.gen_expr(p, Precedence::Assign, Context::default());
|
value.gen_expr(p, Precedence::Assign, Context::default());
|
||||||
}
|
}
|
||||||
p.print_semicolon();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,14 @@ fn new_expr() {
|
||||||
test("new (foo()).bar();", "new (foo()).bar();\n");
|
test("new (foo()).bar();", "new (foo()).bar();\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn access_property() {
|
||||||
|
test(
|
||||||
|
"export default class Foo { @x @y accessor #aDef = 1 }",
|
||||||
|
"export default class Foo {\n\taccessor #aDef=1;\n}\n",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn for_stmt() {
|
fn for_stmt() {
|
||||||
test("for (let x = 0; x < 10; x++) {}", "for (let x = 0; x < 10; x++) {}\n");
|
test("for (let x = 0; x < 10; x++) {}", "for (let x = 0; x < 10; x++) {}\n");
|
||||||
|
|
|
||||||
|
|
@ -275,7 +275,7 @@ Unexpected token
|
||||||
(29:11-29:15) " y =" --> (25:10-25:12) " y"
|
(29:11-29:15) " y =" --> (25:10-25:12) " y"
|
||||||
(29:15-29:26) " function()" --> (25:12-25:23) "=function()"
|
(29:15-29:26) " function()" --> (25:12-25:23) "=function()"
|
||||||
(29:26-29:28) " {" --> (25:23-25:24) " "
|
(29:26-29:28) " {" --> (25:23-25:24) " "
|
||||||
(29:28-30:1) "}\n" --> (25:24-26:0) "{};;"
|
(29:28-30:1) "}\n" --> (25:24-26:0) "{};"
|
||||||
(30:1-32:0) "}\n" --> (26:0-27:0) "\n}"
|
(30:1-32:0) "}\n" --> (26:0-27:0) "\n}"
|
||||||
(32:0-32:4) "\nvar" --> (27:0-27:4) "\nvar"
|
(32:0-32:4) "\nvar" --> (27:0-27:4) "\nvar"
|
||||||
(32:4-32:9) " aa =" --> (27:4-27:9) " aa ="
|
(32:4-32:9) " aa =" --> (27:4-27:9) " aa ="
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue