mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
feat(codegen): print missing fields for AccessorProperty (#5291)
Found in https://github.com/oxc-project/monitor-oxc/actions/runs/10592050362/job/29350666018
This commit is contained in:
parent
5754c89b5e
commit
292d162b23
3 changed files with 13 additions and 5 deletions
|
|
@ -2567,6 +2567,7 @@ impl<'a> Gen for PropertyDefinition<'a> {
|
|||
impl<'a> Gen for AccessorProperty<'a> {
|
||||
fn gen(&self, p: &mut Codegen, ctx: Context) {
|
||||
p.add_source_mapping(self.span.start);
|
||||
self.decorators.gen(p, ctx);
|
||||
if self.r#type.is_abstract() {
|
||||
p.print_str("abstract ");
|
||||
}
|
||||
|
|
@ -2587,8 +2588,15 @@ impl<'a> Gen for AccessorProperty<'a> {
|
|||
if self.computed {
|
||||
p.print_char(b']');
|
||||
}
|
||||
if let Some(type_annotation) = &self.type_annotation {
|
||||
p.print_colon();
|
||||
p.print_soft_space();
|
||||
type_annotation.gen(p, ctx);
|
||||
}
|
||||
if let Some(value) = &self.value {
|
||||
p.print_soft_space();
|
||||
p.print_equal();
|
||||
p.print_soft_space();
|
||||
value.gen_expr(p, Precedence::Comma, Context::empty());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ fn expr() {
|
|||
fn access_property() {
|
||||
test(
|
||||
"export default class Foo { @x @y accessor #aDef = 1 }",
|
||||
"export default class Foo {\n\taccessor #aDef=1;\n}\n",
|
||||
"export default class Foo {\n\t@x @y accessor #aDef = 1;\n}\n",
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -264,10 +264,10 @@ Unexpected token
|
|||
(28:18-28:20) " {" --> (25:17-25:18) " "
|
||||
(28:20-29:2) "};\n " --> (25:18-26:1) "{};\n"
|
||||
(29:2-29:11) " accessor" --> (26:1-26:10) "\taccessor"
|
||||
(29:11-29:15) " y =" --> (26:10-26:12) " y"
|
||||
(29:15-29:26) " function()" --> (26:12-26:23) "=function()"
|
||||
(29:26-29:28) " {" --> (26:23-26:24) " "
|
||||
(29:28-30:1) "}\n" --> (26:24-27:0) "{};"
|
||||
(29:11-29:15) " y =" --> (26:10-26:14) " y ="
|
||||
(29:15-29:26) " function()" --> (26:14-26:25) " function()"
|
||||
(29:26-29:28) " {" --> (26:25-26:26) " "
|
||||
(29:28-30:1) "}\n" --> (26:26-27:0) "{};"
|
||||
(30:1-32:0) "}\n" --> (27:0-28:0) "\n}"
|
||||
(32:0-32:4) "\nvar" --> (28:0-28:4) "\nvar"
|
||||
(32:4-32:9) " aa =" --> (28:4-28:9) " aa ="
|
||||
|
|
|
|||
Loading…
Reference in a new issue