diff --git a/Cargo.lock b/Cargo.lock index a438fe1a8..cc8ea3ced 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -700,9 +700,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +checksum = "8b4baf93f58d4425749ca49a51c50ebab072c5df6994d08fed93541c331481dc" dependencies = [ "either", ] @@ -1032,9 +1032,9 @@ dependencies = [ [[package]] name = "oxc_allocator" -version = "0.137.0" +version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b34ec71e68e73a0ed7d929e58ab2bb4f58752dea944c08f14ccc3b8272c77946" +checksum = "e8c54f9bbf7e174b39691080396390a9c6bea6d0dce206660567c1b88951f7b6" dependencies = [ "allocator-api2", "hashbrown 0.17.0", @@ -1108,9 +1108,9 @@ dependencies = [ [[package]] name = "oxc_ast" -version = "0.137.0" +version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa406c62bb247767a6a051be6ac3be7db6c4f818129ccae570da6ee9eb96ead0" +checksum = "22bf885a47f8e0562ae73e0487ec8f83358bbbca8aad99a8293a9919d6d9e7fe" dependencies = [ "bitflags", "oxc_allocator", @@ -1126,11 +1126,11 @@ dependencies = [ [[package]] name = "oxc_ast_macros" -version = "0.137.0" +version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3706e193b659865e03155a44e443f0447abf6789f9a3eb436ae10e557afab899" +checksum = "81dcc7cd7607a42e3fed0d789535789ac6c16284f941a8aeed251265f29d1e52" dependencies = [ - "phf 0.13.1", + "phf 0.14.0", "proc-macro2", "quote", "syn 2.0.117", @@ -1138,9 +1138,9 @@ dependencies = [ [[package]] name = "oxc_ast_visit" -version = "0.137.0" +version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5353724c6c835bfd37ed59db65ccd506b7721598bcbe4750eda165754d105463" +checksum = "5f22557685c3d7e0a7e2fb3038072774a54bb4ac29f934719f628c364d808c15" dependencies = [ "oxc_allocator", "oxc_ast", @@ -1150,9 +1150,9 @@ dependencies = [ [[package]] name = "oxc_codegen" -version = "0.137.0" +version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d57d63987a27e8e67bc40518a4133b96ad2c0475f4735b8110e577a25680a09e" +checksum = "8b9feb869721e14ab8484c697372c468a3df3cb96ca8c02bfe34981fc8d614e9" dependencies = [ "bitflags", "cow-utils", @@ -1172,9 +1172,9 @@ dependencies = [ [[package]] name = "oxc_compat" -version = "0.137.0" +version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a25f516a7f4c05f66da375d07b29a87fe0e6037c79374f409153cb9496f3e0" +checksum = "ad6fd43a0b19ee2f8c190c4ff4918b1f22e2af605cd3a032eea9099ba5ec6f3f" dependencies = [ "cow-utils", "oxc-browserslist", @@ -1185,18 +1185,18 @@ dependencies = [ [[package]] name = "oxc_data_structures" -version = "0.137.0" +version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fde9ca13ef89018fb4c18502cefb9668baac6066905d27a914c29fb5fae1c8ac" +checksum = "30c920b812d5c7cd2c6b914dbeda4a7e6720e1de7869119b6de833ae39bedac9" dependencies = [ "ropey", ] [[package]] name = "oxc_diagnostics" -version = "0.137.0" +version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cbafa6cc3c38d72e35cd9337a38a4558e9fee4521fa5cabe321b90519e80aa" +checksum = "9b2d82feef8bf6118f57dffdc2cd9c22426b438b3f3298bc398bdf596297aeaa" dependencies = [ "cow-utils", "oxc-miette", @@ -1205,9 +1205,9 @@ dependencies = [ [[package]] name = "oxc_ecmascript" -version = "0.137.0" +version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55408e4f458ec4b9cd842f67364e9395b28bdf2201c7755ed04d6707c1084ea" +checksum = "1a5382979eb00843975f7dc33b567d9821f818b26f78d3e31ccf94af3cf78a8c" dependencies = [ "cow-utils", "num-bigint", @@ -1221,9 +1221,9 @@ dependencies = [ [[package]] name = "oxc_estree" -version = "0.137.0" +version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6c062d52b9ff15d118b87679bdd0a05c43599c1d55fd1cab280da1cc822858" +checksum = "9891b86dad0ad62c3ff1585aa0601af7b49bb3d19c7115e3115e2fba3d13d6d2" dependencies = [ "dragonbox_ecma", "itoa", @@ -1242,9 +1242,9 @@ dependencies = [ [[package]] name = "oxc_napi" -version = "0.137.0" +version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "111e475303979ad571c13ec6b9aa515f65cff0631107b935f8bec0cfef5e9a40" +checksum = "5d4af8fd024ea7258f46063df867cc32e10d019fdf70ac5ef55576de9e372a58" dependencies = [ "napi", "napi-build", @@ -1258,9 +1258,9 @@ dependencies = [ [[package]] name = "oxc_parser" -version = "0.137.0" +version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6efc796fc0c65a2a6bd40984b65b1052b5550b017af303f02b08794e304c14c8" +checksum = "dd79d7f27f20413eaeecada4d850aeb0220e70c821d4863d9fb0df115eae62a9" dependencies = [ "bitflags", "cow-utils", @@ -1282,9 +1282,9 @@ dependencies = [ [[package]] name = "oxc_regular_expression" -version = "0.137.0" +version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e533f1345534dceaee6c2c7102e5f3d2e7466269199eca9abeb871e02a7496a4" +checksum = "95bee883f864fb7c75d92ccae3b7db98afc4dce5d0b8b5165e681d93cb010399" dependencies = [ "bitflags", "oxc_allocator", @@ -1292,7 +1292,7 @@ dependencies = [ "oxc_diagnostics", "oxc_span", "oxc_str", - "phf 0.13.1", + "phf 0.14.0", "rustc-hash", "unicode-id-start", ] @@ -1327,11 +1327,11 @@ dependencies = [ [[package]] name = "oxc_semantic" -version = "0.137.0" +version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de31d2015099e33ecdc23ad59730b768a141a0b2941d43970a26ba50de003e10" +checksum = "7074088f38672fbafd4aa79f516835661ff539175858323f287775e2d9c89449" dependencies = [ - "itertools 0.14.0", + "itertools 0.15.0", "memchr", "oxc_allocator", "oxc_ast", @@ -1363,9 +1363,9 @@ dependencies = [ [[package]] name = "oxc_span" -version = "0.137.0" +version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5245fa99a7c9405d57e2d9666afc9fd01ac644e37aff1cb3e1cedd50c17915" +checksum = "8faf48e243cdacc96018515701bea560664a4cdef545c1fc50be139c0637db13" dependencies = [ "compact_str", "oxc-miette", @@ -1378,9 +1378,9 @@ dependencies = [ [[package]] name = "oxc_str" -version = "0.137.0" +version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53c61444d5681ce805fbbb5dc0498d980685a4c6a82dd57c2e17ff948041c1fb" +checksum = "7beac249fbb9815b974f1b1c2d22cb59be0c2a4a2ad42f1ee948e2600f4ff04c" dependencies = [ "compact_str", "hashbrown 0.17.0", @@ -1391,9 +1391,9 @@ dependencies = [ [[package]] name = "oxc_syntax" -version = "0.137.0" +version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "296b94ecc1235a2b5ea2a47412d4bc573b7a25a93132a1a2f49c617d85b58995" +checksum = "6dbe873bf4a3e494a56ec34f2710cb44309a071fd2c8360b893a12347d584c34" dependencies = [ "bitflags", "cow-utils", @@ -1405,16 +1405,16 @@ dependencies = [ "oxc_index", "oxc_span", "oxc_str", - "phf 0.13.1", + "phf 0.14.0", "serde", "unicode-id-start", ] [[package]] name = "oxc_transformer" -version = "0.137.0" +version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "494dcdb3e8c8dcb50e2ce3ba238030c9116a8b47b54f55c0f0211d68ae66b183" +checksum = "87a71b406724d9e1b3bdf8c700207524268a232af7e13302aeea53f98168e05d" dependencies = [ "base64", "compact_str", @@ -1442,9 +1442,9 @@ dependencies = [ [[package]] name = "oxc_traverse" -version = "0.137.0" +version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da52a3734ef3ad4c10ebb6f4e768f63ea1597677d53785e3ceb26d9735f5c1f8" +checksum = "c380b884f59c1f974f7ab966d758c31f3a765278d0348e6ec012c07fefd9da07" dependencies = [ "itoa", "oxc_allocator", @@ -1532,12 +1532,12 @@ dependencies = [ [[package]] name = "phf" -version = "0.13.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" +checksum = "010378780309880b08997fae13be7834dba947d36393bd372f2b1556deb2a2f6" dependencies = [ - "phf_macros 0.13.1", - "phf_shared 0.13.1", + "phf_macros 0.14.0", + "phf_shared 0.14.0", "serde", ] @@ -1563,12 +1563,12 @@ dependencies = [ [[package]] name = "phf_generator" -version = "0.13.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" +checksum = "aeb62e0959d5a1bebc965f4d15d9e2b7cea002b6b0f5ba8cde6cc26738467100" dependencies = [ "fastrand", - "phf_shared 0.13.1", + "phf_shared 0.14.0", ] [[package]] @@ -1586,12 +1586,12 @@ dependencies = [ [[package]] name = "phf_macros" -version = "0.13.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef" +checksum = "5fa8d0ca26d424d27630da600c6624696e7dec8bf7b3b492b383c5dc49e5e085" dependencies = [ - "phf_generator 0.13.1", - "phf_shared 0.13.1", + "phf_generator 0.14.0", + "phf_shared 0.14.0", "proc-macro2", "quote", "syn 2.0.117", @@ -1608,9 +1608,9 @@ dependencies = [ [[package]] name = "phf_shared" -version = "0.13.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" +checksum = "c6fd9027e2d9319be6349febd1db4e8d02aa544921200c9b777720ac34a3aa89" dependencies = [ "siphasher", ] diff --git a/Cargo.toml b/Cargo.toml index 1ab944f33..072b62058 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -87,19 +87,19 @@ multiple_crate_versions = "allow" [workspace.dependencies] # External oxc crates from crates.io -oxc_allocator = "0.137" -oxc_ast = "0.137" -oxc_ast_visit = "0.137" -oxc_diagnostics = "0.137" -oxc_napi = "0.137" -oxc_parser = "0.137" -oxc_semantic = "0.137" -oxc_span = "0.137" -oxc_syntax = "0.137" +oxc_allocator = "0.138" +oxc_ast = "0.138" +oxc_ast_visit = "0.138" +oxc_diagnostics = "0.138" +oxc_napi = "0.138" +oxc_parser = "0.138" +oxc_semantic = "0.138" +oxc_span = "0.138" +oxc_syntax = "0.138" oxc_sourcemap = "8.0.0" -oxc_str = "0.137" -oxc_transformer = "0.137" -oxc_codegen = "0.137" +oxc_str = "0.138" +oxc_transformer = "0.138" +oxc_codegen = "0.138" # Internal oxc_angular_compiler = { path = "crates/oxc_angular_compiler" } diff --git a/crates/oxc_angular_compiler/src/ast/expression.rs b/crates/oxc_angular_compiler/src/ast/expression.rs index 84163a521..a667ef34c 100644 --- a/crates/oxc_angular_compiler/src/ast/expression.rs +++ b/crates/oxc_angular_compiler/src/ast/expression.rs @@ -193,24 +193,24 @@ impl<'a> AngularExpression<'a> { match self { Self::Empty(e) => Self::Empty(Box::new_in( EmptyExpr { span: e.span, source_span: e.source_span }, - alloc, + &alloc, )), Self::ImplicitReceiver(e) => Self::ImplicitReceiver(Box::new_in( ImplicitReceiver { span: e.span, source_span: e.source_span }, - alloc, + &alloc, )), Self::ThisReceiver(e) => Self::ThisReceiver(Box::new_in( ThisReceiver { span: e.span, source_span: e.source_span }, - alloc, + &alloc, )), Self::Chain(e) => { - let mut expressions = Vec::new_in(alloc); + let mut expressions = Vec::new_in(&alloc); for expr in e.expressions.iter() { expressions.push(expr.clone_in(alloc)); } Self::Chain(Box::new_in( Chain { span: e.span, source_span: e.source_span, expressions }, - alloc, + &alloc, )) } Self::Conditional(e) => Self::Conditional(Box::new_in( @@ -221,7 +221,7 @@ impl<'a> AngularExpression<'a> { true_exp: e.true_exp.clone_in(alloc), false_exp: e.false_exp.clone_in(alloc), }, - alloc, + &alloc, )), Self::PropertyRead(e) => Self::PropertyRead(Box::new_in( PropertyRead { @@ -231,7 +231,7 @@ impl<'a> AngularExpression<'a> { receiver: e.receiver.clone_in(alloc), name: e.name.clone(), }, - alloc, + &alloc, )), Self::SafePropertyRead(e) => Self::SafePropertyRead(Box::new_in( SafePropertyRead { @@ -241,7 +241,7 @@ impl<'a> AngularExpression<'a> { receiver: e.receiver.clone_in(alloc), name: e.name.clone(), }, - alloc, + &alloc, )), Self::KeyedRead(e) => Self::KeyedRead(Box::new_in( KeyedRead { @@ -250,7 +250,7 @@ impl<'a> AngularExpression<'a> { receiver: e.receiver.clone_in(alloc), key: e.key.clone_in(alloc), }, - alloc, + &alloc, )), Self::SafeKeyedRead(e) => Self::SafeKeyedRead(Box::new_in( SafeKeyedRead { @@ -259,10 +259,10 @@ impl<'a> AngularExpression<'a> { receiver: e.receiver.clone_in(alloc), key: e.key.clone_in(alloc), }, - alloc, + &alloc, )), Self::BindingPipe(e) => { - let mut args = Vec::new_in(alloc); + let mut args = Vec::new_in(&alloc); for arg in e.args.iter() { args.push(arg.clone_in(alloc)); } @@ -276,7 +276,7 @@ impl<'a> AngularExpression<'a> { args, pipe_type: e.pipe_type, }, - alloc, + &alloc, )) } Self::LiteralPrimitive(e) => Self::LiteralPrimitive(Box::new_in( @@ -285,20 +285,20 @@ impl<'a> AngularExpression<'a> { source_span: e.source_span, value: e.value.clone(), }, - alloc, + &alloc, )), Self::LiteralArray(e) => { - let mut expressions = Vec::new_in(alloc); + let mut expressions = Vec::new_in(&alloc); for expr in e.expressions.iter() { expressions.push(expr.clone_in(alloc)); } Self::LiteralArray(Box::new_in( LiteralArray { span: e.span, source_span: e.source_span, expressions }, - alloc, + &alloc, )) } Self::LiteralMap(e) => { - let mut keys = Vec::new_in(alloc); + let mut keys = Vec::new_in(&alloc); for key in e.keys.iter() { keys.push(match key { LiteralMapKey::Property(prop) => { @@ -316,21 +316,21 @@ impl<'a> AngularExpression<'a> { } }); } - let mut values = Vec::new_in(alloc); + let mut values = Vec::new_in(&alloc); for val in e.values.iter() { values.push(val.clone_in(alloc)); } Self::LiteralMap(Box::new_in( LiteralMap { span: e.span, source_span: e.source_span, keys, values }, - alloc, + &alloc, )) } Self::Interpolation(e) => { - let mut strings = Vec::new_in(alloc); + let mut strings = Vec::new_in(&alloc); for s in e.strings.iter() { strings.push(s.clone()); } - let mut expressions = Vec::new_in(alloc); + let mut expressions = Vec::new_in(&alloc); for expr in e.expressions.iter() { expressions.push(expr.clone_in(alloc)); } @@ -341,7 +341,7 @@ impl<'a> AngularExpression<'a> { strings, expressions, }, - alloc, + &alloc, )) } Self::Binary(e) => Self::Binary(Box::new_in( @@ -352,7 +352,7 @@ impl<'a> AngularExpression<'a> { left: e.left.clone_in(alloc), right: e.right.clone_in(alloc), }, - alloc, + &alloc, )), Self::Unary(e) => Self::Unary(Box::new_in( Unary { @@ -361,7 +361,7 @@ impl<'a> AngularExpression<'a> { operator: e.operator.clone(), expr: e.expr.clone_in(alloc), }, - alloc, + &alloc, )), Self::PrefixNot(e) => Self::PrefixNot(Box::new_in( PrefixNot { @@ -369,7 +369,7 @@ impl<'a> AngularExpression<'a> { source_span: e.source_span, expression: e.expression.clone_in(alloc), }, - alloc, + &alloc, )), Self::TypeofExpression(e) => Self::TypeofExpression(Box::new_in( TypeofExpression { @@ -377,7 +377,7 @@ impl<'a> AngularExpression<'a> { source_span: e.source_span, expression: e.expression.clone_in(alloc), }, - alloc, + &alloc, )), Self::VoidExpression(e) => Self::VoidExpression(Box::new_in( VoidExpression { @@ -385,7 +385,7 @@ impl<'a> AngularExpression<'a> { source_span: e.source_span, expression: e.expression.clone_in(alloc), }, - alloc, + &alloc, )), Self::NonNullAssert(e) => Self::NonNullAssert(Box::new_in( NonNullAssert { @@ -393,10 +393,10 @@ impl<'a> AngularExpression<'a> { source_span: e.source_span, expression: e.expression.clone_in(alloc), }, - alloc, + &alloc, )), Self::Call(e) => { - let mut args = Vec::new_in(alloc); + let mut args = Vec::new_in(&alloc); for arg in e.args.iter() { args.push(arg.clone_in(alloc)); } @@ -408,11 +408,11 @@ impl<'a> AngularExpression<'a> { args, argument_span: e.argument_span, }, - alloc, + &alloc, )) } Self::SafeCall(e) => { - let mut args = Vec::new_in(alloc); + let mut args = Vec::new_in(&alloc); for arg in e.args.iter() { args.push(arg.clone_in(alloc)); } @@ -424,11 +424,11 @@ impl<'a> AngularExpression<'a> { args, argument_span: e.argument_span, }, - alloc, + &alloc, )) } Self::TaggedTemplateLiteral(e) => { - let mut elements = Vec::new_in(alloc); + let mut elements = Vec::new_in(&alloc); for el in e.template.elements.iter() { elements.push(TemplateLiteralElement { span: el.span, @@ -436,7 +436,7 @@ impl<'a> AngularExpression<'a> { text: el.text.clone(), }); } - let mut expressions = Vec::new_in(alloc); + let mut expressions = Vec::new_in(&alloc); for expr in e.template.expressions.iter() { expressions.push(expr.clone_in(alloc)); } @@ -452,11 +452,11 @@ impl<'a> AngularExpression<'a> { expressions, }, }, - alloc, + &alloc, )) } Self::TemplateLiteral(e) => { - let mut elements = Vec::new_in(alloc); + let mut elements = Vec::new_in(&alloc); for el in e.elements.iter() { elements.push(TemplateLiteralElement { span: el.span, @@ -464,7 +464,7 @@ impl<'a> AngularExpression<'a> { text: el.text.clone(), }); } - let mut expressions = Vec::new_in(alloc); + let mut expressions = Vec::new_in(&alloc); for expr in e.expressions.iter() { expressions.push(expr.clone_in(alloc)); } @@ -475,7 +475,7 @@ impl<'a> AngularExpression<'a> { elements, expressions, }, - alloc, + &alloc, )) } Self::ParenthesizedExpression(e) => Self::ParenthesizedExpression(Box::new_in( @@ -484,7 +484,7 @@ impl<'a> AngularExpression<'a> { source_span: e.source_span, expression: e.expression.clone_in(alloc), }, - alloc, + &alloc, )), Self::RegularExpressionLiteral(e) => Self::RegularExpressionLiteral(Box::new_in( RegularExpressionLiteral { @@ -493,7 +493,7 @@ impl<'a> AngularExpression<'a> { body: e.body.clone(), flags: e.flags.clone(), }, - alloc, + &alloc, )), Self::SpreadElement(e) => Self::SpreadElement(Box::new_in( SpreadElement { @@ -501,10 +501,10 @@ impl<'a> AngularExpression<'a> { source_span: e.source_span, expression: e.expression.clone_in(alloc), }, - alloc, + &alloc, )), Self::ArrowFunction(e) => { - let mut parameters = Vec::new_in(alloc); + let mut parameters = Vec::new_in(&alloc); for param in e.parameters.iter() { parameters.push(ArrowFunctionParameter { name: param.name.clone(), @@ -519,7 +519,7 @@ impl<'a> AngularExpression<'a> { parameters, body: e.body.clone_in(alloc), }, - alloc, + &alloc, )) } } diff --git a/crates/oxc_angular_compiler/src/ast/html.rs b/crates/oxc_angular_compiler/src/ast/html.rs index 0f0ac7881..4e9291ef8 100644 --- a/crates/oxc_angular_compiler/src/ast/html.rs +++ b/crates/oxc_angular_compiler/src/ast/html.rs @@ -510,9 +510,9 @@ mod tests { name: Ident::from("span"), component_prefix: None, component_tag_name: None, - attrs: Vec::new_in(&allocator), - directives: Vec::new_in(&allocator), - children: Vec::new_in(&allocator), + attrs: Vec::new_in(&&allocator), + directives: Vec::new_in(&&allocator), + children: Vec::new_in(&&allocator), span: Span::default(), start_span: Span::default(), end_span: None, @@ -524,9 +524,9 @@ mod tests { name: Ident::from("p"), component_prefix: None, component_tag_name: None, - attrs: Vec::new_in(&allocator), - directives: Vec::new_in(&allocator), - children: Vec::new_in(&allocator), + attrs: Vec::new_in(&&allocator), + directives: Vec::new_in(&&allocator), + children: Vec::new_in(&&allocator), span: Span::default(), start_span: Span::default(), end_span: None, @@ -534,16 +534,16 @@ mod tests { is_void: false, }; - let mut children = Vec::new_in(&allocator); - children.push(HtmlNode::Element(Box::new_in(child1, &allocator))); - children.push(HtmlNode::Element(Box::new_in(child2, &allocator))); + let mut children = Vec::new_in(&&allocator); + children.push(HtmlNode::Element(Box::new_in(child1, &&allocator))); + children.push(HtmlNode::Element(Box::new_in(child2, &&allocator))); let root = HtmlElement { name: Ident::from("div"), component_prefix: None, component_tag_name: None, - attrs: Vec::new_in(&allocator), - directives: Vec::new_in(&allocator), + attrs: Vec::new_in(&&allocator), + directives: Vec::new_in(&&allocator), children, span: Span::default(), start_span: Span::default(), @@ -552,8 +552,8 @@ mod tests { is_void: false, }; - let mut nodes = Vec::new_in(&allocator); - nodes.push(HtmlNode::Element(Box::new_in(root, &allocator))); + let mut nodes = Vec::new_in(&&allocator); + nodes.push(HtmlNode::Element(Box::new_in(root, &&allocator))); let mut counter = ElementCounter { count: 0 }; visit_all(&mut counter, &nodes); @@ -569,11 +569,11 @@ mod tests { value: Ident::from("Hello"), span: Span::default(), full_start: None, - tokens: Vec::new_in(&allocator), + tokens: Vec::new_in(&&allocator), }; - let mut nodes = Vec::new_in(&allocator); - nodes.push(HtmlNode::Text(Box::new_in(text, &allocator))); + let mut nodes = Vec::new_in(&&allocator); + nodes.push(HtmlNode::Text(Box::new_in(text, &&allocator))); let mut visited = 0; traverse_all(&nodes, |_node| { diff --git a/crates/oxc_angular_compiler/src/ast/r3.rs b/crates/oxc_angular_compiler/src/ast/r3.rs index c78ac9593..5b887557e 100644 --- a/crates/oxc_angular_compiler/src/ast/r3.rs +++ b/crates/oxc_angular_compiler/src/ast/r3.rs @@ -197,11 +197,11 @@ impl<'a> I18nMessage<'a> { /// Note: This preserves the `instance_id` so that cloned messages maintain /// their identity for i18n context sharing. pub fn clone_in(&self, allocator: &'a Allocator) -> Self { - let mut nodes = Vec::new_in(allocator); + let mut nodes = Vec::new_in(&allocator); for node in self.nodes.iter() { nodes.push(node.clone_in(allocator)); } - let mut legacy_ids = Vec::new_in(allocator); + let mut legacy_ids = Vec::new_in(&allocator); for id in self.legacy_ids.iter() { legacy_ids.push(id.clone()); } @@ -243,7 +243,7 @@ impl<'a> I18nText<'a> { impl<'a> I18nContainer<'a> { /// Creates a deep clone of this i18n container using the provided allocator. pub fn clone_in(&self, allocator: &'a Allocator) -> Self { - let mut children = Vec::new_in(allocator); + let mut children = Vec::new_in(&allocator); for child in self.children.iter() { children.push(child.clone_in(allocator)); } @@ -254,7 +254,7 @@ impl<'a> I18nContainer<'a> { impl<'a> I18nIcu<'a> { /// Creates a deep clone of this ICU expression using the provided allocator. pub fn clone_in(&self, allocator: &'a Allocator) -> Self { - let mut cases = HashMap::new_in(allocator); + let mut cases = HashMap::new_in(&allocator); for (key, value) in self.cases.iter() { cases.insert(key.clone(), value.clone_in(allocator)); } @@ -271,11 +271,11 @@ impl<'a> I18nIcu<'a> { impl<'a> I18nTagPlaceholder<'a> { /// Creates a deep clone of this tag placeholder using the provided allocator. pub fn clone_in(&self, allocator: &'a Allocator) -> Self { - let mut attrs = HashMap::new_in(allocator); + let mut attrs = HashMap::new_in(&allocator); for (key, value) in self.attrs.iter() { attrs.insert(key.clone(), value.clone()); } - let mut children = Vec::new_in(allocator); + let mut children = Vec::new_in(&allocator); for child in self.children.iter() { children.push(child.clone_in(allocator)); } @@ -308,7 +308,7 @@ impl<'a> I18nIcuPlaceholder<'a> { /// Creates a deep clone of this ICU placeholder using the provided allocator. pub fn clone_in(&self, allocator: &'a Allocator) -> Self { I18nIcuPlaceholder { - value: Box::new_in(self.value.clone_in(allocator), allocator), + value: Box::new_in(self.value.clone_in(allocator), &allocator), name: self.name.clone(), source_span: self.source_span, } @@ -318,11 +318,11 @@ impl<'a> I18nIcuPlaceholder<'a> { impl<'a> I18nBlockPlaceholder<'a> { /// Creates a deep clone of this block placeholder using the provided allocator. pub fn clone_in(&self, allocator: &'a Allocator) -> Self { - let mut parameters = Vec::new_in(allocator); + let mut parameters = Vec::new_in(&allocator); for param in self.parameters.iter() { parameters.push(param.clone()); } - let mut children = Vec::new_in(allocator); + let mut children = Vec::new_in(&allocator); for child in self.children.iter() { children.push(child.clone_in(allocator)); } diff --git a/crates/oxc_angular_compiler/src/class_debug_info/compiler.rs b/crates/oxc_angular_compiler/src/class_debug_info/compiler.rs index 667f92c80..0aefa3660 100644 --- a/crates/oxc_angular_compiler/src/class_debug_info/compiler.rs +++ b/crates/oxc_angular_compiler/src/class_debug_info/compiler.rs @@ -50,7 +50,7 @@ fn internal_compile_class_debug_info<'a>( // Build the debug info object // Always include className - let mut entries = Vec::new_in(allocator); + let mut entries = Vec::new_in(&allocator); // className entries.push(LiteralMapEntry::new( @@ -87,22 +87,22 @@ fn internal_compile_class_debug_info<'a>( let debug_info_object = OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )); - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(debug_info.r#type.clone_in(allocator)); args.push(debug_info_object); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(import, allocator), + fn_expr: Box::new_in(import, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -115,49 +115,49 @@ fn dev_only_guarded_expression<'a>( ) -> OutputExpression<'a> { let guard_var = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("ngDevMode"), source_span: None }, - allocator, + &allocator, )); // typeof ngDevMode let typeof_guard = OutputExpression::Typeof(Box::new_in( TypeofExpr { - expr: Box::new_in(guard_var.clone_in(allocator), allocator), + expr: Box::new_in(guard_var.clone_in(allocator), &allocator), source_span: None, }, - allocator, + &allocator, )); // typeof ngDevMode === "undefined" let guard_not_defined = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Identical, - lhs: Box::new_in(typeof_guard, allocator), - rhs: Box::new_in(literal_string(allocator, "undefined"), allocator), + lhs: Box::new_in(typeof_guard, &allocator), + rhs: Box::new_in(literal_string(allocator, "undefined"), &allocator), source_span: None, }, - allocator, + &allocator, )); // typeof ngDevMode === "undefined" || ngDevMode let guard_undefined_or_true = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Or, - lhs: Box::new_in(guard_not_defined, allocator), - rhs: Box::new_in(guard_var, allocator), + lhs: Box::new_in(guard_not_defined, &allocator), + rhs: Box::new_in(guard_var, &allocator), source_span: None, }, - allocator, + &allocator, )); // (typeof ngDevMode === "undefined" || ngDevMode) && expr OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::And, - lhs: Box::new_in(guard_undefined_or_true, allocator), - rhs: Box::new_in(expr, allocator), + lhs: Box::new_in(guard_undefined_or_true, &allocator), + rhs: Box::new_in(expr, &allocator), source_span: None, }, - allocator, + &allocator, )) } @@ -168,15 +168,15 @@ fn import_expr<'a>(allocator: &'a Allocator, identifier: &'static str) -> Output receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(identifier), optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -184,7 +184,7 @@ fn import_expr<'a>(allocator: &'a Allocator, identifier: &'static str) -> Output fn literal_string<'a>(allocator: &'a Allocator, value: &'static str) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(Ident::from(value)), source_span: None }, - allocator, + &allocator, )) } @@ -192,7 +192,7 @@ fn literal_string<'a>(allocator: &'a Allocator, value: &'static str) -> OutputEx fn literal_string_atom<'a>(allocator: &'a Allocator, value: Ident<'a>) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(value), source_span: None }, - allocator, + &allocator, )) } @@ -200,7 +200,7 @@ fn literal_string_atom<'a>(allocator: &'a Allocator, value: Ident<'a>) -> Output fn literal_number<'a>(allocator: &'a Allocator, value: u32) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(f64::from(value)), source_span: None }, - allocator, + &allocator, )) } @@ -208,7 +208,7 @@ fn literal_number<'a>(allocator: &'a Allocator, value: u32) -> OutputExpression< fn literal_bool<'a>(allocator: &'a Allocator, value: bool) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(value), source_span: None }, - allocator, + &allocator, )) } @@ -216,7 +216,7 @@ fn literal_bool<'a>(allocator: &'a Allocator, value: bool) -> OutputExpression<' fn expr_stmt<'a>(allocator: &'a Allocator, expr: OutputExpression<'a>) -> OutputStatement<'a> { OutputStatement::Expression(Box::new_in( ExpressionStatement { expr, source_span: None }, - allocator, + &allocator, )) } @@ -225,8 +225,8 @@ fn create_arrow_iife<'a>( allocator: &'a Allocator, stmt: OutputStatement<'a>, ) -> OutputExpression<'a> { - let empty_params = Vec::new_in(allocator); - let mut stmts = Vec::new_in(allocator); + let empty_params = Vec::new_in(&allocator); + let mut stmts = Vec::new_in(&allocator); stmts.push(stmt); let arrow = OutputExpression::ArrowFunction(Box::new_in( @@ -235,19 +235,19 @@ fn create_arrow_iife<'a>( body: ArrowFunctionBody::Statements(stmts), source_span: None, }, - allocator, + &allocator, )); // Call the arrow function: arrow() - let empty_args = Vec::new_in(allocator); + let empty_args = Vec::new_in(&allocator); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(arrow, allocator), + fn_expr: Box::new_in(arrow, &allocator), args: empty_args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } diff --git a/crates/oxc_angular_compiler/src/class_metadata/builders.rs b/crates/oxc_angular_compiler/src/class_metadata/builders.rs index 11b0aea31..d0096b91d 100644 --- a/crates/oxc_angular_compiler/src/class_metadata/builders.rs +++ b/crates/oxc_angular_compiler/src/class_metadata/builders.rs @@ -44,29 +44,29 @@ pub fn build_decorator_metadata_array<'a>( inlined_styles: Option<&[Ident<'a>]>, consts: Option<&StringConsts<'a>>, ) -> OutputExpression<'a> { - let mut decorator_entries = AllocVec::new_in(allocator); + let mut decorator_entries = AllocVec::new_in(&allocator); for (decorator_idx, decorator) in decorators.iter().enumerate() { - let mut map_entries = AllocVec::new_in(allocator); + let mut map_entries = AllocVec::new_in(&allocator); // Get decorator type name let type_expr = match &decorator.expression { Expression::CallExpression(call) => match &call.callee { Expression::Identifier(id) => Some(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: id.name.into(), source_span: None }, - allocator, + &allocator, ))), Expression::StaticMemberExpression(member) => { // Handle namespaced decorators like ng.Component convert_oxc_expression(allocator, &member.object, source_text).map(|receiver| { OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(receiver, allocator), + receiver: Box::new_in(receiver, &allocator), name: member.property.name.into(), optional: false, source_span: None, }, - allocator, + &allocator, )) }) } @@ -74,7 +74,7 @@ pub fn build_decorator_metadata_array<'a>( }, Expression::Identifier(id) => Some(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: id.name.into(), source_span: None }, - allocator, + &allocator, ))), _ => None, }; @@ -98,7 +98,7 @@ pub fn build_decorator_metadata_array<'a>( let is_component_decorator = get_decorator_name(decorator).is_some_and(|n| n == "Component"); - let mut args = AllocVec::new_in(allocator); + let mut args = AllocVec::new_in(&allocator); for (arg_idx, arg) in call.arguments.iter().enumerate() { let expr = arg.to_expression(); if let Some(mut converted) = convert_oxc_expression(allocator, expr, source_text) { @@ -107,7 +107,7 @@ pub fn build_decorator_metadata_array<'a>( // are left alone. if is_component_decorator && decorator_idx == 0 && arg_idx == 0 { inline_component_resources( - allocator, + &allocator, &mut converted, inlined_template, inlined_styles, @@ -118,7 +118,7 @@ pub fn build_decorator_metadata_array<'a>( // template literal would leak verbatim into `setClassMetadata`. if let Some(consts) = consts { drop_unresolvable_template_literal_fields( - allocator, + &allocator, &mut converted, expr, consts, @@ -134,7 +134,7 @@ pub fn build_decorator_metadata_array<'a>( Ident::from("args"), OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: args, source_span: None }, - allocator, + &allocator, )), false, )); @@ -144,13 +144,13 @@ pub fn build_decorator_metadata_array<'a>( // Create the decorator object: { type: ..., args: [...] } decorator_entries.push(OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries: map_entries, source_span: None }, - allocator, + &allocator, ))); } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: decorator_entries, source_span: None }, - allocator, + &allocator, )) } @@ -196,7 +196,7 @@ fn inline_component_resources<'a>( return; } - let original_entries = std::mem::replace(&mut map_box.entries, AllocVec::new_in(allocator)); + let original_entries = std::mem::replace(&mut map_box.entries, AllocVec::new_in(&allocator)); // First pass: drop the deleted keys; if both `templateUrl` and `template` // existed in source, overwrite the existing `template` in place (Map.set @@ -231,7 +231,7 @@ fn inline_component_resources<'a>( // `styles`/`styleUrl(s)`, mirroring Angular's unconditional `metadata.delete` // for all three keys before `metadata.set('styles', …)`). if let Some(styles) = inlined_styles { - let mut style_entries = AllocVec::new_in(allocator); + let mut style_entries = AllocVec::new_in(&allocator); for style in styles { // Match Angular's `style.trim().length > 0` filter. if style.as_str().trim().is_empty() { @@ -239,7 +239,7 @@ fn inline_component_resources<'a>( } style_entries.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(*style), source_span: None }, - allocator, + &allocator, ))); } if !style_entries.is_empty() { @@ -247,7 +247,7 @@ fn inline_component_resources<'a>( Ident::from("styles"), OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: style_entries, source_span: None }, - allocator, + &allocator, )), false, )); @@ -302,7 +302,7 @@ fn build_template_entry<'a>(allocator: &'a Allocator, content: &'a str) -> Liter Ident::from("template"), OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(Ident::from(content)), source_span: None }, - allocator, + &allocator, )), false, ) @@ -335,15 +335,15 @@ pub fn build_ctor_params_metadata<'a>( None })?; - let mut param_entries = AllocVec::new_in(allocator); + let mut param_entries = AllocVec::new_in(&allocator); for (i, param) in constructor.iter().enumerate() { - let mut map_entries = AllocVec::new_in(allocator); + let mut map_entries = AllocVec::new_in(&allocator); // Extract type from TypeScript type annotation, using namespace-prefixed // references for imported types when constructor dependency info is available. let type_expr = build_param_type_expression( - allocator, + &allocator, param, constructor_deps.and_then(|deps| deps.get(i)), namespace_registry, @@ -352,7 +352,7 @@ pub fn build_ctor_params_metadata<'a>( .unwrap_or_else(|| { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Undefined, source_span: None }, - allocator, + &allocator, )) }); @@ -362,7 +362,7 @@ pub fn build_ctor_params_metadata<'a>( let param_decorators = extract_angular_decorators_from_param(param); if !param_decorators.is_empty() { let decorators_array = build_decorator_metadata_array( - allocator, + &allocator, ¶m_decorators, source_text, None, @@ -378,7 +378,7 @@ pub fn build_ctor_params_metadata<'a>( param_entries.push(OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries: map_entries, source_span: None }, - allocator, + &allocator, ))); } @@ -390,16 +390,16 @@ pub fn build_ctor_params_metadata<'a>( // Wrap in arrow function: () => [...] let array_expr = OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: param_entries, source_span: None }, - allocator, + &allocator, )); Some(OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { - params: AllocVec::new_in(allocator), - body: ArrowFunctionBody::Expression(Box::new_in(array_expr, allocator)), + params: AllocVec::new_in(&allocator), + body: ArrowFunctionBody::Expression(Box::new_in(array_expr, &allocator)), source_span: None, }, - allocator, + &allocator, ))) } @@ -424,7 +424,7 @@ pub fn build_prop_decorators_metadata<'a>( "ContentChildren", ]; - let mut prop_entries = AllocVec::new_in(allocator); + let mut prop_entries = AllocVec::new_in(&allocator); for element in &class.body.body { let (decorators, property_name, value) = match element { @@ -456,7 +456,7 @@ pub fn build_prop_decorators_metadata<'a>( if !angular_decorators.is_empty() { // Build decorators array from the real decorators present in source. let decorators_array = build_decorator_metadata_array( - allocator, + &allocator, &angular_decorators, source_text, None, @@ -475,7 +475,7 @@ pub fn build_prop_decorators_metadata<'a>( // builds); without it, `setInput`/router-binding fail with NG0315/NG0303/NG0950. if let Some(value) = value && let Some(decorators_array) = build_initializer_api_prop_decorators( - allocator, + &allocator, value, &prop_name, source_text, @@ -492,7 +492,7 @@ pub fn build_prop_decorators_metadata<'a>( Some(OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries: prop_entries, source_span: None }, - allocator, + &allocator, ))) } @@ -506,7 +506,7 @@ fn build_initializer_api_prop_decorators<'a>( source_text: Option<&'a str>, namespace_registry: &mut NamespaceRegistry<'a>, ) -> Option> { - let mut decorators = AllocVec::new_in(allocator); + let mut decorators = AllocVec::new_in(&allocator); if let Some(input) = try_parse_signal_input(allocator, value, property_name.clone()) { // input() / input.required() → `Input({ isSignal, alias, required })` @@ -515,7 +515,7 @@ fn build_initializer_api_prop_decorators<'a>( // model() → `Input({ isSignal, alias, required })` + `Output("Change")` decorators.push(build_signal_input_decorator(allocator, namespace_registry, &model.input)); decorators.push(build_core_decorator_with_string_arg( - allocator, + &allocator, namespace_registry, "Output", model.output.1.clone(), @@ -523,7 +523,7 @@ fn build_initializer_api_prop_decorators<'a>( } else if let Some((_, binding)) = try_parse_signal_output(value, property_name.clone()) { // output() / outputFromObservable() → `Output("")` decorators.push(build_core_decorator_with_string_arg( - allocator, + &allocator, namespace_registry, "Output", binding, @@ -540,7 +540,7 @@ fn build_initializer_api_prop_decorators<'a>( Some(OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: decorators, source_span: None }, - allocator, + &allocator, ))) } @@ -555,7 +555,7 @@ fn build_signal_input_decorator<'a>( namespace_registry: &mut NamespaceRegistry<'a>, input: &R3InputMetadata<'a>, ) -> OutputExpression<'a> { - let mut config = AllocVec::new_in(allocator); + let mut config = AllocVec::new_in(&allocator); config.push(LiteralMapEntry::new( Ident::from("isSignal"), bool_literal(allocator, true), @@ -572,10 +572,10 @@ fn build_signal_input_decorator<'a>( false, )); - let mut args = AllocVec::new_in(allocator); + let mut args = AllocVec::new_in(&allocator); args.push(OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries: config, source_span: None }, - allocator, + &allocator, ))); build_core_decorator(allocator, namespace_registry, "Input", args) } @@ -600,13 +600,13 @@ fn build_signal_query_decorator<'a>( // decorator. let predicate = convert_oxc_expression(allocator, call.arguments.first()?.to_expression(), source_text)?; - let mut args = AllocVec::new_in(allocator); + let mut args = AllocVec::new_in(&allocator); args.push(predicate); // Options: `{ ..., isSignal: true }`. Spread the second positional // argument verbatim (matching Angular's `factory.createSpreadAssignment(callArgs[1])`), // which preserves any options expression, object literal or not. - let mut options = AllocVec::new_in(allocator); + let mut options = AllocVec::new_in(&allocator); if let Some(second) = call.arguments.get(1) && let Some(source_options) = convert_oxc_expression(allocator, second.to_expression(), source_text) @@ -620,7 +620,7 @@ fn build_signal_query_decorator<'a>( )); args.push(OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries: options, source_span: None }, - allocator, + &allocator, ))); Some(build_core_decorator(allocator, namespace_registry, decorator_name, args)) @@ -667,7 +667,7 @@ fn build_core_decorator_with_string_arg<'a>( decorator_name: &'static str, arg: Ident<'a>, ) -> OutputExpression<'a> { - let mut args = AllocVec::new_in(allocator); + let mut args = AllocVec::new_in(&allocator); args.push(string_literal(allocator, arg)); build_core_decorator(allocator, namespace_registry, decorator_name, args) } @@ -688,25 +688,25 @@ fn build_core_decorator<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: core_namespace, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(decorator_name), optional: false, source_span: None, }, - allocator, + &allocator, )); - let mut entries = AllocVec::new_in(allocator); + let mut entries = AllocVec::new_in(&allocator); entries.push(LiteralMapEntry::new(Ident::from("type"), type_expr, false)); if !args.is_empty() { entries.push(LiteralMapEntry::new( Ident::from("args"), OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: args, source_span: None }, - allocator, + &allocator, )), false, )); @@ -714,7 +714,7 @@ fn build_core_decorator<'a>( OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )) } @@ -722,7 +722,7 @@ fn build_core_decorator<'a>( fn bool_literal<'a>(allocator: &'a Allocator, value: bool) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(value), source_span: None }, - allocator, + &allocator, )) } @@ -730,7 +730,7 @@ fn bool_literal<'a>(allocator: &'a Allocator, value: bool) -> OutputExpression<' fn string_literal<'a>(allocator: &'a Allocator, value: Ident<'a>) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(value), source_span: None }, - allocator, + &allocator, )) } @@ -782,15 +782,15 @@ fn build_param_type_expression<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: namespace, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name, optional: false, source_span: None, }, - allocator, + &allocator, ))); } } @@ -815,15 +815,15 @@ fn build_param_type_expression<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: namespace, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: tn.clone(), optional: false, source_span: None, }, - allocator, + &allocator, ))); } } @@ -869,14 +869,17 @@ fn extract_param_type_expression<'a>( TSType::TSTypeReference(type_ref) => { // Handle simple type references like SomeService match &type_ref.type_name { - TSTypeName::IdentifierReference(id) => Some(OutputExpression::ReadVar( - Box::new_in(ReadVarExpr { name: id.name.into(), source_span: None }, allocator), - )), + TSTypeName::IdentifierReference(id) => { + Some(OutputExpression::ReadVar(Box::new_in( + ReadVarExpr { name: id.name.into(), source_span: None }, + &allocator, + ))) + } TSTypeName::QualifiedName(qualified) => { // Handle qualified names like ns.SomeType Some(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: qualified.right.name.into(), source_span: None }, - allocator, + &allocator, ))) } TSTypeName::ThisExpression(_) => { diff --git a/crates/oxc_angular_compiler/src/class_metadata/compiler.rs b/crates/oxc_angular_compiler/src/class_metadata/compiler.rs index ab5de8029..193a88f7b 100644 --- a/crates/oxc_angular_compiler/src/class_metadata/compiler.rs +++ b/crates/oxc_angular_compiler/src/class_metadata/compiler.rs @@ -58,7 +58,7 @@ pub fn compile_component_class_metadata<'a>( } Some(deps) => { // Has deferred dependencies - use setClassMetadataAsync - let mut params = Vec::new_in(allocator); + let mut params = Vec::new_in(&allocator); for dep in deps { params.push(FnParam { name: dep.param_name.clone() }); } @@ -79,7 +79,7 @@ pub fn compile_opaque_async_class_metadata<'a>( defer_resolver: OutputExpression<'a>, deferred_dependency_names: &[Ident<'a>], ) -> OutputExpression<'a> { - let mut params = Vec::new_in(allocator); + let mut params = Vec::new_in(&allocator); for name in deferred_dependency_names { params.push(FnParam { name: name.clone() }); } @@ -101,11 +101,11 @@ pub fn compile_component_metadata_async_resolver<'a>( allocator: &'a Allocator, dependencies: &[R3DeferPerComponentDependency<'a>], ) -> OutputExpression<'a> { - let mut dynamic_imports = Vec::new_in(allocator); + let mut dynamic_imports = Vec::new_in(&allocator); for dep in dependencies { // Create: (m) => m.CmpA (or m.default for default imports) - let mut inner_params = Vec::new_in(allocator); + let mut inner_params = Vec::new_in(&allocator); inner_params.push(FnParam { name: Ident::from("m") }); let prop_name = @@ -116,24 +116,24 @@ pub fn compile_component_metadata_async_resolver<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("m"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: prop_name, optional: false, source_span: None, }, - allocator, + &allocator, )); let inner_fn = OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { params: inner_params, - body: ArrowFunctionBody::Expression(Box::new_in(inner_body, allocator)), + body: ArrowFunctionBody::Expression(Box::new_in(inner_body, &allocator)), source_span: None, }, - allocator, + &allocator, )); // Create: import('./cmp-a').then((m) => m.CmpA) @@ -143,31 +143,31 @@ pub fn compile_component_metadata_async_resolver<'a>( url_comment: None, source_span: None, }, - allocator, + &allocator, )); let then_prop = OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(dynamic_import, allocator), + receiver: Box::new_in(dynamic_import, &allocator), name: Ident::from("then"), optional: false, source_span: None, }, - allocator, + &allocator, )); - let mut then_args = Vec::new_in(allocator); + let mut then_args = Vec::new_in(&allocator); then_args.push(inner_fn); let then_call = OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(then_prop, allocator), + fn_expr: Box::new_in(then_prop, &allocator), args: then_args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )); dynamic_imports.push(then_call); @@ -176,17 +176,17 @@ pub fn compile_component_metadata_async_resolver<'a>( // Create: () => [...] let array = OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: dynamic_imports, source_span: None }, - allocator, + &allocator, )); - let empty_params = Vec::new_in(allocator); + let empty_params = Vec::new_in(&allocator); OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { params: empty_params, - body: ArrowFunctionBody::Expression(Box::new_in(array, allocator)), + body: ArrowFunctionBody::Expression(Box::new_in(array, &allocator)), source_span: None, }, - allocator, + &allocator, )) } @@ -201,7 +201,7 @@ fn internal_compile_class_metadata<'a>( ) -> OutputExpression<'a> { let import = import_expr(allocator, Identifiers::SET_CLASS_METADATA); - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(metadata.r#type.clone_in(allocator)); args.push(metadata.decorators.clone_in(allocator)); args.push( @@ -221,13 +221,13 @@ fn internal_compile_class_metadata<'a>( OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(import, allocator), + fn_expr: Box::new_in(import, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -242,7 +242,7 @@ fn internal_compile_set_class_metadata_async<'a>( let set_class_metadata_call = internal_compile_class_metadata(allocator, metadata); // Create wrapper: (deps...) => { setClassMetadata(...); } - let mut wrapper_stmts = Vec::new_in(allocator); + let mut wrapper_stmts = Vec::new_in(&allocator); wrapper_stmts.push(expr_stmt(allocator, set_class_metadata_call)); let set_class_meta_wrapper = OutputExpression::ArrowFunction(Box::new_in( @@ -251,26 +251,26 @@ fn internal_compile_set_class_metadata_async<'a>( body: ArrowFunctionBody::Statements(wrapper_stmts), source_span: None, }, - allocator, + &allocator, )); // Create: setClassMetadataAsync(type, resolver, wrapper) let import = import_expr(allocator, Identifiers::SET_CLASS_METADATA_ASYNC); - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(metadata.r#type.clone_in(allocator)); args.push(dependency_resolver_fn); args.push(set_class_meta_wrapper); let set_class_meta_async = OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(import, allocator), + fn_expr: Box::new_in(import, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )); // Wrap in dev-only guard and IIFE @@ -297,49 +297,49 @@ fn guarded_expression<'a>( ) -> OutputExpression<'a> { let guard_var = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(guard), source_span: None }, - allocator, + &allocator, )); // typeof guard let typeof_guard = OutputExpression::Typeof(Box::new_in( TypeofExpr { - expr: Box::new_in(guard_var.clone_in(allocator), allocator), + expr: Box::new_in(guard_var.clone_in(allocator), &allocator), source_span: None, }, - allocator, + &allocator, )); // typeof guard === "undefined" let guard_not_defined = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Identical, - lhs: Box::new_in(typeof_guard, allocator), - rhs: Box::new_in(literal_string(allocator, "undefined"), allocator), + lhs: Box::new_in(typeof_guard, &allocator), + rhs: Box::new_in(literal_string(allocator, "undefined"), &allocator), source_span: None, }, - allocator, + &allocator, )); // typeof guard === "undefined" || guard let guard_undefined_or_true = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Or, - lhs: Box::new_in(guard_not_defined, allocator), - rhs: Box::new_in(guard_var, allocator), + lhs: Box::new_in(guard_not_defined, &allocator), + rhs: Box::new_in(guard_var, &allocator), source_span: None, }, - allocator, + &allocator, )); // (typeof guard === "undefined" || guard) && expr OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::And, - lhs: Box::new_in(guard_undefined_or_true, allocator), - rhs: Box::new_in(expr, allocator), + lhs: Box::new_in(guard_undefined_or_true, &allocator), + rhs: Box::new_in(expr, &allocator), source_span: None, }, - allocator, + &allocator, )) } @@ -350,15 +350,15 @@ fn import_expr<'a>(allocator: &'a Allocator, identifier: &'static str) -> Output receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(identifier), optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -366,7 +366,7 @@ fn import_expr<'a>(allocator: &'a Allocator, identifier: &'static str) -> Output fn literal_null<'a>(allocator: &'a Allocator) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )) } @@ -374,7 +374,7 @@ fn literal_null<'a>(allocator: &'a Allocator) -> OutputExpression<'a> { fn literal_string<'a>(allocator: &'a Allocator, value: &'static str) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(Ident::from(value)), source_span: None }, - allocator, + &allocator, )) } @@ -382,7 +382,7 @@ fn literal_string<'a>(allocator: &'a Allocator, value: &'static str) -> OutputEx fn expr_stmt<'a>(allocator: &'a Allocator, expr: OutputExpression<'a>) -> OutputStatement<'a> { OutputStatement::Expression(Box::new_in( ExpressionStatement { expr, source_span: None }, - allocator, + &allocator, )) } @@ -391,8 +391,8 @@ fn create_arrow_iife<'a>( allocator: &'a Allocator, stmt: OutputStatement<'a>, ) -> OutputExpression<'a> { - let empty_params = Vec::new_in(allocator); - let mut stmts = Vec::new_in(allocator); + let empty_params = Vec::new_in(&allocator); + let mut stmts = Vec::new_in(&allocator); stmts.push(stmt); let arrow = OutputExpression::ArrowFunction(Box::new_in( @@ -401,19 +401,19 @@ fn create_arrow_iife<'a>( body: ArrowFunctionBody::Statements(stmts), source_span: None, }, - allocator, + &allocator, )); // Call the arrow function: arrow() - let empty_args = Vec::new_in(allocator); + let empty_args = Vec::new_in(&allocator); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(arrow, allocator), + fn_expr: Box::new_in(arrow, &allocator), args: empty_args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } diff --git a/crates/oxc_angular_compiler/src/component/decorator.rs b/crates/oxc_angular_compiler/src/component/decorator.rs index 0ac348a0a..05470c73d 100644 --- a/crates/oxc_angular_compiler/src/component/decorator.rs +++ b/crates/oxc_angular_compiler/src/component/decorator.rs @@ -315,7 +315,7 @@ fn populate_declarations_from_imports<'a>( // A more sophisticated implementation would analyze the template to determine // the actual dependency type (directive, component, pipe, or NgModule) let mut dep = TemplateDependency::directive( - allocator, + &allocator, import_name.clone(), // Use a placeholder selector - the actual selector isn't used for dependencies array Ident::from("*"), @@ -399,7 +399,7 @@ fn extract_string_array<'a>( return None; }; - let mut result = Vec::new_in(allocator); + let mut result = Vec::new_in(&allocator); for element in &arr.elements { // ArrayExpressionElement variants that can hold a value expression all // carry one — funnel them through `as_expression()` and let the shared @@ -418,7 +418,7 @@ fn extract_identifier_array<'a>( allocator: &'a Allocator, expr: &Expression<'a>, ) -> Vec<'a, Ident<'a>> { - let mut result = Vec::new_in(allocator); + let mut result = Vec::new_in(&allocator); let Expression::ArrayExpression(arr) = expr else { return result; @@ -501,9 +501,9 @@ fn extract_host_metadata<'a>( }; let mut host = HostMetadata { - properties: Vec::new_in(allocator), - attributes: Vec::new_in(allocator), - listeners: Vec::new_in(allocator), + properties: Vec::new_in(&allocator), + attributes: Vec::new_in(&allocator), + listeners: Vec::new_in(&allocator), class_attr: None, style_attr: None, }; @@ -564,7 +564,7 @@ fn extract_host_directives<'a>( import_map: &ImportMap<'a>, consts: &StringConsts<'a>, ) -> Vec<'a, HostDirectiveMetadata<'a>> { - let mut result = Vec::new_in(allocator); + let mut result = Vec::new_in(&allocator); let Expression::ArrayExpression(arr) = expr else { return result; @@ -606,8 +606,8 @@ fn extract_single_host_directive<'a>( // Object expression: { directive: ColorDirective, inputs: [...], outputs: [...] } ArrayExpressionElement::ObjectExpression(obj) => { let mut directive_name: Option> = None; - let mut inputs = Vec::new_in(allocator); - let mut outputs = Vec::new_in(allocator); + let mut inputs = Vec::new_in(&allocator); + let mut outputs = Vec::new_in(&allocator); let mut is_forward_reference = false; for prop in &obj.properties { @@ -745,7 +745,7 @@ fn extract_io_mappings<'a>( allocator: &'a Allocator, expr: &Expression<'a>, ) -> Vec<'a, (Ident<'a>, Ident<'a>)> { - let mut result = Vec::new_in(allocator); + let mut result = Vec::new_in(&allocator); let Expression::ArrayExpression(arr) = expr else { return result; @@ -901,7 +901,7 @@ fn extract_constructor_deps<'a>( match constructor { Some(ctor) => { // Constructor found - extract parameters (may be empty) - let mut deps = Vec::new_in(allocator); + let mut deps = Vec::new_in(&allocator); let params = &ctor.value.params; for param in ¶ms.items { @@ -916,7 +916,7 @@ fn extract_constructor_deps<'a>( // If class has a superclass, use inherited factory pattern (return None) // If class has no superclass, use simple factory with empty deps (return Some([])) // See: packages/compiler-cli/src/ngtsc/annotations/common/src/di.ts:47-52 - if has_superclass { None } else { Some(Vec::new_in(allocator)) } + if has_superclass { None } else { Some(Vec::new_in(&allocator)) } } } } diff --git a/crates/oxc_angular_compiler/src/component/defer_resolver.rs b/crates/oxc_angular_compiler/src/component/defer_resolver.rs index 7f10d3254..d78e2c8c2 100644 --- a/crates/oxc_angular_compiler/src/component/defer_resolver.rs +++ b/crates/oxc_angular_compiler/src/component/defer_resolver.rs @@ -101,7 +101,7 @@ pub(super) fn build_defer_per_component_deps<'a>( deferred_imports: &[Ident<'a>], import_map: &ImportMap<'a>, ) -> oxc_allocator::Vec<'a, R3DeferPerComponentDependency<'a>> { - let mut deps = oxc_allocator::Vec::new_in(allocator); + let mut deps = oxc_allocator::Vec::new_in(&allocator); for local_name in deferred_imports { let Some(info) = import_map.get(local_name) else { continue }; if !info.is_named_import || info.is_type_only { diff --git a/crates/oxc_angular_compiler/src/component/definition.rs b/crates/oxc_angular_compiler/src/component/definition.rs index 5defdf772..8ea598a32 100644 --- a/crates/oxc_angular_compiler/src/component/definition.rs +++ b/crates/oxc_angular_compiler/src/component/definition.rs @@ -80,7 +80,7 @@ pub fn generate_component_definitions<'a>( // This ensures namespace indices (i0, i1, i2, ...) are assigned in the same order. let fac_definition = generate_fac_definition(allocator, metadata, namespace_registry); let cmp_definition = generate_cmp_definition( - allocator, + &allocator, metadata, options, job, @@ -122,7 +122,7 @@ fn generate_cmp_definition<'a>( content_queries_fn: Option>, namespace_registry: &mut NamespaceRegistry<'a>, ) -> OutputExpression<'a> { - let mut entries: OxcVec<'a, LiteralMapEntry<'a>> = OxcVec::new_in(allocator); + let mut entries: OxcVec<'a, LiteralMapEntry<'a>> = OxcVec::new_in(&allocator); // ========================================================================= // Angular field ordering from baseDirectiveFields (compiler.ts lines 41-104) @@ -133,7 +133,7 @@ fn generate_cmp_definition<'a>( Ident::from("type"), OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: metadata.class_name.clone(), source_span: None }, - allocator, + &allocator, )), false, )); @@ -182,7 +182,7 @@ fn generate_cmp_definition<'a>( value: LiteralValue::Number(host_vars as f64), source_span: None, }, - allocator, + &allocator, )), false, )); @@ -192,7 +192,7 @@ fn generate_cmp_definition<'a>( if let Some(host_fn) = host_result.host_binding_fn { entries.push(LiteralMapEntry::new( Ident::from("hostBindings"), - OutputExpression::Function(Box::new_in(host_fn, allocator)), + OutputExpression::Function(Box::new_in(host_fn, &allocator)), false, )); } @@ -217,18 +217,18 @@ fn generate_cmp_definition<'a>( // 10. exportAs: [...] (if not null) // Per Angular compiler.ts lines 92-94 (baseDirectiveFields) if !metadata.export_as.is_empty() { - let mut export_items = OxcVec::new_in(allocator); + let mut export_items = OxcVec::new_in(&allocator); for name in &metadata.export_as { export_items.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); } entries.push(LiteralMapEntry::new( Ident::from("exportAs"), OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: export_items, source_span: None }, - allocator, + &allocator, )), false, )); @@ -241,7 +241,7 @@ fn generate_cmp_definition<'a>( Ident::from("standalone"), OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(false), source_span: None }, - allocator, + &allocator, )), false, )); @@ -254,7 +254,7 @@ fn generate_cmp_definition<'a>( Ident::from("signals"), OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(true), source_span: None }, - allocator, + &allocator, )), false, )); @@ -300,7 +300,7 @@ fn generate_cmp_definition<'a>( Ident::from("decls"), OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(decls as f64), source_span: None }, - allocator, + &allocator, )), false, )); @@ -312,7 +312,7 @@ fn generate_cmp_definition<'a>( Ident::from("vars"), OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(vars as f64), source_span: None }, - allocator, + &allocator, )), false, )); @@ -322,7 +322,7 @@ fn generate_cmp_definition<'a>( // - If there are const initializers (e.g., for i18n dual-mode), wrap in arrow function // - Otherwise, emit as plain literal array if !job.consts.is_empty() { - let mut const_entries: OxcVec<'a, OutputExpression<'a>> = OxcVec::new_in(allocator); + let mut const_entries: OxcVec<'a, OutputExpression<'a>> = OxcVec::new_in(&allocator); for const_value in &job.consts { const_entries.push(const_value_to_expression(allocator, const_value)); } @@ -331,7 +331,7 @@ fn generate_cmp_definition<'a>( // Wrap consts in an arrow function that runs initializers first // function() { ...initializers...; return [...consts...]; } let mut fn_stmts: OxcVec<'a, OutputStatement<'a>> = - OxcVec::with_capacity_in(job.consts_initializers.len() + 1, allocator); + OxcVec::with_capacity_in(job.consts_initializers.len() + 1, &allocator); // Add all initializer statements for stmt in job.consts_initializers.drain(..) { @@ -343,27 +343,27 @@ fn generate_cmp_definition<'a>( ReturnStatement { value: OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: const_entries, source_span: None }, - allocator, + &allocator, )), source_span: None, }, - allocator, + &allocator, ))); OutputExpression::Function(Box::new_in( FunctionExpr { name: None, - params: OxcVec::new_in(allocator), + params: OxcVec::new_in(&allocator), statements: fn_stmts, source_span: None, }, - allocator, + &allocator, )) } else { // Plain literal array OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: const_entries, source_span: None }, - allocator, + &allocator, )) }; @@ -374,7 +374,7 @@ fn generate_cmp_definition<'a>( // Per Angular compiler.ts line 270 entries.push(LiteralMapEntry::new( Ident::from("template"), - OutputExpression::Function(Box::new_in(template_fn, allocator)), + OutputExpression::Function(Box::new_in(template_fn, &allocator)), false, )); @@ -402,7 +402,7 @@ fn generate_cmp_definition<'a>( let host_attr = "_nghost-%COMP%"; if !metadata.styles.is_empty() { - let mut style_entries: OxcVec<'a, OutputExpression<'a>> = OxcVec::new_in(allocator); + let mut style_entries: OxcVec<'a, OutputExpression<'a>> = OxcVec::new_in(&allocator); for style in &metadata.styles { let style = crate::styles::finalize_component_style( style.as_str(), @@ -414,11 +414,11 @@ fn generate_cmp_definition<'a>( if style.trim().is_empty() { continue; } - let style_value = Ident::from_in(style.as_str(), allocator); + let style_value = Ident::from_in(style.as_str(), &allocator); style_entries.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(style_value), source_span: None }, - allocator, + &allocator, ))); } @@ -428,7 +428,7 @@ fn generate_cmp_definition<'a>( Ident::from("styles"), OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: style_entries, source_span: None }, - allocator, + &allocator, )), false, )); @@ -457,7 +457,7 @@ fn generate_cmp_definition<'a>( value: LiteralValue::Number(encapsulation_value as f64), source_span: None, }, - allocator, + &allocator, )), false, )); @@ -468,7 +468,7 @@ fn generate_cmp_definition<'a>( if let Some(ref animations) = metadata.animations { // Create the inner map: {animation: animationsExpr} let mut data_entries: OxcVec<'a, LiteralMapEntry<'a>> = - OxcVec::with_capacity_in(1, allocator); + OxcVec::with_capacity_in(1, &allocator); data_entries.push(LiteralMapEntry::new( Ident::from("animation"), animations.clone_in(allocator), @@ -479,7 +479,7 @@ fn generate_cmp_definition<'a>( Ident::from("data"), OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries: data_entries, source_span: None }, - allocator, + &allocator, )), false, )); @@ -510,7 +510,7 @@ fn generate_cmp_definition<'a>( Ident::from("changeDetection"), OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(value as f64), source_span: None }, - allocator, + &allocator, )), false, )); @@ -520,7 +520,7 @@ fn generate_cmp_definition<'a>( // Create the config object let config = OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )); // Wrap in ɵɵdefineComponent call @@ -594,14 +594,14 @@ fn generate_constructor_factory<'a>( ) -> OutputExpression<'a> { // Function name: ComponentClass_Factory let fn_name_string = format!("{}_Factory", metadata.class_name); - let fn_name = Ident::from_in(fn_name_string.as_str(), allocator); + let fn_name = Ident::from_in(fn_name_string.as_str(), &allocator); // Parameter: __ngFactoryType__ (type override for inheritance/testing) - let mut params: OxcVec<'a, FnParam<'a>> = OxcVec::new_in(allocator); + let mut params: OxcVec<'a, FnParam<'a>> = OxcVec::new_in(&allocator); params.push(FnParam { name: Ident::from("__ngFactoryType__") }); // Body: return new (__ngFactoryType__ || ComponentClass)(deps...); - let mut statements: OxcVec<'a, OutputStatement<'a>> = OxcVec::new_in(allocator); + let mut statements: OxcVec<'a, OutputStatement<'a>> = OxcVec::new_in(&allocator); // Create: (__ngFactoryType__ || ComponentClass) let or_expr = OutputExpression::BinaryOperator(Box::new_in( @@ -610,20 +610,20 @@ fn generate_constructor_factory<'a>( lhs: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("__ngFactoryType__"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), rhs: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: metadata.class_name.clone(), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), source_span: None, }, - allocator, + &allocator, )); // If any constructor parameter resolved to a type-only import, the whole @@ -636,12 +636,12 @@ fn generate_constructor_factory<'a>( expr: create_invalid_factory_call(allocator), source_span: None, }, - allocator, + &allocator, ))); return OutputExpression::Function(Box::new_in( FunctionExpr { name: Some(fn_name), params, statements, source_span: None }, - allocator, + &allocator, )); } @@ -649,7 +649,7 @@ fn generate_constructor_factory<'a>( // Uses FactoryTarget::Component for components // The namespace_registry is used to resolve imported dependency namespaces let constructor_args = if deps.is_empty() { - OxcVec::new_in(allocator) + OxcVec::new_in(&allocator) } else { compile_inject_dependencies(allocator, deps, FactoryTarget::Component, namespace_registry) }; @@ -657,22 +657,22 @@ fn generate_constructor_factory<'a>( // Create: new (__ngFactoryType__ || ComponentClass)(dep1, dep2, ...) let new_expr = OutputExpression::Instantiate(Box::new_in( InstantiateExpr { - class_expr: Box::new_in(or_expr, allocator), + class_expr: Box::new_in(or_expr, &allocator), args: constructor_args, source_span: None, }, - allocator, + &allocator, )); // return new (__ngFactoryType__ || ComponentClass)(deps...); statements.push(OutputStatement::Return(Box::new_in( ReturnStatement { value: new_expr, source_span: None }, - allocator, + &allocator, ))); OutputExpression::Function(Box::new_in( FunctionExpr { name: Some(fn_name), params, statements, source_span: None }, - allocator, + &allocator, )) } @@ -704,11 +704,11 @@ fn generate_inherited_factory<'a>( // Create base factory variable name: ɵComponentClass_BaseFactory let base_factory_var_name = - Ident::from_in(format!("ɵ{}_BaseFactory", metadata.class_name).as_str(), allocator); + Ident::from_in(format!("ɵ{}_BaseFactory", metadata.class_name).as_str(), &allocator); // Function name: ComponentClass_Factory let fn_name_string = format!("{}_Factory", metadata.class_name); - let fn_name = Ident::from_in(fn_name_string.as_str(), allocator); + let fn_name = Ident::from_in(fn_name_string.as_str(), &allocator); // Create ɵɵgetInheritedFactory(ComponentClass) call let get_inherited_factory_call = { @@ -717,32 +717,32 @@ fn generate_inherited_factory<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(Identifiers::GET_INHERITED_FACTORY), optional: false, source_span: None, }, - allocator, + &allocator, )); - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: metadata.class_name.clone(), source_span: None }, - allocator, + &allocator, ))); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(fn_expr, allocator), + fn_expr: Box::new_in(fn_expr, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) }; @@ -753,14 +753,14 @@ fn generate_inherited_factory<'a>( lhs: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: base_factory_var_name.clone(), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), - rhs: Box::new_in(get_inherited_factory_call, allocator), + rhs: Box::new_in(get_inherited_factory_call, &allocator), source_span: None, }, - allocator, + &allocator, )); // Create memoization pattern: baseFactoryVar || (baseFactoryVar = ɵɵgetInheritedFactory(...)) @@ -770,14 +770,14 @@ fn generate_inherited_factory<'a>( lhs: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: base_factory_var_name.clone(), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), - rhs: Box::new_in(assignment, allocator), + rhs: Box::new_in(assignment, &allocator), source_span: None, }, - allocator, + &allocator, )); // Create (__ngFactoryType__ || ComponentClass) @@ -787,46 +787,46 @@ fn generate_inherited_factory<'a>( lhs: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: factory_type_param.clone(), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), rhs: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: metadata.class_name.clone(), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), source_span: None, }, - allocator, + &allocator, )); // Create the factory call: (memoizedFactory)(__ngFactoryType__ || ComponentClass) - let mut factory_call_args = OxcVec::new_in(allocator); + let mut factory_call_args = OxcVec::new_in(&allocator); factory_call_args.push(type_for_ctor); let factory_call = OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(memoized_factory, allocator), + fn_expr: Box::new_in(memoized_factory, &allocator), args: factory_call_args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )); // Create return statement for inner function - let mut inner_body: OxcVec<'a, OutputStatement<'a>> = OxcVec::new_in(allocator); + let mut inner_body: OxcVec<'a, OutputStatement<'a>> = OxcVec::new_in(&allocator); inner_body.push(OutputStatement::Return(Box::new_in( ReturnStatement { value: factory_call, source_span: None }, - allocator, + &allocator, ))); // Create inner function: function ComponentClass_Factory(__ngFactoryType__) { ... } - let mut inner_params = OxcVec::new_in(allocator); + let mut inner_params = OxcVec::new_in(&allocator); inner_params.push(FnParam { name: factory_type_param }); let inner_fn = OutputExpression::Function(Box::new_in( @@ -836,11 +836,11 @@ fn generate_inherited_factory<'a>( statements: inner_body, source_span: None, }, - allocator, + &allocator, )); // Create IIFE body: let ɵComponentClass_BaseFactory; return function...; - let mut iife_body: OxcVec<'a, OutputStatement<'a>> = OxcVec::new_in(allocator); + let mut iife_body: OxcVec<'a, OutputStatement<'a>> = OxcVec::new_in(&allocator); // Declaration: let ɵComponentClass_BaseFactory; iife_body.push(OutputStatement::DeclareVar(Box::new_in( @@ -851,35 +851,35 @@ fn generate_inherited_factory<'a>( leading_comment: None, source_span: None, }, - allocator, + &allocator, ))); // Return the inner function iife_body.push(OutputStatement::Return(Box::new_in( ReturnStatement { value: inner_fn, source_span: None }, - allocator, + &allocator, ))); // Create arrow function IIFE: () => { let x; return function...; } let arrow_fn = OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { - params: OxcVec::new_in(allocator), + params: OxcVec::new_in(&allocator), body: ArrowFunctionBody::Statements(iife_body), source_span: None, }, - allocator, + &allocator, )); // Invoke the IIFE: (() => { ... })() OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(arrow_fn, allocator), - args: OxcVec::new_in(allocator), + fn_expr: Box::new_in(arrow_fn, &allocator), + args: OxcVec::new_in(&allocator), pure: true, // Mark as @__PURE__ for tree-shaking optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -894,30 +894,30 @@ fn create_define_component_call<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(Identifiers::DEFINE_COMPONENT), optional: false, source_span: None, }, - allocator, + &allocator, )); // Call: i0.ɵɵdefineComponent(config) - let mut args: OxcVec<'a, OutputExpression<'a>> = OxcVec::new_in(allocator); + let mut args: OxcVec<'a, OutputExpression<'a>> = OxcVec::new_in(&allocator); args.push(config); OutputExpression::InvokeFunction(Box::new_in( crate::output::ast::InvokeFunctionExpr { - fn_expr: Box::new_in(define_component, allocator), + fn_expr: Box::new_in(define_component, &allocator), args, pure: true, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -937,19 +937,19 @@ fn parse_selector_to_array<'a>( ) -> OutputExpression<'a> { let r3_selectors = parse_selector_to_r3_selector(selector.as_str()); - let mut outer_entries: OxcVec<'a, OutputExpression<'a>> = OxcVec::new_in(allocator); + let mut outer_entries: OxcVec<'a, OutputExpression<'a>> = OxcVec::new_in(&allocator); for r3_selector in &r3_selectors { let inner_entries = r3_selector_to_output_expr(allocator, r3_selector); outer_entries.push(OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: inner_entries, source_span: None }, - allocator, + &allocator, ))); } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: outer_entries, source_span: None }, - allocator, + &allocator, )) } @@ -976,7 +976,7 @@ fn generate_features_array<'a>( metadata: &ComponentMetadata<'a>, namespace_registry: &mut NamespaceRegistry<'a>, ) -> Option> { - let mut features: OxcVec<'a, OutputExpression<'a>> = OxcVec::new_in(allocator); + let mut features: OxcVec<'a, OutputExpression<'a>> = OxcVec::new_in(&allocator); // 1. ProvidersFeature - when providers or viewProviders are defined // Format: ɵɵProvidersFeature([providers], [viewProviders]?) @@ -1019,7 +1019,7 @@ fn generate_features_array<'a>( } else { Some(OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: features, source_span: None }, - allocator, + &allocator, ))) } } @@ -1036,14 +1036,14 @@ fn generate_providers_feature<'a>( // Build args: [providers, viewProviders?] let has_view_providers = metadata.view_providers.is_some(); let capacity = if has_view_providers { 2 } else { 1 }; - let mut args: OxcVec<'a, OutputExpression<'a>> = OxcVec::with_capacity_in(capacity, allocator); + let mut args: OxcVec<'a, OutputExpression<'a>> = OxcVec::with_capacity_in(capacity, &allocator); // First arg: providers expression (or empty array if no providers) let providers_expr = metadata.providers.as_ref().map_or_else( || { OutputExpression::LiteralArray(Box::new_in( - LiteralArrayExpr { entries: OxcVec::new_in(allocator), source_span: None }, - allocator, + LiteralArrayExpr { entries: OxcVec::new_in(&allocator), source_span: None }, + &allocator, )) }, |p| p.clone_in(allocator), @@ -1057,13 +1057,13 @@ fn generate_providers_feature<'a>( OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(fn_expr, allocator), + fn_expr: Box::new_in(fn_expr, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -1087,18 +1087,18 @@ fn generate_host_directives_feature<'a>( let host_directives_arg = create_host_directives_arg(allocator, &metadata.host_directives, namespace_registry); - let mut args: OxcVec<'a, OutputExpression<'a>> = OxcVec::with_capacity_in(1, allocator); + let mut args: OxcVec<'a, OutputExpression<'a>> = OxcVec::with_capacity_in(1, &allocator); args.push(host_directives_arg); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(fn_expr, allocator), + fn_expr: Box::new_in(fn_expr, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -1122,21 +1122,21 @@ fn create_directive_reference<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: namespace, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: directive.directive.clone(), optional: false, source_span: None, }, - allocator, + &allocator, )); } // No source module - use bare type name (local directive) OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: directive.directive.clone(), source_span: None }, - allocator, + &allocator, )) } @@ -1154,7 +1154,7 @@ fn create_host_directives_arg<'a>( namespace_registry: &mut NamespaceRegistry<'a>, ) -> OutputExpression<'a> { let mut expressions: OxcVec<'a, OutputExpression<'a>> = - OxcVec::with_capacity_in(host_directives.len(), allocator); + OxcVec::with_capacity_in(host_directives.len(), &allocator); let mut has_forward_ref = false; for directive in host_directives { @@ -1170,7 +1170,7 @@ fn create_host_directives_arg<'a>( expressions.push(directive_ref); } else { // Complex case: object with directive, inputs, outputs - let mut entries: OxcVec<'a, LiteralMapEntry<'a>> = OxcVec::new_in(allocator); + let mut entries: OxcVec<'a, LiteralMapEntry<'a>> = OxcVec::new_in(&allocator); // directive: DirectiveClass (or i1.DirectiveClass for imports) entries.push(LiteralMapEntry::new(Ident::from("directive"), directive_ref, false)); @@ -1191,33 +1191,33 @@ fn create_host_directives_arg<'a>( expressions.push(OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, ))); } } let array_expr = OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: expressions, source_span: None }, - allocator, + &allocator, )); // If there's a forward reference, wrap in: function() { return [directives] } if has_forward_ref { let mut statements: OxcVec<'a, OutputStatement<'a>> = - OxcVec::with_capacity_in(1, allocator); + OxcVec::with_capacity_in(1, &allocator); statements.push(OutputStatement::Return(Box::new_in( ReturnStatement { value: array_expr, source_span: None }, - allocator, + &allocator, ))); OutputExpression::Function(Box::new_in( FunctionExpr { name: None, - params: OxcVec::new_in(allocator), + params: OxcVec::new_in(&allocator), statements, source_span: None, }, - allocator, + &allocator, )) } else { array_expr @@ -1235,32 +1235,32 @@ fn generate_external_styles_feature<'a>( // Create array of external style paths let mut style_entries: OxcVec<'a, OutputExpression<'a>> = - OxcVec::with_capacity_in(metadata.external_styles.len(), allocator); + OxcVec::with_capacity_in(metadata.external_styles.len(), &allocator); for style_url in &metadata.external_styles { style_entries.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(style_url.clone()), source_span: None }, - allocator, + &allocator, ))); } let styles_array = OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: style_entries, source_span: None }, - allocator, + &allocator, )); - let mut args: OxcVec<'a, OutputExpression<'a>> = OxcVec::with_capacity_in(1, allocator); + let mut args: OxcVec<'a, OutputExpression<'a>> = OxcVec::with_capacity_in(1, &allocator); args.push(styles_array); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(fn_expr, allocator), + fn_expr: Box::new_in(fn_expr, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -1274,15 +1274,15 @@ fn create_angular_fn_ref<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(fn_name), optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -1338,12 +1338,12 @@ fn generate_runtime_resolved_dependencies<'a>( let fn_expr = create_angular_fn_ref(allocator, Identifiers::GET_COMPONENT_DEPS_FACTORY); let capacity = if metadata.raw_imports.is_some() { 2 } else { 1 }; - let mut args: OxcVec<'a, OutputExpression<'a>> = OxcVec::with_capacity_in(capacity, allocator); + let mut args: OxcVec<'a, OutputExpression<'a>> = OxcVec::with_capacity_in(capacity, &allocator); // First arg: Component type args.push(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: metadata.class_name.clone(), source_span: None }, - allocator, + &allocator, ))); // Second arg: raw imports expression (optional) @@ -1354,13 +1354,13 @@ fn generate_runtime_resolved_dependencies<'a>( OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(fn_expr, allocator), + fn_expr: Box::new_in(fn_expr, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -1374,7 +1374,7 @@ fn create_dependencies_array<'a>( namespace_registry: &mut NamespaceRegistry<'a>, ) -> OutputExpression<'a> { let mut entries: OxcVec<'a, OutputExpression<'a>> = - OxcVec::with_capacity_in(metadata.declarations.len(), allocator); + OxcVec::with_capacity_in(metadata.declarations.len(), &allocator); for dep in &metadata.declarations { let dep_expr = if let Some(ref source_module) = dep.source_module { @@ -1385,21 +1385,21 @@ fn create_dependencies_array<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: namespace, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: dep.type_name.clone(), optional: false, source_span: None, }, - allocator, + &allocator, )) } else { // Local dependency - use bare type name OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: dep.type_name.clone(), source_span: None }, - allocator, + &allocator, )) }; entries.push(dep_expr); @@ -1407,7 +1407,7 @@ fn create_dependencies_array<'a>( OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: None }, - allocator, + &allocator, )) } @@ -1438,18 +1438,18 @@ fn compile_declaration_list<'a>( fn_expr: Box::new_in( OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(list, allocator), + receiver: Box::new_in(list, &allocator), name: Ident::from("map"), optional: false, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), args: { let mut args: OxcVec<'a, OutputExpression<'a>> = - OxcVec::with_capacity_in(1, allocator); + OxcVec::with_capacity_in(1, &allocator); args.push(resolve_fn); args }, @@ -1457,7 +1457,7 @@ fn compile_declaration_list<'a>( optional: false, source_span: None, }, - allocator, + &allocator, )); wrap_in_arrow_function(allocator, map_call) @@ -1475,20 +1475,20 @@ fn wrap_in_arrow_function<'a>( allocator: &'a Allocator, expr: OutputExpression<'a>, ) -> OutputExpression<'a> { - let mut statements: OxcVec<'a, OutputStatement<'a>> = OxcVec::with_capacity_in(1, allocator); + let mut statements: OxcVec<'a, OutputStatement<'a>> = OxcVec::with_capacity_in(1, &allocator); statements.push(OutputStatement::Return(Box::new_in( ReturnStatement { value: expr, source_span: None }, - allocator, + &allocator, ))); OutputExpression::Function(Box::new_in( FunctionExpr { name: None, - params: OxcVec::new_in(allocator), + params: OxcVec::new_in(&allocator), statements, source_span: None, }, - allocator, + &allocator, )) } @@ -1506,28 +1506,28 @@ pub fn const_value_to_expression<'a>( match value { ConstValue::String(s) => OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(s.clone()), source_span: None }, - allocator, + &allocator, )), ConstValue::Number(n) => OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(*n), source_span: None }, - allocator, + &allocator, )), ConstValue::Boolean(b) => OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(*b), source_span: None }, - allocator, + &allocator, )), ConstValue::Null => OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), ConstValue::Array(arr) => { - let mut entries: OxcVec<'a, OutputExpression<'a>> = OxcVec::new_in(allocator); + let mut entries: OxcVec<'a, OutputExpression<'a>> = OxcVec::new_in(&allocator); for item in arr.iter() { entries.push(const_value_to_expression(allocator, item)); } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: None }, - allocator, + &allocator, )) } ConstValue::External(ext) => { @@ -1537,15 +1537,15 @@ pub fn const_value_to_expression<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: ext.name.clone(), optional: false, source_span: None, }, - allocator, + &allocator, )) } ConstValue::Expression(expr) => expr.clone_in(allocator), @@ -1674,16 +1674,16 @@ mod tests { names: &[&'a str], ) -> OutputExpression<'a> { let mut entries: OxcVec<'a, OutputExpression<'a>> = - OxcVec::with_capacity_in(names.len(), allocator); + OxcVec::with_capacity_in(names.len(), &allocator); for name in names { entries.push(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(*name), source_span: None }, - allocator, + &allocator, ))); } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: None }, - allocator, + &allocator, )) } @@ -2091,7 +2091,7 @@ mod tests { // Test with a variable reference as raw_imports metadata.raw_imports = Some(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("IMPORTS"), source_span: None }, - &allocator, + &&allocator, ))); let result = @@ -2117,22 +2117,23 @@ mod tests { metadata.declaration_list_emit_mode = DeclarationListEmitMode::RuntimeResolved; // Test with an array literal as raw_imports (like imports: [A, B, C]) - let mut entries: OxcVec<'_, OutputExpression<'_>> = OxcVec::with_capacity_in(3, &allocator); + let mut entries: OxcVec<'_, OutputExpression<'_>> = + OxcVec::with_capacity_in(3, &&allocator); entries.push(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("A"), source_span: None }, - &allocator, + &&allocator, ))); entries.push(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("B"), source_span: None }, - &allocator, + &&allocator, ))); entries.push(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("C"), source_span: None }, - &allocator, + &&allocator, ))); metadata.raw_imports = Some(OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: None }, - &allocator, + &&allocator, ))); let result = @@ -2274,7 +2275,7 @@ mod tests { // Create an animations expression (identifier reference) metadata.animations = Some(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("myAnimations"), source_span: None }, - &allocator, + &&allocator, ))); // We need a full compilation job to generate the definition diff --git a/crates/oxc_angular_compiler/src/component/dependency.rs b/crates/oxc_angular_compiler/src/component/dependency.rs index 963ff7c8a..a006f6a78 100644 --- a/crates/oxc_angular_compiler/src/component/dependency.rs +++ b/crates/oxc_angular_compiler/src/component/dependency.rs @@ -266,7 +266,7 @@ pub fn compile_inject_dependencies<'a>( target: FactoryTarget, namespace_registry: &mut NamespaceRegistry<'a>, ) -> OxcVec<'a, OutputExpression<'a>> { - let mut args = OxcVec::with_capacity_in(deps.len(), allocator); + let mut args = OxcVec::with_capacity_in(deps.len(), &allocator); for (index, dep) in deps.iter().enumerate() { args.push(compile_inject_dependency(allocator, dep, target, index, namespace_registry)); @@ -363,7 +363,7 @@ fn create_token_expression<'a>( // allows using `DIALOG_DATA` directly instead of `i1.DIALOG_DATA` return OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: token_name.clone(), source_span: None }, - allocator, + &allocator, )); } @@ -374,21 +374,21 @@ fn create_token_expression<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: namespace, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: token_name.clone(), optional: false, source_span: None, }, - allocator, + &allocator, )) } else { // Local dependency - use bare token name OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: token_name.clone(), source_span: None }, - allocator, + &allocator, )) } } @@ -400,21 +400,21 @@ fn create_invalid_factory_dep_call<'a>( ) -> OutputExpression<'a> { let fn_expr = create_angular_fn_ref(allocator, Identifiers::INVALID_FACTORY_DEP); - let mut args = OxcVec::with_capacity_in(1, allocator); + let mut args = OxcVec::with_capacity_in(1, &allocator); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(index as f64), source_span: None }, - allocator, + &allocator, ))); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(fn_expr, allocator), + fn_expr: Box::new_in(fn_expr, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -425,22 +425,22 @@ fn create_inject_attribute_call<'a>( ) -> OutputExpression<'a> { let fn_expr = create_angular_fn_ref(allocator, Identifiers::INJECT_ATTRIBUTE); - let mut args = OxcVec::with_capacity_in(1, allocator); + let mut args = OxcVec::with_capacity_in(1, &allocator); // Attribute name is passed as a string literal args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(attr_name), source_span: None }, - allocator, + &allocator, ))); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(fn_expr, allocator), + fn_expr: Box::new_in(fn_expr, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -457,7 +457,7 @@ fn create_inject_call_with_expr<'a>( let fn_expr = create_angular_fn_ref(allocator, fn_name); let capacity = if flags.is_some() { 2 } else { 1 }; - let mut args = OxcVec::with_capacity_in(capacity, allocator); + let mut args = OxcVec::with_capacity_in(capacity, &allocator); // Token expression (may be a variable reference or namespaced property access) args.push(token_expr); @@ -465,19 +465,19 @@ fn create_inject_call_with_expr<'a>( if let Some(flags_value) = flags { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(flags_value as f64), source_span: None }, - allocator, + &allocator, ))); } OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(fn_expr, allocator), + fn_expr: Box::new_in(fn_expr, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -491,15 +491,15 @@ fn create_angular_fn_ref<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(fn_name), optional: false, source_span: None, }, - allocator, + &allocator, )) } diff --git a/crates/oxc_angular_compiler/src/component/metadata.rs b/crates/oxc_angular_compiler/src/component/metadata.rs index c2a2ec272..6802a0ead 100644 --- a/crates/oxc_angular_compiler/src/component/metadata.rs +++ b/crates/oxc_angular_compiler/src/component/metadata.rs @@ -412,8 +412,8 @@ impl<'a> HostDirectiveMetadata<'a> { Self { directive, source_module: None, - inputs: Vec::new_in(allocator), - outputs: Vec::new_in(allocator), + inputs: Vec::new_in(&allocator), + outputs: Vec::new_in(&allocator), is_forward_reference: false, } } @@ -536,9 +536,9 @@ impl<'a> TemplateDependency<'a> { type_name, source_module: None, selector: Some(selector), - inputs: Vec::new_in(allocator), - outputs: Vec::new_in(allocator), - export_as: Vec::new_in(allocator), + inputs: Vec::new_in(&allocator), + outputs: Vec::new_in(&allocator), + export_as: Vec::new_in(&allocator), is_component, pipe_name: None, is_forward_reference: false, @@ -556,9 +556,9 @@ impl<'a> TemplateDependency<'a> { type_name, source_module: None, selector: None, - inputs: Vec::new_in(allocator), - outputs: Vec::new_in(allocator), - export_as: Vec::new_in(allocator), + inputs: Vec::new_in(&allocator), + outputs: Vec::new_in(&allocator), + export_as: Vec::new_in(&allocator), is_component: false, pipe_name: Some(pipe_name), is_forward_reference: false, @@ -605,9 +605,9 @@ impl<'a> HostMetadata<'a> { /// Create a new empty HostMetadata. pub fn new(allocator: &'a oxc_allocator::Allocator) -> Self { Self { - properties: Vec::new_in(allocator), - attributes: Vec::new_in(allocator), - listeners: Vec::new_in(allocator), + properties: Vec::new_in(&allocator), + attributes: Vec::new_in(&allocator), + listeners: Vec::new_in(&allocator), class_attr: None, style_attr: None, } @@ -634,32 +634,32 @@ impl<'a> ComponentMetadata<'a> { selector: None, template: None, template_url: None, - styles: Vec::new_in(allocator), - style_urls: Vec::new_in(allocator), + styles: Vec::new_in(&allocator), + style_urls: Vec::new_in(&allocator), standalone: implicit_standalone, encapsulation: ViewEncapsulation::default(), change_detection: None, host: None, - imports: Vec::new_in(allocator), - export_as: Vec::new_in(allocator), + imports: Vec::new_in(&allocator), + export_as: Vec::new_in(&allocator), preserve_whitespaces: false, constructor_deps: None, - inputs: Vec::new_in(allocator), - outputs: Vec::new_in(allocator), + inputs: Vec::new_in(&allocator), + outputs: Vec::new_in(&allocator), // Feature-related fields providers: None, view_providers: None, - host_directives: Vec::new_in(allocator), + host_directives: Vec::new_in(&allocator), uses_inheritance: false, lifecycle: LifecycleMetadata::default(), - external_styles: Vec::new_in(allocator), + external_styles: Vec::new_in(&allocator), // Template dependency fields - declarations: Vec::new_in(allocator), + declarations: Vec::new_in(&allocator), declaration_list_emit_mode: DeclarationListEmitMode::default(), raw_imports: None, - deferred_imports: Vec::new_in(allocator), + deferred_imports: Vec::new_in(&allocator), animations: None, - schemas: Vec::new_in(allocator), + schemas: Vec::new_in(&allocator), is_signal: false, } } diff --git a/crates/oxc_angular_compiler/src/component/namespace_registry.rs b/crates/oxc_angular_compiler/src/component/namespace_registry.rs index 0c6c18f32..b09d94ae0 100644 --- a/crates/oxc_angular_compiler/src/component/namespace_registry.rs +++ b/crates/oxc_angular_compiler/src/component/namespace_registry.rs @@ -38,7 +38,7 @@ impl<'a> NamespaceRegistry<'a> { } // Assign new alias - let alias = Ident::from_in(format!("i{}", self.next_index).as_str(), self.allocator); + let alias = Ident::from_in(format!("i{}", self.next_index).as_str(), &self.allocator); self.next_index += 1; self.modules.insert(module_path.clone(), alias.clone()); alias diff --git a/crates/oxc_angular_compiler/src/component/transform.rs b/crates/oxc_angular_compiler/src/component/transform.rs index b236048ec..ae02fd4fc 100644 --- a/crates/oxc_angular_compiler/src/component/transform.rs +++ b/crates/oxc_angular_compiler/src/component/transform.rs @@ -647,15 +647,15 @@ fn resolve_factory_dep_namespaces<'a>( receiver: oxc_allocator::Box::new_in( OutputExpression::ReadVar(oxc_allocator::Box::new_in( ReadVarExpr { name: namespace, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: name.clone(), optional: false, source_span: None, }, - allocator, + &allocator, ))); } } @@ -684,15 +684,15 @@ fn resolve_host_directive_namespaces<'a>( receiver: oxc_allocator::Box::new_in( OutputExpression::ReadVar(oxc_allocator::Box::new_in( ReadVarExpr { name: namespace, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: name.clone(), optional: false, source_span: None, }, - allocator, + &allocator, )); } } @@ -769,12 +769,12 @@ fn build_set_class_metadata_decls<'a>( let type_expr = OutputExpression::ReadVar(oxc_allocator::Box::new_in( ReadVarExpr { name: Ident::from(class_name), source_span: None }, - allocator, + &allocator, )); let class_metadata = R3ClassMetadata { r#type: type_expr, decorators: build_decorator_metadata_array( - allocator, + &allocator, &[decorator], Some(source), None, @@ -782,7 +782,7 @@ fn build_set_class_metadata_decls<'a>( Some(string_consts), ), ctor_parameters: build_ctor_params_metadata( - allocator, + &allocator, class, None, namespace_registry, @@ -790,7 +790,7 @@ fn build_set_class_metadata_decls<'a>( Some(source), ), prop_decorators: build_prop_decorators_metadata( - allocator, + &allocator, class, Some(source), namespace_registry, @@ -2102,7 +2102,7 @@ fn transform_angular_file_jit( // Check if this is the Angular decorator that needs special text transformation if dec.span == angular_decorator.span { let text = build_jit_decorator_text( - allocator, + &allocator, source, dec, decorator_kind, @@ -2556,7 +2556,7 @@ pub fn transform_angular_file( let implicit_standalone = options.implicit_standalone(); if let Some(mut metadata) = extract_component_metadata( - allocator, + &allocator, class, implicit_standalone, &import_map, @@ -2621,7 +2621,7 @@ pub fn transform_angular_file( // Pass the shared pool index to ensure unique constant names // Pass the file-level namespace registry to ensure consistent namespace assignments match compile_component_full( - allocator, + &allocator, template, &mut metadata, path, @@ -2678,7 +2678,7 @@ pub fn transform_angular_file( decorator_spans_to_remove.push(span); } if let Some(inj_def) = generate_injectable_definition_from_decorator( - allocator, + &allocator, injectable_metadata, options.compilation_mode, ) { @@ -2720,7 +2720,7 @@ pub fn transform_angular_file( name: Ident::from(class_name.as_str()), source_span: None, }, - allocator, + &allocator, ), ); @@ -2733,7 +2733,7 @@ pub fn transform_angular_file( let class_metadata = R3ClassMetadata { r#type: type_expr, decorators: build_decorator_metadata_array( - allocator, + &allocator, &[decorator], Some(source), Some(template), @@ -2741,7 +2741,7 @@ pub fn transform_angular_file( Some(&string_consts), ), ctor_parameters: build_ctor_params_metadata( - allocator, + &allocator, class, ctor_deps_slice, &mut file_namespace_registry, @@ -2749,7 +2749,7 @@ pub fn transform_angular_file( Some(source), ), prop_decorators: build_prop_decorators_metadata( - allocator, + &allocator, class, Some(source), &mut file_namespace_registry, @@ -2780,12 +2780,12 @@ pub fn transform_angular_file( R3DeferPerComponentDependency<'_>, > = if compilation_result.has_defer_block { super::defer_resolver::build_defer_per_component_deps( - allocator, + &allocator, &metadata.deferred_imports, &import_map, ) } else { - oxc_allocator::Vec::new_in(allocator) + oxc_allocator::Vec::new_in(&allocator) }; let metadata_expr = match options.compilation_mode { crate::CompilationMode::Partial => { @@ -2795,7 +2795,7 @@ pub fn transform_angular_file( // deps → sync ɵɵngDeclareClassMetadata; one // or more → async ɵɵngDeclareClassMetadataAsync. crate::partial::compile_component_declare_class_metadata( - allocator, + &allocator, &class_metadata, deferred_deps.as_slice(), ) @@ -2805,7 +2805,7 @@ pub fn transform_angular_file( compile_class_metadata(allocator, &class_metadata) } else { compile_component_class_metadata( - allocator, + &allocator, &class_metadata, Some(deferred_deps.as_slice()), ) @@ -2885,7 +2885,7 @@ pub fn transform_angular_file( // the directive and creating conflicting property definitions (like // ɵfac getters) that interfere with the AOT-compiled assignments. if let Some(mut directive_metadata) = extract_directive_metadata( - allocator, + &allocator, class, implicit_standalone, Some(source), @@ -2905,7 +2905,7 @@ pub fn transform_angular_file( // so factory deps must use namespace-prefixed references (e.g., i1.Store). if let Some(ref mut deps) = directive_metadata.deps { resolve_factory_dep_namespaces( - allocator, + &allocator, deps, &import_map, &mut file_namespace_registry, @@ -2917,7 +2917,7 @@ pub fn transform_angular_file( // must use namespace-prefixed references (e.g., i1.BrnTooltipTrigger) because the // original named import may be elided and replaced by a namespace import. resolve_host_directive_namespaces( - allocator, + &allocator, &mut directive_metadata.host_directives, &import_map, &mut file_namespace_registry, @@ -2926,7 +2926,7 @@ pub fn transform_angular_file( // Compile directive and generate definitions // Pass shared_pool_index to ensure unique constant names across the file let definitions = generate_directive_definitions( - allocator, + &allocator, &directive_metadata, shared_pool_index, options.compilation_mode, @@ -2956,7 +2956,7 @@ pub fn transform_angular_file( decorator_spans_to_remove.push(span); } if let Some(inj_def) = generate_injectable_definition_from_decorator( - allocator, + &allocator, injectable_metadata, options.compilation_mode, ) { @@ -2981,7 +2981,7 @@ pub fn transform_angular_file( let decls_after_class = find_directive_decorator(&class.decorators) .map(|decorator| { build_set_class_metadata_decls( - allocator, + &allocator, class, &class_name, decorator, @@ -3021,7 +3021,7 @@ pub fn transform_angular_file( // Resolve namespace imports for pipe constructor deps if let Some(ref mut deps) = pipe_metadata.deps { resolve_factory_dep_namespaces( - allocator, + &allocator, deps, &import_map, &mut file_namespace_registry, @@ -3030,7 +3030,7 @@ pub fn transform_angular_file( // Compile pipe and generate both ɵfac and ɵpipe definitions as external property assignments if let Some(definition) = generate_full_pipe_definition_from_decorator( - allocator, + &allocator, &pipe_metadata, options.compilation_mode, ) { @@ -3054,7 +3054,7 @@ pub fn transform_angular_file( decorator_spans_to_remove.push(span); } if let Some(inj_def) = generate_injectable_definition_from_decorator( - allocator, + &allocator, injectable_metadata, options.compilation_mode, ) { @@ -3079,7 +3079,7 @@ pub fn transform_angular_file( let decls_after_class = find_pipe_decorator(&class.decorators) .map(|decorator| { build_set_class_metadata_decls( - allocator, + &allocator, class, &class_name, decorator, @@ -3121,7 +3121,7 @@ pub fn transform_angular_file( // Resolve namespace imports for NgModule constructor deps if let Some(ref mut deps) = ng_module_metadata.deps { resolve_factory_dep_namespaces( - allocator, + &allocator, deps, &import_map, &mut file_namespace_registry, @@ -3130,7 +3130,7 @@ pub fn transform_angular_file( // Compile NgModule and generate all definitions as external property assignments if let Some(definition) = generate_full_ng_module_definition( - allocator, + &allocator, &ng_module_metadata, options.compilation_mode, ) { @@ -3156,7 +3156,7 @@ pub fn transform_angular_file( decorator_spans_to_remove.push(span); } if let Some(inj_def) = generate_injectable_definition_from_decorator( - allocator, + &allocator, injectable_metadata, options.compilation_mode, ) { @@ -3190,7 +3190,7 @@ pub fn transform_angular_file( // appended after the NgModule's external declarations. if let Some(decorator) = find_ng_module_decorator(&class.decorators) { let metadata = build_set_class_metadata_decls( - allocator, + &allocator, class, &class_name, decorator, @@ -3268,7 +3268,7 @@ pub fn transform_angular_file( let type_argument_count = class.type_parameters.as_ref().map_or(0, |tp| tp.params.len() as u32); let definition = generate_service_definition_from_decorator( - allocator, + &allocator, &service_metadata, type_argument_count, ); @@ -3288,7 +3288,7 @@ pub fn transform_angular_file( )); let decls_after_class = build_set_class_metadata_decls( - allocator, + &allocator, class, &class_name, service_decorator, @@ -3327,7 +3327,7 @@ pub fn transform_angular_file( // Resolve namespace imports for constructor deps. if let Some(ref mut deps) = injectable_metadata.deps { resolve_factory_dep_namespaces( - allocator, + &allocator, deps, &import_map, &mut file_namespace_registry, @@ -3336,7 +3336,7 @@ pub fn transform_angular_file( // Compile injectable and generate definitions if let Some(definition) = generate_injectable_definition_from_decorator( - allocator, + &allocator, &injectable_metadata, options.compilation_mode, ) { @@ -3362,7 +3362,7 @@ pub fn transform_angular_file( let decls_after_class = find_injectable_decorator(&class.decorators) .map(|decorator| { build_set_class_metadata_decls( - allocator, + &allocator, class, &class_name, decorator, @@ -3702,7 +3702,7 @@ fn compile_component_full<'a>( // Stage 3-5: Ingest and compile // Build ingest options from metadata and transform options - let component_name_atom = Ident::from_in(metadata.class_name.as_str(), allocator); + let component_name_atom = Ident::from_in(metadata.class_name.as_str(), &allocator); // OXC is a single-file compiler, equivalent to Angular's local compilation mode. // In local compilation mode, Angular ALWAYS sets hasDirectiveDependencies=true, @@ -3784,9 +3784,9 @@ fn compile_component_full<'a>( // Build relative paths for debug locations let relative_template_path = - if enable_debug_locations { Some(Ident::from_in(file_path, allocator)) } else { None }; + if enable_debug_locations { Some(Ident::from_in(file_path, &allocator)) } else { None }; - let relative_context_file_path = Some(Ident::from_in(file_path, allocator)); + let relative_context_file_path = Some(Ident::from_in(file_path, &allocator)); let ingest_options = IngestOptions { mode, @@ -3808,7 +3808,7 @@ fn compile_component_full<'a>( }; let mut job = ingest_component_with_options( - allocator, + &allocator, component_name_atom, r3_result.nodes, ingest_options, @@ -3834,7 +3834,7 @@ fn compile_component_full<'a>( let content_queries_fn = if !content_queries.is_empty() { let fn_name = Some(metadata.class_name.as_str()); Some(create_content_queries_function( - allocator, + &allocator, content_queries.as_slice(), fn_name, Some(&mut job.pool), @@ -3847,7 +3847,7 @@ fn compile_component_full<'a>( let view_query_fn = if !view_queries.is_empty() { let fn_name = Some(metadata.class_name.as_str()); Some(create_view_queries_function( - allocator, + &allocator, view_queries.as_slice(), fn_name, Some(&mut job.pool), @@ -3864,7 +3864,7 @@ fn compile_component_full<'a>( // continue from where template compilation left off (avoiding duplicate names) let template_pool_index = job.pool.next_name_index(); let host_binding_output = compile_component_host_bindings( - allocator, + &allocator, metadata, template_pool_index, options.angular_version, @@ -3880,11 +3880,11 @@ fn compile_component_full<'a>( host_binding_fn: output.result.host_binding_fn, host_attrs: output.result.host_attrs, host_vars: output.result.host_vars, - declarations: OxcVec::new_in(allocator), + declarations: OxcVec::new_in(&allocator), }; (Some(result), Some(output.next_pool_index), declarations) } - None => (None, None, OxcVec::new_in(allocator)), + None => (None, None, OxcVec::new_in(&allocator)), }; // Stage 7: Generate ɵcmp/ɵfac definitions @@ -3892,7 +3892,7 @@ fn compile_component_full<'a>( // consistent namespace assignments between factory generation and import statements. // Pass the pre-pooled attrs_ref so the attrs entry uses the correct constant index let definitions = generate_component_definitions( - allocator, + &allocator, metadata, options, &mut job, @@ -3940,14 +3940,14 @@ fn compile_component_full<'a>( // Create component type expression (reference to the class) let component_type = OutputExpression::ReadVar(oxc_allocator::Box::new_in( ReadVarExpr { name: metadata.class_name.clone(), source_span: None }, - allocator, + &allocator, )); // Build HMR metadata let mut hmr_meta = HmrMetadata::new( component_type, metadata.class_name.clone(), - Ident::from_in(file_path, allocator), + Ident::from_in(file_path, &allocator), ); // Add the @angular/core namespace dependency (i0) @@ -3971,7 +3971,7 @@ fn compile_component_full<'a>( // Create component type expression (reference to the class) let component_type = OutputExpression::ReadVar(oxc_allocator::Box::new_in( ReadVarExpr { name: metadata.class_name.clone(), source_span: None }, - allocator, + &allocator, )); // Compute the 1-indexed line number of the class declaration from its byte offset @@ -3988,7 +3988,7 @@ fn compile_component_full<'a>( // Build the debug info with the actual class declaration line number let debug_info = R3ClassDebugInfo::new(component_type, metadata.class_name.clone()) - .with_file_path(Ident::from_in(file_path, allocator)) + .with_file_path(Ident::from_in(file_path, &allocator)) .with_line_number(class_line_number); // Compile to IIFE-wrapped expression @@ -4074,7 +4074,7 @@ fn resolve_styles<'a>( if let Some(style_contents) = resources.styles.get(style_url.as_str()) { // Add all resolved style contents to the metadata styles for style in style_contents { - metadata.styles.push(Ident::from_in(style.as_str(), allocator)); + metadata.styles.push(Ident::from_in(style.as_str(), &allocator)); } } else { missing.push(style_url.to_string()); @@ -4152,7 +4152,7 @@ pub fn compile_component_template<'a>( // Stage 3-5: Ingest and compile use oxc_allocator::FromIn; - let component_name_atom = Ident::from_in(component_name, allocator); + let component_name_atom = Ident::from_in(component_name, &allocator); let mut job = ingest_component(allocator, component_name_atom, r3_result.nodes); let compiled = compile_template(&mut job); @@ -4174,7 +4174,7 @@ pub fn compile_template_to_js<'a>( file_path: &str, ) -> Result> { compile_template_to_js_with_options( - allocator, + &allocator, template, component_name, file_path, @@ -4274,9 +4274,9 @@ pub fn compile_template_to_js_with_options<'a>( }; // Stage 3-5: Ingest and compile - let component_name_atom = Ident::from_in(component_name, allocator); + let component_name_atom = Ident::from_in(component_name, &allocator); let mut job = ingest_component_with_options( - allocator, + &allocator, component_name_atom, r3_result.nodes, ingest_options, @@ -4292,7 +4292,7 @@ pub fn compile_template_to_js_with_options<'a>( // Build a list of all statements to emit: // 1. Declarations (child view functions, pooled constants) // 2. Main template function as a declaration - let mut all_statements: OxcVec<'a, OutputStatement<'a>> = OxcVec::new_in(allocator); + let mut all_statements: OxcVec<'a, OutputStatement<'a>> = OxcVec::new_in(&allocator); // Add all declarations first (child view functions come before main template) for decl in compiled.declarations { @@ -4310,7 +4310,7 @@ pub fn compile_template_to_js_with_options<'a>( modifiers: StmtModifier::NONE, source_span: compiled.template_fn.source_span, }, - allocator, + &allocator, )); all_statements.push(main_fn_stmt); } @@ -4319,7 +4319,7 @@ pub fn compile_template_to_js_with_options<'a>( let host_pool_starting_index = job.pool.next_name_index(); if let Some(ref host_input) = options.host { if let Some(host_result) = compile_host_bindings_from_input( - allocator, + &allocator, host_input, component_name, options.selector.as_deref(), @@ -4344,7 +4344,7 @@ pub fn compile_template_to_js_with_options<'a>( modifiers: StmtModifier::NONE, source_span: host_fn.source_span, }, - allocator, + &allocator, )); all_statements.push(host_fn_stmt); } @@ -4449,9 +4449,9 @@ pub fn compile_template_for_hmr<'a>( }; // Stage 3-5: Ingest and compile - let component_name_atom = Ident::from_in(component_name, allocator); + let component_name_atom = Ident::from_in(component_name, &allocator); let mut job = ingest_component_with_options( - allocator, + &allocator, component_name_atom, r3_result.nodes, ingest_options, @@ -4465,7 +4465,7 @@ pub fn compile_template_for_hmr<'a>( let emitter = JsEmitter::new(); // Emit the template function - let fn_expr = OutputExpression::Function(Box::new_in(compiled.template_fn, allocator)); + let fn_expr = OutputExpression::Function(Box::new_in(compiled.template_fn, &allocator)); let template_js = emitter.emit_expression(&fn_expr); // Emit the declarations (child view functions, pooled constants) @@ -4488,7 +4488,7 @@ pub fn compile_template_for_hmr<'a>( FunctionExpr, LiteralArrayExpr, OutputExpression, OutputStatement, ReturnStatement, }; - let mut const_entries: OxcVec<'a, OutputExpression<'a>> = OxcVec::new_in(allocator); + let mut const_entries: OxcVec<'a, OutputExpression<'a>> = OxcVec::new_in(&allocator); for const_value in &job.consts { const_entries.push(const_value_to_expression(allocator, const_value)); } @@ -4498,7 +4498,7 @@ pub fn compile_template_for_hmr<'a>( // in a function that runs initializers first and returns the array. // This matches what definition.rs does for the initial component definition. let mut fn_stmts: OxcVec<'a, OutputStatement<'a>> = - OxcVec::with_capacity_in(job.consts_initializers.len() + 1, allocator); + OxcVec::with_capacity_in(job.consts_initializers.len() + 1, &allocator); for stmt in job.consts_initializers.drain(..) { fn_stmts.push(stmt); @@ -4508,26 +4508,26 @@ pub fn compile_template_for_hmr<'a>( ReturnStatement { value: OutputExpression::LiteralArray(oxc_allocator::Box::new_in( LiteralArrayExpr { entries: const_entries, source_span: None }, - allocator, + &allocator, )), source_span: None, }, - allocator, + &allocator, ))); OutputExpression::Function(oxc_allocator::Box::new_in( FunctionExpr { name: None, - params: OxcVec::new_in(allocator), + params: OxcVec::new_in(&allocator), statements: fn_stmts, source_span: None, }, - allocator, + &allocator, )) } else { OutputExpression::LiteralArray(oxc_allocator::Box::new_in( LiteralArrayExpr { entries: const_entries, source_span: None }, - allocator, + &allocator, )) }; @@ -4616,7 +4616,7 @@ fn compile_component_host_bindings<'a>( // Ingest and compile the host bindings with the pool starting index // This ensures constant names continue from where template compilation left off let mut job = ingest_host_binding_with_version( - allocator, + &allocator, input, pool_starting_index, angular_version, @@ -4646,7 +4646,7 @@ fn convert_host_metadata_to_input<'a>( let empty_span = Span::empty(0); // Convert property bindings: "[class.active]" -> R3BoundAttribute - let mut properties: OxcVec<'a, R3BoundAttribute<'a>> = OxcVec::new_in(allocator); + let mut properties: OxcVec<'a, R3BoundAttribute<'a>> = OxcVec::new_in(&allocator); for (key, value) in host.properties.iter() { // Strip the brackets from the key: "[prop]" -> "prop" @@ -4665,11 +4665,11 @@ fn convert_host_metadata_to_input<'a>( let parse_result = binding_parser.parse_binding(value_str, empty_span); properties.push(R3BoundAttribute { - name: Ident::from_in(final_name, allocator), + name: Ident::from_in(final_name, &allocator), binding_type, security_context: SecurityContext::None, value: parse_result.ast, - unit: unit.map(|u| Ident::from_in(u, allocator)), + unit: unit.map(|u| Ident::from_in(u, &allocator)), source_span: empty_span, key_span: empty_span, value_span: Some(empty_span), @@ -4678,7 +4678,7 @@ fn convert_host_metadata_to_input<'a>( } // Convert event listeners: "(click)" -> R3BoundEvent - let mut events: OxcVec<'a, R3BoundEvent<'a>> = OxcVec::new_in(allocator); + let mut events: OxcVec<'a, R3BoundEvent<'a>> = OxcVec::new_in(&allocator); for (key, value) in host.listeners.iter() { // Strip the parentheses from the key: "(click)" -> "click" @@ -4693,17 +4693,17 @@ fn convert_host_metadata_to_input<'a>( let (final_event_name, target) = parse_event_target(event_name); let (effective_name, event_type, phase) = - parse_legacy_animation_event(final_event_name, allocator); + parse_legacy_animation_event(final_event_name, &allocator); // Parse the handler expression let value_str = allocator.alloc_str(value.as_str()); let parse_result = binding_parser.parse_event(value_str, empty_span); events.push(R3BoundEvent { - name: Ident::from_in(effective_name, allocator), + name: Ident::from_in(effective_name, &allocator), event_type, handler: parse_result.ast, - target: target.map(|t| Ident::from_in(t, allocator)), + target: target.map(|t| Ident::from_in(t, &allocator)), phase, source_span: empty_span, handler_span: empty_span, @@ -4723,7 +4723,7 @@ fn convert_host_metadata_to_input<'a>( value: crate::output::ast::LiteralValue::String(value.clone()), source_span: None, }, - allocator, + &allocator, )); attributes.insert(key.clone(), expr); } @@ -4737,7 +4737,7 @@ fn convert_host_metadata_to_input<'a>( value: crate::output::ast::LiteralValue::String(style_attr.clone()), source_span: None, }, - allocator, + &allocator, )); attributes.insert(Ident::from("style"), expr); } @@ -4748,7 +4748,7 @@ fn convert_host_metadata_to_input<'a>( value: crate::output::ast::LiteralValue::String(class_attr.clone()), source_span: None, }, - allocator, + &allocator, )); attributes.insert(Ident::from("class"), expr); } @@ -4824,7 +4824,7 @@ fn parse_legacy_animation_event<'a>( }; let phase = phase_raw.map(|p| { let normalized = p.trim().to_lowercase(); - Ident::from_in(normalized.as_str(), allocator) + Ident::from_in(normalized.as_str(), &allocator) }); (trigger, ParsedEventType::LegacyAnimation, phase) } @@ -4857,30 +4857,30 @@ fn convert_host_metadata_input_to_host_metadata<'a>( ) -> HostMetadata<'a> { use oxc_allocator::FromIn; - let mut properties: OxcVec<'a, (Ident<'a>, Ident<'a>)> = OxcVec::new_in(allocator); + let mut properties: OxcVec<'a, (Ident<'a>, Ident<'a>)> = OxcVec::new_in(&allocator); for (k, v) in &input.properties { properties - .push((Ident::from_in(k.as_str(), allocator), Ident::from_in(v.as_str(), allocator))); + .push((Ident::from_in(k.as_str(), &allocator), Ident::from_in(v.as_str(), &allocator))); } - let mut attributes: OxcVec<'a, (Ident<'a>, Ident<'a>)> = OxcVec::new_in(allocator); + let mut attributes: OxcVec<'a, (Ident<'a>, Ident<'a>)> = OxcVec::new_in(&allocator); for (k, v) in &input.attributes { attributes - .push((Ident::from_in(k.as_str(), allocator), Ident::from_in(v.as_str(), allocator))); + .push((Ident::from_in(k.as_str(), &allocator), Ident::from_in(v.as_str(), &allocator))); } - let mut listeners: OxcVec<'a, (Ident<'a>, Ident<'a>)> = OxcVec::new_in(allocator); + let mut listeners: OxcVec<'a, (Ident<'a>, Ident<'a>)> = OxcVec::new_in(&allocator); for (k, v) in &input.listeners { listeners - .push((Ident::from_in(k.as_str(), allocator), Ident::from_in(v.as_str(), allocator))); + .push((Ident::from_in(k.as_str(), &allocator), Ident::from_in(v.as_str(), &allocator))); } HostMetadata { properties, attributes, listeners, - class_attr: input.class_attr.as_ref().map(|s| Ident::from_in(s.as_str(), allocator)), - style_attr: input.style_attr.as_ref().map(|s| Ident::from_in(s.as_str(), allocator)), + class_attr: input.class_attr.as_ref().map(|s| Ident::from_in(s.as_str(), &allocator)), + style_attr: input.style_attr.as_ref().map(|s| Ident::from_in(s.as_str(), &allocator)), } } @@ -4912,21 +4912,21 @@ fn pool_selector_attrs<'a>( // Build the attrs array: ["attrName", "attrValue", ...] let mut attr_entries: OxcVec<'a, OutputExpression<'a>> = - OxcVec::with_capacity_in(selector_attrs.len(), allocator); + OxcVec::with_capacity_in(selector_attrs.len(), &allocator); for attr in selector_attrs { attr_entries.push(OutputExpression::Literal(oxc_allocator::Box::new_in( LiteralExpr { - value: LiteralValue::String(Ident::from_in(attr.as_str(), allocator)), + value: LiteralValue::String(Ident::from_in(attr.as_str(), &allocator)), source_span: None, }, - allocator, + &allocator, ))); } // Create the attrs array literal let attrs_array = OutputExpression::LiteralArray(oxc_allocator::Box::new_in( LiteralArrayExpr { entries: attr_entries, source_span: None }, - allocator, + &allocator, )); // Pool the attrs array using constantPool.getConstLiteral() with forceShared=true @@ -4964,15 +4964,15 @@ fn compile_host_bindings_from_input<'a>( let host = convert_host_metadata_input_to_host_metadata(allocator, host_input); // Get component name and selector as atoms - let component_name_atom = Ident::from_in(component_name, allocator); + let component_name_atom = Ident::from_in(component_name, &allocator); let component_selector = - selector.map(|s| Ident::from_in(s, allocator)).unwrap_or_else(|| Ident::from("")); + selector.map(|s| Ident::from_in(s, &allocator)).unwrap_or_else(|| Ident::from("")); // Convert to HostBindingInput and compile let input = convert_host_metadata_to_input(allocator, &host, component_name_atom, component_selector); let mut job = ingest_host_binding_with_version( - allocator, + &allocator, input, pool_starting_index, angular_version, @@ -5028,7 +5028,7 @@ pub fn compile_host_bindings_for_linker( } let fn_js = result.host_binding_fn.map(|f| { - let expr = OutputExpression::Function(oxc_allocator::Box::new_in(f, &allocator)); + let expr = OutputExpression::Function(oxc_allocator::Box::new_in(f, &&allocator)); emitter.emit_expression(&expr) })?; @@ -5136,9 +5136,9 @@ pub fn compile_template_for_linker<'a>( legacy_optional_chaining: None, }; - let component_name_atom = Ident::from_in(component_name, allocator); + let component_name_atom = Ident::from_in(component_name, &allocator); let mut job = ingest_component_with_options( - allocator, + &allocator, component_name_atom, r3_result.nodes, ingest_options, @@ -5157,7 +5157,7 @@ pub fn compile_template_for_linker<'a>( // Emit consts array as JS expression let consts_js = if !job.consts.is_empty() { - let mut const_entries: OxcVec<'a, OutputExpression<'a>> = OxcVec::new_in(allocator); + let mut const_entries: OxcVec<'a, OutputExpression<'a>> = OxcVec::new_in(&allocator); for const_value in &job.consts { const_entries.push(const_value_to_expression(allocator, const_value)); } @@ -5165,7 +5165,7 @@ pub fn compile_template_for_linker<'a>( let consts_expr = if !job.consts_initializers.is_empty() { // Wrap in function with initializers let mut fn_stmts: OxcVec<'a, OutputStatement<'a>> = - OxcVec::with_capacity_in(job.consts_initializers.len() + 1, allocator); + OxcVec::with_capacity_in(job.consts_initializers.len() + 1, &allocator); for stmt in job.consts_initializers.drain(..) { fn_stmts.push(stmt); } @@ -5176,25 +5176,25 @@ pub fn compile_template_for_linker<'a>( entries: const_entries, source_span: None, }, - allocator, + &allocator, )), source_span: None, }, - allocator, + &allocator, ))); OutputExpression::Function(oxc_allocator::Box::new_in( FunctionExpr { name: None, - params: OxcVec::new_in(allocator), + params: OxcVec::new_in(&allocator), statements: fn_stmts, source_span: None, }, - allocator, + &allocator, )) } else { OutputExpression::LiteralArray(oxc_allocator::Box::new_in( crate::output::ast::LiteralArrayExpr { entries: const_entries, source_span: None }, - allocator, + &allocator, )) }; Some(emitter.emit_expression(&consts_expr)) @@ -5215,7 +5215,7 @@ pub fn compile_template_for_linker<'a>( .unwrap_or_else(|| format!("{component_name}_Template")); // Emit all declarations + main template function as JS code - let mut all_statements: OxcVec<'a, OutputStatement<'a>> = OxcVec::new_in(allocator); + let mut all_statements: OxcVec<'a, OutputStatement<'a>> = OxcVec::new_in(&allocator); for decl in compiled.declarations { all_statements.push(decl); @@ -5230,7 +5230,7 @@ pub fn compile_template_for_linker<'a>( modifiers: StmtModifier::NONE, source_span: compiled.template_fn.source_span, }, - allocator, + &allocator, )); all_statements.push(main_fn_stmt); } diff --git a/crates/oxc_angular_compiler/src/directive/compiler.rs b/crates/oxc_angular_compiler/src/directive/compiler.rs index 5899dd6d9..7df853a01 100644 --- a/crates/oxc_angular_compiler/src/directive/compiler.rs +++ b/crates/oxc_angular_compiler/src/directive/compiler.rs @@ -85,7 +85,7 @@ pub fn compile_directive_from_metadata<'a>( let expression = create_define_directive_call(allocator, definition_map); // Convert host binding declarations to statements - let mut statements = Vec::new_in(allocator); + let mut statements = Vec::new_in(&allocator); for decl in host_declarations { statements.push(decl); } @@ -106,9 +106,9 @@ fn build_base_directive_fields<'a>( pool_starting_index: u32, angular_version: Option, ) -> (Vec<'a, LiteralMapEntry<'a>>, u32, oxc_allocator::Vec<'a, OutputStatement<'a>>) { - let mut entries = Vec::new_in(allocator); + let mut entries = Vec::new_in(&allocator); let mut next_pool_index = pool_starting_index; - let mut host_declarations = oxc_allocator::Vec::new_in(allocator); + let mut host_declarations = oxc_allocator::Vec::new_in(&allocator); // type: MyDirective entries.push(LiteralMapEntry::new( @@ -129,7 +129,7 @@ fn build_base_directive_fields<'a>( // Note: Directive compiler doesn't have access to constant pool, so predicates // are not pooled. For components, pool is passed from component compilation. let content_queries_fn = super::query::create_content_queries_function( - allocator, + &allocator, &metadata.queries, Some(metadata.name.as_str()), None, @@ -147,7 +147,7 @@ fn build_base_directive_fields<'a>( // Note: Directive compiler doesn't have access to constant pool, so predicates // are not pooled. For components, pool is passed from component compilation. let view_queries_fn = super::query::create_view_queries_function( - allocator, + &allocator, &metadata.view_queries, Some(metadata.name.as_str()), None, @@ -184,7 +184,7 @@ fn build_base_directive_fields<'a>( value: LiteralValue::Number(host_vars as f64), source_span: None, }, - allocator, + &allocator, )), false, )); @@ -194,7 +194,7 @@ fn build_base_directive_fields<'a>( if let Some(host_fn) = result.host_binding_fn { entries.push(LiteralMapEntry::new( Ident::from("hostBindings"), - OutputExpression::Function(Box::new_in(host_fn, allocator)), + OutputExpression::Function(Box::new_in(host_fn, &allocator)), false, )); } @@ -220,18 +220,18 @@ fn build_base_directive_fields<'a>( // exportAs: ['myDir'] if !metadata.export_as.is_empty() { - let mut export_items = Vec::new_in(allocator); + let mut export_items = Vec::new_in(&allocator); for name in &metadata.export_as { export_items.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); } entries.push(LiteralMapEntry::new( Ident::from("exportAs"), OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: export_items, source_span: None }, - allocator, + &allocator, )), false, )); @@ -243,7 +243,7 @@ fn build_base_directive_fields<'a>( Ident::from("standalone"), OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(false), source_span: None }, - allocator, + &allocator, )), false, )); @@ -255,7 +255,7 @@ fn build_base_directive_fields<'a>( Ident::from("signals"), OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(true), source_span: None }, - allocator, + &allocator, )), false, )); @@ -272,11 +272,11 @@ fn add_features<'a>( metadata: &R3DirectiveMetadata<'a>, definition_map: &mut Vec<'a, LiteralMapEntry<'a>>, ) { - let mut features = Vec::new_in(allocator); + let mut features = Vec::new_in(&allocator); // ProvidersFeature if let Some(providers) = &metadata.providers { - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(providers.clone_in(allocator)); features.push(create_feature_call(allocator, Identifiers::PROVIDERS_FEATURE, args)); } @@ -285,7 +285,7 @@ fn add_features<'a>( if !metadata.host_directives.is_empty() { let host_directives_arg = create_host_directives_feature_arg(allocator, &metadata.host_directives); - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(host_directives_arg); features.push(create_feature_call(allocator, Identifiers::HOST_DIRECTIVES_FEATURE, args)); } @@ -305,7 +305,7 @@ fn add_features<'a>( Ident::from("features"), OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: features, source_span: None }, - allocator, + &allocator, )), false, )); @@ -323,36 +323,36 @@ fn create_define_directive_call<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(Identifiers::DEFINE_DIRECTIVE), optional: false, source_span: None, }, - allocator, + &allocator, )); // Create the literal map expression let map_expr = OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries: definition_map, source_span: None }, - allocator, + &allocator, )); // Create the function call - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(map_expr); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(define_directive_fn, allocator), + fn_expr: Box::new_in(define_directive_fn, &allocator), args, pure: true, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -383,19 +383,19 @@ fn parse_selector_to_r3_selector<'a>( } // Convert each R3 selector to an output expression array - let mut outer_array = Vec::new_in(allocator); + let mut outer_array = Vec::new_in(&allocator); for r3_selector in &r3_selectors { let inner_entries = r3_selector_to_output_expr(allocator, r3_selector); outer_array.push(OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: inner_entries, source_span: None }, - allocator, + &allocator, ))); } Some(OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: outer_array, source_span: None }, - allocator, + &allocator, ))) } @@ -437,7 +437,7 @@ pub fn create_inputs_literal<'a>( return None; } - let mut entries = Vec::new_in(allocator); + let mut entries = Vec::new_in(&allocator); for input in inputs { let public_name = &input.binding_property_name; @@ -463,18 +463,18 @@ pub fn create_inputs_literal<'a>( let value = if needs_array { // Complex case: create array [flags, publicName, declaredName?, transformFunction?] - let mut arr_entries: Vec<'a, OutputExpression<'a>> = Vec::new_in(allocator); + let mut arr_entries: Vec<'a, OutputExpression<'a>> = Vec::new_in(&allocator); // First element: flags arr_entries.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(f64::from(flags)), source_span: None }, - allocator, + &allocator, ))); // Second element: publicName (binding property name) arr_entries.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(public_name.clone()), source_span: None }, - allocator, + &allocator, ))); // Third element: declaredName (class property name) - only if different or has transform @@ -484,7 +484,7 @@ pub fn create_inputs_literal<'a>( value: LiteralValue::String(declared_name.clone()), source_span: None, }, - allocator, + &allocator, ))); // Fourth element: transformFunction (only if present) @@ -495,13 +495,13 @@ pub fn create_inputs_literal<'a>( OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: arr_entries, source_span: None }, - allocator, + &allocator, )) } else { // Simple case: just the property name as a string OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(public_name.clone()), source_span: None }, - allocator, + &allocator, )) }; @@ -511,7 +511,7 @@ pub fn create_inputs_literal<'a>( Some(OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, ))) } @@ -524,7 +524,7 @@ pub fn create_outputs_literal<'a>( return None; } - let mut entries = Vec::new_in(allocator); + let mut entries = Vec::new_in(&allocator); for (class_name, binding_name) in outputs { let quoted = needs_object_key_quoting(class_name); @@ -535,7 +535,7 @@ pub fn create_outputs_literal<'a>( value: LiteralValue::String(binding_name.clone()), source_span: None, }, - allocator, + &allocator, )), quoted, )); @@ -543,7 +543,7 @@ pub fn create_outputs_literal<'a>( Some(OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, ))) } @@ -610,7 +610,7 @@ fn convert_r3_host_metadata_to_input<'a>( let empty_span = Span::empty(0); // Convert property bindings: "[class.active]" -> R3BoundAttribute - let mut properties: Vec<'a, R3BoundAttribute<'a>> = Vec::new_in(allocator); + let mut properties: Vec<'a, R3BoundAttribute<'a>> = Vec::new_in(&allocator); for (key, value) in host.properties.iter() { // Strip the brackets from the key: "[prop]" -> "prop" @@ -629,11 +629,11 @@ fn convert_r3_host_metadata_to_input<'a>( let parse_result = binding_parser.parse_binding(value_str, empty_span); properties.push(R3BoundAttribute { - name: Ident::from_in(final_name, allocator), + name: Ident::from_in(final_name, &allocator), binding_type, security_context: SecurityContext::None, value: parse_result.ast, - unit: unit.map(|u| Ident::from_in(u, allocator)), + unit: unit.map(|u| Ident::from_in(u, &allocator)), source_span: empty_span, key_span: empty_span, value_span: Some(empty_span), @@ -642,7 +642,7 @@ fn convert_r3_host_metadata_to_input<'a>( } // Convert event listeners: "(click)" -> R3BoundEvent - let mut events: Vec<'a, R3BoundEvent<'a>> = Vec::new_in(allocator); + let mut events: Vec<'a, R3BoundEvent<'a>> = Vec::new_in(&allocator); for (key, value) in host.listeners.iter() { // Strip the parentheses from the key: "(click)" -> "click" @@ -657,17 +657,17 @@ fn convert_r3_host_metadata_to_input<'a>( let (final_event_name, target) = parse_event_target(event_name); let (effective_name, event_type, phase) = - parse_legacy_animation_event(final_event_name, allocator); + parse_legacy_animation_event(final_event_name, &allocator); // Parse the handler expression let value_str = allocator.alloc_str(value.as_str()); let parse_result = binding_parser.parse_event(value_str, empty_span); events.push(R3BoundEvent { - name: Ident::from_in(effective_name, allocator), + name: Ident::from_in(effective_name, &allocator), event_type, handler: parse_result.ast, - target: target.map(|t| Ident::from_in(t, allocator)), + target: target.map(|t| Ident::from_in(t, &allocator)), phase, source_span: empty_span, handler_span: empty_span, @@ -688,7 +688,7 @@ fn convert_r3_host_metadata_to_input<'a>( if let Some(ref style_attr) = host.style_attr { let expr = OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(style_attr.clone()), source_span: None }, - allocator, + &allocator, )); attributes.insert(Ident::from("style"), expr); } @@ -696,7 +696,7 @@ fn convert_r3_host_metadata_to_input<'a>( if let Some(ref class_attr) = host.class_attr { let expr = OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(class_attr.clone()), source_span: None }, - allocator, + &allocator, )); attributes.insert(Ident::from("class"), expr); } @@ -778,7 +778,7 @@ fn parse_legacy_animation_event<'a>( }; let phase = phase_raw.map(|p| { let normalized = p.trim().to_lowercase(); - Ident::from_in(normalized.as_str(), allocator) + Ident::from_in(normalized.as_str(), &allocator) }); (trigger, ParsedEventType::LegacyAnimation, phase) } @@ -807,26 +807,26 @@ fn create_feature_call<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(feature_name), optional: false, source_span: None, }, - allocator, + &allocator, )); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(feature_ref, allocator), + fn_expr: Box::new_in(feature_ref, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -840,15 +840,15 @@ fn create_feature_ref<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(feature_name), optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -857,24 +857,24 @@ fn create_host_directives_feature_arg<'a>( allocator: &'a Allocator, host_directives: &[R3HostDirectiveMetadata<'a>], ) -> OutputExpression<'a> { - let mut items = Vec::new_in(allocator); + let mut items = Vec::new_in(&allocator); for hd in host_directives { - let mut entries = Vec::new_in(allocator); + let mut entries = Vec::new_in(&allocator); // directive let directive_expr = if hd.is_forward_reference { // Wrap in forwardRef() - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); - let fn_params = Vec::new_in(allocator); - let mut fn_body = Vec::new_in(allocator); + let fn_params = Vec::new_in(&allocator); + let mut fn_body = Vec::new_in(&allocator); fn_body.push(OutputStatement::Return(Box::new_in( crate::output::ast::ReturnStatement { value: hd.directive.clone_in(allocator), source_span: None, }, - allocator, + &allocator, ))); let arrow_fn = OutputExpression::Function(Box::new_in( @@ -884,7 +884,7 @@ fn create_host_directives_feature_arg<'a>( statements: fn_body, source_span: None, }, - allocator, + &allocator, )); args.push(arrow_fn); @@ -894,26 +894,26 @@ fn create_host_directives_feature_arg<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(Identifiers::FORWARD_REF), optional: false, source_span: None, }, - allocator, + &allocator, )); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(forward_ref, allocator), + fn_expr: Box::new_in(forward_ref, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } else { hd.directive.clone_in(allocator) @@ -935,13 +935,13 @@ fn create_host_directives_feature_arg<'a>( items.push(OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, ))); } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: items, source_span: None }, - allocator, + &allocator, )) } @@ -955,22 +955,22 @@ pub(crate) fn create_host_directive_mappings_array<'a>( allocator: &'a Allocator, mappings: &[(Ident<'a>, Ident<'a>)], ) -> OutputExpression<'a> { - let mut entries = Vec::with_capacity_in(mappings.len() * 2, allocator); + let mut entries = Vec::with_capacity_in(mappings.len() * 2, &allocator); for (public_name, internal_name) in mappings { entries.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(internal_name.clone()), source_span: None }, - allocator, + &allocator, ))); entries.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(public_name.clone()), source_span: None }, - allocator, + &allocator, ))); } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: None }, - allocator, + &allocator, )) } @@ -985,7 +985,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("MyDirective"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3DirectiveMetadata { @@ -994,18 +994,18 @@ mod tests { type_argument_count: 0, deps: None, selector: Some(Ident::from("[myDir]")), - queries: Vec::new_in(&allocator), - view_queries: Vec::new_in(&allocator), + queries: Vec::new_in(&&allocator), + view_queries: Vec::new_in(&&allocator), host: R3HostMetadata::new(&allocator), uses_on_changes: false, - inputs: Vec::new_in(&allocator), - outputs: Vec::new_in(&allocator), + inputs: Vec::new_in(&&allocator), + outputs: Vec::new_in(&&allocator), uses_inheritance: false, - export_as: Vec::new_in(&allocator), + export_as: Vec::new_in(&&allocator), providers: None, is_standalone: true, is_signal: false, - host_directives: Vec::new_in(&allocator), + host_directives: Vec::new_in(&&allocator), }; let result = compile_directive(&allocator, &metadata, 0, None); @@ -1023,13 +1023,13 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("TestDirective"), source_span: None }, - &allocator, + &&allocator, )); - let mut inputs = Vec::new_in(&allocator); + let mut inputs = Vec::new_in(&&allocator); inputs.push(R3InputMetadata::simple(Ident::from("myInput"))); - let mut outputs = Vec::new_in(&allocator); + let mut outputs = Vec::new_in(&&allocator); outputs.push((Ident::from("myOutput"), Ident::from("myOutput"))); let metadata = R3DirectiveMetadata { @@ -1038,18 +1038,18 @@ mod tests { type_argument_count: 0, deps: None, selector: Some(Ident::from("[test]")), - queries: Vec::new_in(&allocator), - view_queries: Vec::new_in(&allocator), + queries: Vec::new_in(&&allocator), + view_queries: Vec::new_in(&&allocator), host: R3HostMetadata::new(&allocator), uses_on_changes: false, inputs, outputs, uses_inheritance: false, - export_as: Vec::new_in(&allocator), + export_as: Vec::new_in(&&allocator), providers: None, is_standalone: true, is_signal: false, - host_directives: Vec::new_in(&allocator), + host_directives: Vec::new_in(&&allocator), }; let result = compile_directive(&allocator, &metadata, 0, None); @@ -1066,7 +1066,7 @@ mod tests { fn test_inputs_simple_format() { // Test: Simple input (same name, no transform) -> just string let allocator = Allocator::default(); - let mut inputs = Vec::new_in(&allocator); + let mut inputs = Vec::new_in(&&allocator); inputs.push(R3InputMetadata::simple(Ident::from("value"))); let result = create_inputs_literal(&allocator, &inputs); @@ -1083,7 +1083,7 @@ mod tests { fn test_inputs_aliased_format() { // Test: Aliased input (different publicName vs declaredName) -> array format with flags let allocator = Allocator::default(); - let mut inputs = Vec::new_in(&allocator); + let mut inputs = Vec::new_in(&&allocator); inputs.push(R3InputMetadata { class_property_name: Ident::from("count"), binding_property_name: Ident::from("itemCount"), @@ -1109,10 +1109,10 @@ mod tests { fn test_inputs_with_transform_format() { // Test: Input with transform function -> array format with transform and flags=2 let allocator = Allocator::default(); - let mut inputs = Vec::new_in(&allocator); + let mut inputs = Vec::new_in(&&allocator); let transform_fn = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("booleanAttribute"), source_span: None }, - &allocator, + &&allocator, )); inputs.push(R3InputMetadata { class_property_name: Ident::from("disabled"), @@ -1138,7 +1138,7 @@ mod tests { fn test_inputs_signal_format() { // Test: Signal input -> array format with flags=1 let allocator = Allocator::default(); - let mut inputs = Vec::new_in(&allocator); + let mut inputs = Vec::new_in(&&allocator); inputs.push(R3InputMetadata { class_property_name: Ident::from("border"), binding_property_name: Ident::from("border"), @@ -1170,7 +1170,7 @@ mod tests { fn test_inputs_signal_with_alias_format() { // Test: Signal input with alias -> array format with flags=1 and both names let allocator = Allocator::default(); - let mut inputs = Vec::new_in(&allocator); + let mut inputs = Vec::new_in(&&allocator); inputs.push(R3InputMetadata { class_property_name: Ident::from("borderWidth"), binding_property_name: Ident::from("border"), @@ -1196,10 +1196,10 @@ mod tests { // Test: Signal input with transform -> array format with flags=3 (signal + transform) // Note: In practice, signal inputs don't use decorator transforms, but this tests the flag logic let allocator = Allocator::default(); - let mut inputs = Vec::new_in(&allocator); + let mut inputs = Vec::new_in(&&allocator); let transform_fn = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("toNumber"), source_span: None }, - &allocator, + &&allocator, )); inputs.push(R3InputMetadata { class_property_name: Ident::from("count"), @@ -1225,7 +1225,7 @@ mod tests { fn test_inputs_mixed_types() { // Test: Mix of simple, signal, and transform inputs let allocator = Allocator::default(); - let mut inputs = Vec::new_in(&allocator); + let mut inputs = Vec::new_in(&&allocator); // Simple input (flags = 0, uses string format) inputs.push(R3InputMetadata::simple(Ident::from("simple"))); @@ -1242,7 +1242,7 @@ mod tests { // Transform input (flags = 2) let transform_fn = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("booleanAttribute"), source_span: None }, - &allocator, + &&allocator, )); inputs.push(R3InputMetadata { class_property_name: Ident::from("boolInput"), @@ -1282,7 +1282,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("FeatureDirective"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3DirectiveMetadata { @@ -1291,18 +1291,18 @@ mod tests { type_argument_count: 0, deps: None, selector: Some(Ident::from("[feature]")), - queries: Vec::new_in(&allocator), - view_queries: Vec::new_in(&allocator), + queries: Vec::new_in(&&allocator), + view_queries: Vec::new_in(&&allocator), host: R3HostMetadata::new(&allocator), uses_on_changes: true, - inputs: Vec::new_in(&allocator), - outputs: Vec::new_in(&allocator), + inputs: Vec::new_in(&&allocator), + outputs: Vec::new_in(&&allocator), uses_inheritance: true, - export_as: Vec::new_in(&allocator), + export_as: Vec::new_in(&&allocator), providers: None, is_standalone: false, is_signal: false, - host_directives: Vec::new_in(&allocator), + host_directives: Vec::new_in(&&allocator), }; let result = compile_directive(&allocator, &metadata, 0, None); @@ -1320,10 +1320,10 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("ExportDirective"), source_span: None }, - &allocator, + &&allocator, )); - let mut export_as = Vec::new_in(&allocator); + let mut export_as = Vec::new_in(&&allocator); export_as.push(Ident::from("myExport")); export_as.push(Ident::from("otherExport")); @@ -1333,18 +1333,18 @@ mod tests { type_argument_count: 0, deps: None, selector: Some(Ident::from("[export]")), - queries: Vec::new_in(&allocator), - view_queries: Vec::new_in(&allocator), + queries: Vec::new_in(&&allocator), + view_queries: Vec::new_in(&&allocator), host: R3HostMetadata::new(&allocator), uses_on_changes: false, - inputs: Vec::new_in(&allocator), - outputs: Vec::new_in(&allocator), + inputs: Vec::new_in(&&allocator), + outputs: Vec::new_in(&&allocator), uses_inheritance: false, export_as, providers: None, is_standalone: true, is_signal: false, - host_directives: Vec::new_in(&allocator), + host_directives: Vec::new_in(&&allocator), }; let result = compile_directive(&allocator, &metadata, 0, None); @@ -1364,7 +1364,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("BodyTemplateDirective"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3DirectiveMetadata { @@ -1373,18 +1373,18 @@ mod tests { type_argument_count: 0, deps: None, selector: Some(Ident::from("ng-template[body]")), - queries: Vec::new_in(&allocator), - view_queries: Vec::new_in(&allocator), + queries: Vec::new_in(&&allocator), + view_queries: Vec::new_in(&&allocator), host: R3HostMetadata::new(&allocator), uses_on_changes: false, - inputs: Vec::new_in(&allocator), - outputs: Vec::new_in(&allocator), + inputs: Vec::new_in(&&allocator), + outputs: Vec::new_in(&&allocator), uses_inheritance: false, - export_as: Vec::new_in(&allocator), + export_as: Vec::new_in(&&allocator), providers: None, is_standalone: true, is_signal: false, - host_directives: Vec::new_in(&allocator), + host_directives: Vec::new_in(&&allocator), }; let result = compile_directive(&allocator, &metadata, 0, None); @@ -1419,7 +1419,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("PrimaryButtonDirective"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3DirectiveMetadata { @@ -1428,18 +1428,18 @@ mod tests { type_argument_count: 0, deps: None, selector: Some(Ident::from("button.primary")), - queries: Vec::new_in(&allocator), - view_queries: Vec::new_in(&allocator), + queries: Vec::new_in(&&allocator), + view_queries: Vec::new_in(&&allocator), host: R3HostMetadata::new(&allocator), uses_on_changes: false, - inputs: Vec::new_in(&allocator), - outputs: Vec::new_in(&allocator), + inputs: Vec::new_in(&&allocator), + outputs: Vec::new_in(&&allocator), uses_inheritance: false, - export_as: Vec::new_in(&allocator), + export_as: Vec::new_in(&&allocator), providers: None, is_standalone: true, is_signal: false, - host_directives: Vec::new_in(&allocator), + host_directives: Vec::new_in(&&allocator), }; let result = compile_directive(&allocator, &metadata, 0, None); @@ -1464,23 +1464,23 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("TooltipTrigger"), source_span: None }, - &allocator, + &&allocator, )); let directive_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("BrnTooltipTrigger"), source_span: None }, - &allocator, + &&allocator, )); - let mut host_directive_inputs = Vec::new_in(&allocator); + let mut host_directive_inputs = Vec::new_in(&&allocator); host_directive_inputs.push((Ident::from("uTooltip"), Ident::from("brnTooltipTrigger"))); - let mut host_directives = Vec::new_in(&allocator); + let mut host_directives = Vec::new_in(&&allocator); host_directives.push(R3HostDirectiveMetadata { directive: directive_expr, is_forward_reference: false, inputs: host_directive_inputs, - outputs: Vec::new_in(&allocator), + outputs: Vec::new_in(&&allocator), }); let metadata = R3DirectiveMetadata { @@ -1489,14 +1489,14 @@ mod tests { type_argument_count: 0, deps: None, selector: Some(Ident::from("[uTooltip]")), - queries: Vec::new_in(&allocator), - view_queries: Vec::new_in(&allocator), + queries: Vec::new_in(&&allocator), + view_queries: Vec::new_in(&&allocator), host: R3HostMetadata::new(&allocator), uses_on_changes: false, - inputs: Vec::new_in(&allocator), - outputs: Vec::new_in(&allocator), + inputs: Vec::new_in(&&allocator), + outputs: Vec::new_in(&&allocator), uses_inheritance: false, - export_as: Vec::new_in(&allocator), + export_as: Vec::new_in(&&allocator), providers: None, is_standalone: true, is_signal: false, @@ -1529,22 +1529,22 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("MyDirective"), source_span: None }, - &allocator, + &&allocator, )); let directive_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("ClickTracker"), source_span: None }, - &allocator, + &&allocator, )); - let mut host_directive_outputs = Vec::new_in(&allocator); + let mut host_directive_outputs = Vec::new_in(&&allocator); host_directive_outputs.push((Ident::from("clicked"), Ident::from("trackClick"))); - let mut host_directives = Vec::new_in(&allocator); + let mut host_directives = Vec::new_in(&&allocator); host_directives.push(R3HostDirectiveMetadata { directive: directive_expr, is_forward_reference: false, - inputs: Vec::new_in(&allocator), + inputs: Vec::new_in(&&allocator), outputs: host_directive_outputs, }); @@ -1554,14 +1554,14 @@ mod tests { type_argument_count: 0, deps: None, selector: Some(Ident::from("[myDir]")), - queries: Vec::new_in(&allocator), - view_queries: Vec::new_in(&allocator), + queries: Vec::new_in(&&allocator), + view_queries: Vec::new_in(&&allocator), host: R3HostMetadata::new(&allocator), uses_on_changes: false, - inputs: Vec::new_in(&allocator), - outputs: Vec::new_in(&allocator), + inputs: Vec::new_in(&&allocator), + outputs: Vec::new_in(&&allocator), uses_inheritance: false, - export_as: Vec::new_in(&allocator), + export_as: Vec::new_in(&&allocator), providers: None, is_standalone: true, is_signal: false, diff --git a/crates/oxc_angular_compiler/src/directive/decorator.rs b/crates/oxc_angular_compiler/src/directive/decorator.rs index 8ad2466f2..c6413f44e 100644 --- a/crates/oxc_angular_compiler/src/directive/decorator.rs +++ b/crates/oxc_angular_compiler/src/directive/decorator.rs @@ -282,7 +282,7 @@ fn extract_constructor_deps<'a>( Some(ctor) => { // Constructor found - extract parameters (may be empty) let params = &ctor.value.params; - let mut deps = Vec::with_capacity_in(params.items.len(), allocator); + let mut deps = Vec::with_capacity_in(params.items.len(), &allocator); for param in ¶ms.items { let dep = extract_param_dependency(allocator, param, source_text); @@ -296,7 +296,7 @@ fn extract_constructor_deps<'a>( // If class has a superclass, use inherited factory pattern (return None) // If class has no superclass, use simple factory with empty deps (return Some([])) // See: packages/compiler-cli/src/ngtsc/annotations/common/src/di.ts:47-52 - if has_superclass { None } else { Some(Vec::new_in(allocator)) } + if has_superclass { None } else { Some(Vec::new_in(&allocator)) } } } } @@ -357,7 +357,7 @@ fn extract_param_dependency<'a>( value: crate::output::ast::LiteralValue::String(attr_name), source_span: None, }, - allocator, + &allocator, ))), attribute_name_type: token, // The type annotation host, @@ -425,7 +425,7 @@ fn extract_param_token<'a>( return Some(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: type_name, source_span: None }, - allocator, + &allocator, ))); } @@ -676,7 +676,7 @@ fn extract_host_directives<'a>( expr: &Expression<'a>, consts: &StringConsts<'a>, ) -> Vec<'a, R3HostDirectiveMetadata<'a>> { - let mut result = Vec::new_in(allocator); + let mut result = Vec::new_in(&allocator); let Expression::ArrayExpression(arr) = expr else { return result; @@ -702,15 +702,15 @@ fn extract_single_host_directive<'a>( ArrayExpressionElement::Identifier(id) => Some(R3HostDirectiveMetadata { directive: OutputAstBuilder::variable(allocator, id.name.clone().into()), is_forward_reference: false, - inputs: Vec::new_in(allocator), - outputs: Vec::new_in(allocator), + inputs: Vec::new_in(&allocator), + outputs: Vec::new_in(&allocator), }), // Object expression: { directive: ColorDirective, inputs: [...], outputs: [...] } ArrayExpressionElement::ObjectExpression(obj) => { let mut directive_expr = None; - let mut inputs = Vec::new_in(allocator); - let mut outputs = Vec::new_in(allocator); + let mut inputs = Vec::new_in(&allocator); + let mut outputs = Vec::new_in(&allocator); let mut is_forward_reference = false; for prop in &obj.properties { @@ -752,8 +752,8 @@ fn extract_single_host_directive<'a>( return Some(R3HostDirectiveMetadata { directive: OutputAstBuilder::variable(allocator, name), is_forward_reference: true, - inputs: Vec::new_in(allocator), - outputs: Vec::new_in(allocator), + inputs: Vec::new_in(&allocator), + outputs: Vec::new_in(&allocator), }); } } @@ -834,7 +834,7 @@ fn extract_io_mappings<'a>( allocator: &'a Allocator, expr: &Expression<'a>, ) -> Vec<'a, (Ident<'a>, Ident<'a>)> { - let mut result = Vec::new_in(allocator); + let mut result = Vec::new_in(&allocator); let Expression::ArrayExpression(arr) = expr else { return result; diff --git a/crates/oxc_angular_compiler/src/directive/definition.rs b/crates/oxc_angular_compiler/src/directive/definition.rs index 9a40fb5f7..df8bdca65 100644 --- a/crates/oxc_angular_compiler/src/directive/definition.rs +++ b/crates/oxc_angular_compiler/src/directive/definition.rs @@ -167,7 +167,7 @@ fn generate_fac_definition<'a>( Some(deps) => { // Clone deps into a new Vec for R3FactoryDeps let mut factory_deps: Vec<'a, R3DependencyMetadata<'a>> = - Vec::with_capacity_in(deps.len(), allocator); + Vec::with_capacity_in(deps.len(), &allocator); for dep in deps { factory_deps.push(R3DependencyMetadata { token: dep.token.as_ref().map(|t| t.clone_in(allocator)), @@ -191,7 +191,7 @@ fn generate_fac_definition<'a>( R3FactoryDeps::None } else { // Empty deps - constructor with no parameters - R3FactoryDeps::Valid(Vec::new_in(allocator)) + R3FactoryDeps::Valid(Vec::new_in(&allocator)) } } }; @@ -223,7 +223,7 @@ mod tests { fn create_test_metadata<'a>(allocator: &'a Allocator) -> R3DirectiveMetadata<'a> { let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("TestDirective"), source_span: None }, - allocator, + &allocator, )); R3DirectiveMetadata { @@ -232,18 +232,18 @@ mod tests { type_argument_count: 0, deps: None, selector: Some(Ident::from("[testDir]")), - queries: Vec::new_in(allocator), - view_queries: Vec::new_in(allocator), + queries: Vec::new_in(&allocator), + view_queries: Vec::new_in(&allocator), host: R3HostMetadata::new(allocator), uses_on_changes: false, - inputs: Vec::new_in(allocator), - outputs: Vec::new_in(allocator), + inputs: Vec::new_in(&allocator), + outputs: Vec::new_in(&allocator), uses_inheritance: false, - export_as: Vec::new_in(allocator), + export_as: Vec::new_in(&allocator), providers: None, is_standalone: true, is_signal: false, - host_directives: Vec::new_in(allocator), + host_directives: Vec::new_in(&allocator), } } @@ -297,7 +297,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("ChildDirective"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3DirectiveMetadata { @@ -306,18 +306,18 @@ mod tests { type_argument_count: 0, deps: None, // No explicit constructor deps selector: Some(Ident::from("[childDir]")), - queries: Vec::new_in(&allocator), - view_queries: Vec::new_in(&allocator), + queries: Vec::new_in(&&allocator), + view_queries: Vec::new_in(&&allocator), host: R3HostMetadata::new(&allocator), uses_on_changes: false, - inputs: Vec::new_in(&allocator), - outputs: Vec::new_in(&allocator), + inputs: Vec::new_in(&&allocator), + outputs: Vec::new_in(&&allocator), uses_inheritance: true, // Key: extends a base class - export_as: Vec::new_in(&allocator), + export_as: Vec::new_in(&&allocator), providers: None, is_standalone: true, is_signal: false, - host_directives: Vec::new_in(&allocator), + host_directives: Vec::new_in(&&allocator), }; let fac = generate_fac_definition(&allocator, &metadata); @@ -336,27 +336,27 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("TestDirective"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3DirectiveMetadata { name: Ident::from("TestDirective"), r#type: type_expr, type_argument_count: 0, - deps: Some(Vec::new_in(&allocator)), // Empty deps - has constructor but no params + deps: Some(Vec::new_in(&&allocator)), // Empty deps - has constructor but no params selector: Some(Ident::from("[testDir]")), - queries: Vec::new_in(&allocator), - view_queries: Vec::new_in(&allocator), + queries: Vec::new_in(&&allocator), + view_queries: Vec::new_in(&&allocator), host: R3HostMetadata::new(&allocator), uses_on_changes: false, - inputs: Vec::new_in(&allocator), - outputs: Vec::new_in(&allocator), + inputs: Vec::new_in(&&allocator), + outputs: Vec::new_in(&&allocator), uses_inheritance: false, - export_as: Vec::new_in(&allocator), + export_as: Vec::new_in(&&allocator), providers: None, is_standalone: true, is_signal: false, - host_directives: Vec::new_in(&allocator), + host_directives: Vec::new_in(&&allocator), }; let fac = generate_fac_definition(&allocator, &metadata); @@ -377,15 +377,15 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("TestDirective"), source_span: None }, - &allocator, + &&allocator, )); let dep_token = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("SomeService"), source_span: None }, - &allocator, + &&allocator, )); - let mut deps = Vec::new_in(&allocator); + let mut deps = Vec::new_in(&&allocator); deps.push(crate::factory::R3DependencyMetadata::simple(dep_token)); let metadata = R3DirectiveMetadata { @@ -394,18 +394,18 @@ mod tests { type_argument_count: 0, deps: Some(deps), selector: Some(Ident::from("[testDir]")), - queries: Vec::new_in(&allocator), - view_queries: Vec::new_in(&allocator), + queries: Vec::new_in(&&allocator), + view_queries: Vec::new_in(&&allocator), host: R3HostMetadata::new(&allocator), uses_on_changes: false, - inputs: Vec::new_in(&allocator), - outputs: Vec::new_in(&allocator), + inputs: Vec::new_in(&&allocator), + outputs: Vec::new_in(&&allocator), uses_inheritance: false, - export_as: Vec::new_in(&allocator), + export_as: Vec::new_in(&&allocator), providers: None, is_standalone: true, is_signal: false, - host_directives: Vec::new_in(&allocator), + host_directives: Vec::new_in(&&allocator), }; let fac = generate_fac_definition(&allocator, &metadata); @@ -445,7 +445,7 @@ mod tests { // Create first directive with host bindings let type_expr1 = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("Dir1"), source_span: None }, - &allocator, + &&allocator, )); let mut host1 = R3HostMetadata::new(&allocator); @@ -458,18 +458,18 @@ mod tests { type_argument_count: 0, deps: None, selector: Some(Ident::from("[dir1]")), - queries: Vec::new_in(&allocator), - view_queries: Vec::new_in(&allocator), + queries: Vec::new_in(&&allocator), + view_queries: Vec::new_in(&&allocator), host: host1, uses_on_changes: false, - inputs: Vec::new_in(&allocator), - outputs: Vec::new_in(&allocator), + inputs: Vec::new_in(&&allocator), + outputs: Vec::new_in(&&allocator), uses_inheritance: false, - export_as: Vec::new_in(&allocator), + export_as: Vec::new_in(&&allocator), providers: None, is_standalone: true, is_signal: false, - host_directives: Vec::new_in(&allocator), + host_directives: Vec::new_in(&&allocator), }; // Compile first directive @@ -484,7 +484,7 @@ mod tests { // Create second directive with host bindings using the returned pool index let type_expr2 = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("Dir2"), source_span: None }, - &allocator, + &&allocator, )); let mut host2 = R3HostMetadata::new(&allocator); @@ -496,18 +496,18 @@ mod tests { type_argument_count: 0, deps: None, selector: Some(Ident::from("[dir2]")), - queries: Vec::new_in(&allocator), - view_queries: Vec::new_in(&allocator), + queries: Vec::new_in(&&allocator), + view_queries: Vec::new_in(&&allocator), host: host2, uses_on_changes: false, - inputs: Vec::new_in(&allocator), - outputs: Vec::new_in(&allocator), + inputs: Vec::new_in(&&allocator), + outputs: Vec::new_in(&&allocator), uses_inheritance: false, - export_as: Vec::new_in(&allocator), + export_as: Vec::new_in(&&allocator), providers: None, is_standalone: true, is_signal: false, - host_directives: Vec::new_in(&allocator), + host_directives: Vec::new_in(&&allocator), }; // Compile second directive starting from where first left off diff --git a/crates/oxc_angular_compiler/src/directive/metadata.rs b/crates/oxc_angular_compiler/src/directive/metadata.rs index f402cf7f2..12f8305c9 100644 --- a/crates/oxc_angular_compiler/src/directive/metadata.rs +++ b/crates/oxc_angular_compiler/src/directive/metadata.rs @@ -112,7 +112,7 @@ impl<'a> R3QueryMetadata<'a> { Self { property_name, first: false, - predicate: QueryPredicate::Selectors(Vec::new_in(allocator)), + predicate: QueryPredicate::Selectors(Vec::new_in(&allocator)), descendants: true, emit_distinct_changes_only: true, read: None, @@ -147,9 +147,9 @@ impl<'a> R3HostMetadata<'a> { /// Create a new empty host metadata. pub fn new(allocator: &'a Allocator) -> Self { Self { - attributes: Vec::new_in(allocator), - listeners: Vec::new_in(allocator), - properties: Vec::new_in(allocator), + attributes: Vec::new_in(&allocator), + listeners: Vec::new_in(&allocator), + properties: Vec::new_in(&allocator), style_attr: None, class_attr: None, } @@ -282,18 +282,18 @@ impl<'a> R3DirectiveMetadataBuilder<'a> { type_argument_count: 0, deps: None, selector: None, - queries: Vec::new_in(allocator), - view_queries: Vec::new_in(allocator), + queries: Vec::new_in(&allocator), + view_queries: Vec::new_in(&allocator), host: R3HostMetadata::new(allocator), uses_on_changes: false, - inputs: Vec::new_in(allocator), - outputs: Vec::new_in(allocator), + inputs: Vec::new_in(&allocator), + outputs: Vec::new_in(&allocator), uses_inheritance: false, - export_as: Vec::new_in(allocator), + export_as: Vec::new_in(&allocator), providers: None, is_standalone: true, // Default to standalone in modern Angular is_signal: false, - host_directives: Vec::new_in(allocator), + host_directives: Vec::new_in(&allocator), } } diff --git a/crates/oxc_angular_compiler/src/directive/property_decorators.rs b/crates/oxc_angular_compiler/src/directive/property_decorators.rs index 738e185a7..61cdc3ae4 100644 --- a/crates/oxc_angular_compiler/src/directive/property_decorators.rs +++ b/crates/oxc_angular_compiler/src/directive/property_decorators.rs @@ -511,7 +511,7 @@ pub fn extract_input_metadata<'a>( class: &'a Class<'a>, source_text: Option<&'a str>, ) -> Vec<'a, R3InputMetadata<'a>> { - let mut inputs = Vec::new_in(allocator); + let mut inputs = Vec::new_in(&allocator); for element in &class.body.body { match element { @@ -662,7 +662,7 @@ pub fn extract_output_metadata<'a>( allocator: &'a Allocator, class: &'a Class<'a>, ) -> Vec<'a, (Ident<'a>, Ident<'a>)> { - let mut outputs = Vec::new_in(allocator); + let mut outputs = Vec::new_in(&allocator); for element in &class.body.body { match element { @@ -796,7 +796,7 @@ fn parse_query_config<'a>( match first_arg { // @ViewChild('refName') - string selector Argument::StringLiteral(lit) => { - let mut selectors = Vec::new_in(allocator); + let mut selectors = Vec::new_in(&allocator); selectors.push(lit.value.clone().into()); config.predicate = Some(QueryPredicate::Selectors(selectors)); } @@ -963,7 +963,7 @@ fn try_parse_signal_query<'a>( let predicate = match predicate_arg { // String selector: viewChild('myRef') Argument::StringLiteral(lit) => { - let mut selectors = oxc_allocator::Vec::new_in(allocator); + let mut selectors = oxc_allocator::Vec::new_in(&allocator); selectors.push(lit.value.clone().into()); QueryPredicate::Selectors(selectors) } @@ -1047,9 +1047,9 @@ pub fn extract_view_queries<'a>( // 3. @ViewChildren decorator queries // // See: packages/compiler-cli/src/ngtsc/annotations/directive/src/shared.ts - let mut signal_queries = Vec::new_in(allocator); - let mut view_child_queries = Vec::new_in(allocator); - let mut view_children_queries = Vec::new_in(allocator); + let mut signal_queries = Vec::new_in(&allocator); + let mut view_child_queries = Vec::new_in(&allocator); + let mut view_children_queries = Vec::new_in(&allocator); for element in &class.body.body { match element { @@ -1154,7 +1154,7 @@ pub fn extract_view_queries<'a>( } // Concatenate in Angular's order: signals first, then ViewChild, then ViewChildren - let mut result = Vec::new_in(allocator); + let mut result = Vec::new_in(&allocator); result.extend(signal_queries); result.extend(view_child_queries); result.extend(view_children_queries); @@ -1190,9 +1190,9 @@ pub fn extract_content_queries<'a>( // 3. @ContentChildren decorator queries // // See: packages/compiler-cli/src/ngtsc/annotations/directive/src/shared.ts - let mut signal_queries = Vec::new_in(allocator); - let mut content_child_queries = Vec::new_in(allocator); - let mut content_children_queries = Vec::new_in(allocator); + let mut signal_queries = Vec::new_in(&allocator); + let mut content_child_queries = Vec::new_in(&allocator); + let mut content_children_queries = Vec::new_in(&allocator); for element in &class.body.body { match element { @@ -1234,7 +1234,7 @@ pub fn extract_content_queries<'a>( { if let Some(property_name) = get_property_key_name(&prop.key) { let config = parse_query_config( - allocator, + &allocator, decorator, "ContentChildren", source_text, @@ -1281,7 +1281,7 @@ pub fn extract_content_queries<'a>( { if let Some(property_name) = get_property_key_name(&method.key) { let config = parse_query_config( - allocator, + &allocator, decorator, "ContentChildren", source_text, @@ -1306,7 +1306,7 @@ pub fn extract_content_queries<'a>( } // Concatenate in Angular's order: signals first, then ContentChild, then ContentChildren - let mut result = Vec::new_in(allocator); + let mut result = Vec::new_in(&allocator); result.extend(signal_queries); result.extend(content_child_queries); result.extend(content_children_queries); @@ -1335,7 +1335,7 @@ pub fn extract_host_bindings<'a>( allocator: &'a Allocator, class: &'a Class<'a>, ) -> Vec<'a, (Ident<'a>, Ident<'a>)> { - let mut bindings = Vec::new_in(allocator); + let mut bindings = Vec::new_in(&allocator); for element in &class.body.body { let (decorators, property_name) = match element { @@ -1407,7 +1407,7 @@ pub fn extract_host_listeners<'a>( allocator: &'a Allocator, class: &'a Class<'a>, ) -> Vec<'a, (Ident<'a>, Ident<'a>, Vec<'a, Ident<'a>>)> { - let mut listeners = Vec::new_in(allocator); + let mut listeners = Vec::new_in(&allocator); for element in &class.body.body { // Handle both MethodDefinition and PropertyDefinition (for arrow function handlers) @@ -1448,7 +1448,7 @@ fn parse_host_listener_config<'a>( allocator: &'a Allocator, decorator: &'a Decorator<'a>, ) -> (Option>, Vec<'a, Ident<'a>>) { - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); let Expression::CallExpression(call) = &decorator.expression else { return (None, args); diff --git a/crates/oxc_angular_compiler/src/directive/query.rs b/crates/oxc_angular_compiler/src/directive/query.rs index 684de11bf..cc23c77aa 100644 --- a/crates/oxc_angular_compiler/src/directive/query.rs +++ b/crates/oxc_angular_compiler/src/directive/query.rs @@ -108,15 +108,15 @@ fn import_expr<'a>(allocator: &'a Allocator, identifier: &'static str) -> Output receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(identifier), optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -124,7 +124,7 @@ fn import_expr<'a>(allocator: &'a Allocator, identifier: &'static str) -> Output fn variable<'a>(allocator: &'a Allocator, name: &'static str) -> OutputExpression<'a> { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(name), source_span: None }, - allocator, + &allocator, )) } @@ -132,7 +132,7 @@ fn variable<'a>(allocator: &'a Allocator, name: &'static str) -> OutputExpressio fn literal_number<'a>(allocator: &'a Allocator, value: u32) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(f64::from(value)), source_span: None }, - allocator, + &allocator, )) } @@ -140,12 +140,12 @@ fn literal_number<'a>(allocator: &'a Allocator, value: u32) -> OutputExpression< fn context_prop<'a>(allocator: &'a Allocator, property_name: &Ident<'a>) -> OutputExpression<'a> { OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(variable(allocator, CONTEXT_NAME), allocator), + receiver: Box::new_in(variable(allocator, CONTEXT_NAME), &allocator), name: property_name.clone(), optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -157,13 +157,13 @@ fn call_fn<'a>( ) -> OutputExpression<'a> { OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(fn_expr, allocator), + fn_expr: Box::new_in(fn_expr, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -177,21 +177,21 @@ fn render_flag_check_if_stmt<'a>( let condition = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::BitwiseAnd, - lhs: Box::new_in(variable(allocator, RENDER_FLAGS), allocator), - rhs: Box::new_in(literal_number(allocator, flags), allocator), + lhs: Box::new_in(variable(allocator, RENDER_FLAGS), &allocator), + rhs: Box::new_in(literal_number(allocator, flags), &allocator), source_span: None, }, - allocator, + &allocator, )); OutputStatement::If(Box::new_in( IfStmt { condition, true_case: statements, - false_case: Vec::new_in(allocator), + false_case: Vec::new_in(&allocator), source_span: None, }, - allocator, + &allocator, )) } @@ -199,7 +199,7 @@ fn render_flag_check_if_stmt<'a>( fn expr_stmt<'a>(allocator: &'a Allocator, expr: OutputExpression<'a>) -> OutputStatement<'a> { OutputStatement::Expression(Box::new_in( ExpressionStatement { expr, source_span: None }, - allocator, + &allocator, )) } @@ -225,7 +225,7 @@ fn get_query_predicate<'a>( QueryPredicate::Selectors(selectors) => { // Convert selectors to literal array // Each selector may contain comma-separated refs that need splitting - let mut entries = Vec::new_in(allocator); + let mut entries = Vec::new_in(&allocator); for selector in selectors.iter() { // Split by comma and trim @@ -237,7 +237,7 @@ fn get_query_predicate<'a>( value: LiteralValue::String(Ident::from(trimmed)), source_span: None, }, - allocator, + &allocator, ))); } } @@ -245,7 +245,7 @@ fn get_query_predicate<'a>( let array_expr = OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: None }, - allocator, + &allocator, )); // Pool the array to a top-level constant if pool is provided @@ -277,7 +277,7 @@ fn get_query_create_parameters_with_predicate<'a>( query: &R3QueryMetadata<'a>, predicate: OutputExpression<'a>, ) -> Vec<'a, OutputExpression<'a>> { - let mut parameters = Vec::new_in(allocator); + let mut parameters = Vec::new_in(&allocator); // For signal queries, first param is ctx.propertyName if query.is_signal { @@ -311,7 +311,7 @@ fn get_content_query_create_parameters_with_predicate<'a>( predicate: OutputExpression<'a>, prepend_params: Vec<'a, OutputExpression<'a>>, ) -> Vec<'a, OutputExpression<'a>> { - let mut parameters = Vec::new_in(allocator); + let mut parameters = Vec::new_in(&allocator); // Add prepend params (e.g., dirIndex for content queries) for param in prepend_params { @@ -356,14 +356,14 @@ fn collapse_advance_statements<'a>( allocator: &'a Allocator, statements: Vec<'a, MaybeAdvanceStatement<'a>>, ) -> Vec<'a, OutputStatement<'a>> { - let mut result = Vec::new_in(allocator); + let mut result = Vec::new_in(&allocator); let mut advance_count = 0u32; // Process statements and flush pending advances let flush_advance = |result: &mut Vec<'a, OutputStatement<'a>>, count: &mut u32| { if *count > 0 { // Create ɵɵqueryAdvance() or ɵɵqueryAdvance(count) - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); if *count > 1 { args.push(literal_number(allocator, *count)); } @@ -414,7 +414,7 @@ impl TempAllocator { self.allocated = true; OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(TEMPORARY_NAME), source_span: None }, - allocator, + &allocator, )) } @@ -457,8 +457,8 @@ pub fn create_view_queries_function<'a>( view_queries.iter().map(|query| get_query_predicate(allocator, query, None)).collect() }; - let mut create_statements = Vec::new_in(allocator); - let mut update_statements: Vec<'a, MaybeAdvanceStatement<'a>> = Vec::new_in(allocator); + let mut create_statements = Vec::new_in(&allocator); + let mut update_statements: Vec<'a, MaybeAdvanceStatement<'a>> = Vec::new_in(&allocator); let mut temp_allocator = TempAllocator::new(); // Chained emit (`ɵɵviewQuery(p1)(p2)`) requires Angular 21.0.4+ / @@ -487,7 +487,7 @@ pub fn create_view_queries_function<'a>( // Creation: ɵɵviewQuery(predicate, flags, read) or ɵɵviewQuerySignal(ctx.prop, predicate, flags, read) // Use pre-pooled predicate instead of calling get_query_create_parameters let params = get_query_create_parameters_with_predicate( - allocator, + &allocator, query, pooled_predicates[idx].clone_in(allocator), ); @@ -527,25 +527,25 @@ pub fn create_view_queries_function<'a>( // _t = ɵɵloadQuery() let load_query = call_fn( - allocator, + &allocator, import_expr(allocator, Identifiers::LOAD_QUERY), - Vec::new_in(allocator), + Vec::new_in(&allocator), ); let temp_set = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Assign, - lhs: Box::new_in(temp.clone_in(allocator), allocator), - rhs: Box::new_in(load_query, allocator), + lhs: Box::new_in(temp.clone_in(allocator), &allocator), + rhs: Box::new_in(load_query, &allocator), source_span: None, }, - allocator, + &allocator, )); // ɵɵqueryRefresh(_t = ɵɵloadQuery()) - let mut refresh_args = Vec::new_in(allocator); + let mut refresh_args = Vec::new_in(&allocator); refresh_args.push(temp_set); let refresh = call_fn( - allocator, + &allocator, import_expr(allocator, Identifiers::QUERY_REFRESH), refresh_args, ); @@ -554,12 +554,12 @@ pub fn create_view_queries_function<'a>( let value = if query.first { OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(temp.clone_in(allocator), allocator), + receiver: Box::new_in(temp.clone_in(allocator), &allocator), name: Ident::from("first"), optional: false, source_span: None, }, - allocator, + &allocator, )) } else { temp.clone_in(allocator) @@ -568,22 +568,22 @@ pub fn create_view_queries_function<'a>( let update_directive = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Assign, - lhs: Box::new_in(context_prop(allocator, &query.property_name), allocator), - rhs: Box::new_in(value, allocator), + lhs: Box::new_in(context_prop(allocator, &query.property_name), &allocator), + rhs: Box::new_in(value, &allocator), source_span: None, }, - allocator, + &allocator, )); // refresh && (ctx.prop = ...) let and_expr = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::And, - lhs: Box::new_in(refresh, allocator), - rhs: Box::new_in(update_directive, allocator), + lhs: Box::new_in(refresh, &allocator), + rhs: Box::new_in(update_directive, &allocator), source_span: None, }, - allocator, + &allocator, )); update_statements @@ -595,7 +595,7 @@ pub fn create_view_queries_function<'a>( flush_chain(allocator, &mut current_chain, &mut create_statements); // Build update statements with temp variable declarations - let mut final_update_statements = Vec::new_in(allocator); + let mut final_update_statements = Vec::new_in(&allocator); // Add temp variable declarations if needed if temp_allocator.needs_declaration() { @@ -607,7 +607,7 @@ pub fn create_view_queries_function<'a>( leading_comment: None, source_span: None, }, - allocator, + &allocator, ))); } @@ -617,32 +617,32 @@ pub fn create_view_queries_function<'a>( } // Build function body - let mut body = Vec::new_in(allocator); + let mut body = Vec::new_in(&allocator); if !create_statements.is_empty() { body.push(render_flag_check_if_stmt(allocator, render_flags::CREATE, create_statements)); } if !final_update_statements.is_empty() { body.push(render_flag_check_if_stmt( - allocator, + &allocator, render_flags::UPDATE, final_update_statements, )); } // Build function parameters - let mut params = Vec::new_in(allocator); + let mut params = Vec::new_in(&allocator); params.push(FnParam { name: Ident::from(RENDER_FLAGS) }); params.push(FnParam { name: Ident::from(CONTEXT_NAME) }); // Create function name let fn_name = name.map(|n| { let formatted = format!("{n}_Query"); - Ident::from_in(formatted.as_str(), allocator) + Ident::from_in(formatted.as_str(), &allocator) }); OutputExpression::Function(Box::new_in( FunctionExpr { name: fn_name, params, statements: body, source_span: None }, - allocator, + &allocator, )) } @@ -680,8 +680,8 @@ pub fn create_content_queries_function<'a>( queries.iter().map(|query| get_query_predicate(allocator, query, None)).collect() }; - let mut create_statements = Vec::new_in(allocator); - let mut update_statements: Vec<'a, MaybeAdvanceStatement<'a>> = Vec::new_in(allocator); + let mut create_statements = Vec::new_in(&allocator); + let mut update_statements: Vec<'a, MaybeAdvanceStatement<'a>> = Vec::new_in(&allocator); let mut temp_allocator = TempAllocator::new(); // See note in `create_view_queries_function` — chained content-query @@ -703,11 +703,11 @@ pub fn create_content_queries_function<'a>( for (idx, query) in queries.iter().enumerate() { // Prepend dirIndex parameter for content queries - let mut prepend = Vec::new_in(allocator); + let mut prepend = Vec::new_in(&allocator); prepend.push(variable(allocator, "dirIndex")); // Use pre-pooled predicate instead of calling get_query_create_parameters let params = get_content_query_create_parameters_with_predicate( - allocator, + &allocator, query, pooled_predicates[idx].clone_in(allocator), prepend, @@ -743,24 +743,24 @@ pub fn create_content_queries_function<'a>( let temp = temp_allocator.allocate(allocator); let load_query = call_fn( - allocator, + &allocator, import_expr(allocator, Identifiers::LOAD_QUERY), - Vec::new_in(allocator), + Vec::new_in(&allocator), ); let temp_set = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Assign, - lhs: Box::new_in(temp.clone_in(allocator), allocator), - rhs: Box::new_in(load_query, allocator), + lhs: Box::new_in(temp.clone_in(allocator), &allocator), + rhs: Box::new_in(load_query, &allocator), source_span: None, }, - allocator, + &allocator, )); - let mut refresh_args = Vec::new_in(allocator); + let mut refresh_args = Vec::new_in(&allocator); refresh_args.push(temp_set); let refresh = call_fn( - allocator, + &allocator, import_expr(allocator, Identifiers::QUERY_REFRESH), refresh_args, ); @@ -768,12 +768,12 @@ pub fn create_content_queries_function<'a>( let value = if query.first { OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(temp.clone_in(allocator), allocator), + receiver: Box::new_in(temp.clone_in(allocator), &allocator), name: Ident::from("first"), optional: false, source_span: None, }, - allocator, + &allocator, )) } else { temp.clone_in(allocator) @@ -782,21 +782,21 @@ pub fn create_content_queries_function<'a>( let update_directive = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Assign, - lhs: Box::new_in(context_prop(allocator, &query.property_name), allocator), - rhs: Box::new_in(value, allocator), + lhs: Box::new_in(context_prop(allocator, &query.property_name), &allocator), + rhs: Box::new_in(value, &allocator), source_span: None, }, - allocator, + &allocator, )); let and_expr = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::And, - lhs: Box::new_in(refresh, allocator), - rhs: Box::new_in(update_directive, allocator), + lhs: Box::new_in(refresh, &allocator), + rhs: Box::new_in(update_directive, &allocator), source_span: None, }, - allocator, + &allocator, )); update_statements @@ -808,7 +808,7 @@ pub fn create_content_queries_function<'a>( flush_chain(allocator, &mut current_chain, &mut create_statements); // Build update statements with temp variable declarations - let mut final_update_statements = Vec::new_in(allocator); + let mut final_update_statements = Vec::new_in(&allocator); if temp_allocator.needs_declaration() { final_update_statements.push(OutputStatement::DeclareVar(Box::new_in( @@ -819,7 +819,7 @@ pub fn create_content_queries_function<'a>( leading_comment: None, source_span: None, }, - allocator, + &allocator, ))); } @@ -828,20 +828,20 @@ pub fn create_content_queries_function<'a>( } // Build function body - let mut body = Vec::new_in(allocator); + let mut body = Vec::new_in(&allocator); if !create_statements.is_empty() { body.push(render_flag_check_if_stmt(allocator, render_flags::CREATE, create_statements)); } if !final_update_statements.is_empty() { body.push(render_flag_check_if_stmt( - allocator, + &allocator, render_flags::UPDATE, final_update_statements, )); } // Build function parameters (rf, ctx, dirIndex) - let mut params = Vec::new_in(allocator); + let mut params = Vec::new_in(&allocator); params.push(FnParam { name: Ident::from(RENDER_FLAGS) }); params.push(FnParam { name: Ident::from(CONTEXT_NAME) }); params.push(FnParam { name: Ident::from("dirIndex") }); @@ -849,12 +849,12 @@ pub fn create_content_queries_function<'a>( // Create function name let fn_name = name.map(|n| { let formatted = format!("{n}_ContentQueries"); - Ident::from_in(formatted.as_str(), allocator) + Ident::from_in(formatted.as_str(), &allocator) }); OutputExpression::Function(Box::new_in( FunctionExpr { name: fn_name, params, statements: body, source_span: None }, - allocator, + &allocator, )) } @@ -919,7 +919,7 @@ mod tests { first: true, predicate: QueryPredicate::Type(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("SomeComponent"), source_span: None }, - &allocator, + &&allocator, ))), descendants: true, emit_distinct_changes_only: false, @@ -961,7 +961,7 @@ mod tests { first: true, predicate: QueryPredicate::Type(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("ContentComponent"), source_span: None }, - &allocator, + &&allocator, ))), descendants: true, emit_distinct_changes_only: false, @@ -1011,7 +1011,7 @@ mod tests { first: true, predicate: QueryPredicate::Type(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("Component1"), source_span: None }, - &allocator, + &&allocator, ))), descendants: true, emit_distinct_changes_only: false, @@ -1025,7 +1025,7 @@ mod tests { first: true, predicate: QueryPredicate::Type(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("Component2"), source_span: None }, - &allocator, + &&allocator, ))), descendants: true, emit_distinct_changes_only: false, @@ -1082,7 +1082,7 @@ mod tests { first: true, predicate: QueryPredicate::Type(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("ChildComponent"), source_span: None }, - &allocator, + &&allocator, ))), descendants: true, emit_distinct_changes_only: true, @@ -1096,7 +1096,7 @@ mod tests { first: false, predicate: QueryPredicate::Type(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("OtherComponent"), source_span: None }, - &allocator, + &&allocator, ))), descendants: true, emit_distinct_changes_only: true, @@ -1145,7 +1145,7 @@ mod tests { first: false, predicate: QueryPredicate::Type(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("ItemComponent"), source_span: None }, - &allocator, + &&allocator, ))), descendants: true, emit_distinct_changes_only: true, @@ -1159,7 +1159,7 @@ mod tests { first: true, predicate: QueryPredicate::Type(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("HeaderComponent"), source_span: None }, - &allocator, + &&allocator, ))), descendants: false, emit_distinct_changes_only: true, @@ -1204,7 +1204,7 @@ mod tests { let allocator = Allocator::default(); // Create a signal query with a string selector - let mut selectors = Vec::new_in(&allocator); + let mut selectors = Vec::new_in(&&allocator); selectors.push(Ident::from("myRef")); let query = R3QueryMetadata { diff --git a/crates/oxc_angular_compiler/src/factory/compiler.rs b/crates/oxc_angular_compiler/src/factory/compiler.rs index ec7a75e60..7191a77b2 100644 --- a/crates/oxc_angular_compiler/src/factory/compiler.rs +++ b/crates/oxc_angular_compiler/src/factory/compiler.rs @@ -116,7 +116,7 @@ pub fn compile_factory_function<'a>( // For delegated factories, only use the type parameter OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: factory_type_param.clone(), source_span: None }, - allocator, + &allocator, )) } else { // (__ngFactoryType__ || MyClass) @@ -126,14 +126,14 @@ pub fn compile_factory_function<'a>( lhs: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: factory_type_param.clone(), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), - rhs: Box::new_in(base.type_expr.clone_in(allocator), allocator), + rhs: Box::new_in(base.type_expr.clone_in(allocator), &allocator), source_span: None, }, - allocator, + &allocator, )) }; @@ -150,11 +150,11 @@ pub fn compile_factory_function<'a>( let inject_args = inject_dependencies(allocator, deps.as_slice(), base.target); Some(OutputExpression::Instantiate(Box::new_in( InstantiateExpr { - class_expr: Box::new_in(type_for_ctor.clone_in(allocator), allocator), + class_expr: Box::new_in(type_for_ctor.clone_in(allocator), &allocator), args: inject_args, source_span: None, }, - allocator, + &allocator, ))) } R3FactoryDeps::Invalid => None, @@ -170,7 +170,7 @@ pub fn compile_factory_function<'a>( return compile_inherited_factory(allocator, base, factory_name); } - let mut body: Vec<'a, OutputStatement<'a>> = Vec::new_in(allocator); + let mut body: Vec<'a, OutputStatement<'a>> = Vec::new_in(&allocator); let ret_expr: Option>; // Handle the different metadata types @@ -190,12 +190,12 @@ pub fn compile_factory_function<'a>( InstantiateExpr { class_expr: Box::new_in( delegated_meta.delegate.clone_in(allocator), - allocator, + &allocator, ), args: delegate_args, source_span: None, }, - allocator, + &allocator, )) } R3FactoryDelegateType::Function => { @@ -204,20 +204,20 @@ pub fn compile_factory_function<'a>( InvokeFunctionExpr { fn_expr: Box::new_in( delegated_meta.delegate.clone_in(allocator), - allocator, + &allocator, ), args: delegate_args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } }; ret_expr = Some(make_conditional_factory( - allocator, + &allocator, &mut body, &factory_type_param, ctor_expr, @@ -227,7 +227,7 @@ pub fn compile_factory_function<'a>( R3FactoryMetadata::Expression(expr_meta) => { // useValue or useExisting case ret_expr = Some(make_conditional_factory( - allocator, + &allocator, &mut body, &factory_type_param, ctor_expr, @@ -248,20 +248,20 @@ pub fn compile_factory_function<'a>( let invalid_factory_call = create_invalid_factory_call(allocator); body.push(OutputStatement::Expression(Box::new_in( ExpressionStatement { expr: invalid_factory_call, source_span: None }, - allocator, + &allocator, ))); } Some(expr) => { // Return the result body.push(OutputStatement::Return(Box::new_in( ReturnStatement { value: expr, source_span: None }, - allocator, + &allocator, ))); } } // Create the factory function - let mut params = Vec::new_in(allocator); + let mut params = Vec::new_in(&allocator); params.push(FnParam { name: factory_type_param }); let factory_fn = OutputExpression::Function(Box::new_in( @@ -271,10 +271,10 @@ pub fn compile_factory_function<'a>( statements: body, source_span: None, }, - allocator, + &allocator, )); - FactoryCompileResult { expression: factory_fn, statements: Vec::new_in(allocator) } + FactoryCompileResult { expression: factory_fn, statements: Vec::new_in(&allocator) } } /// Creates the conditional factory pattern for delegated/expression factories. @@ -307,13 +307,13 @@ fn make_conditional_factory<'a>( name: conditional_factory_var.clone(), value: Some(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))), modifiers: StmtModifier::NONE, leading_comment: None, source_span: None, }, - allocator, + &allocator, ))); // Create the true case: __ngConditionalFactory__ = or invalidFactory() @@ -329,18 +329,18 @@ fn make_conditional_factory<'a>( name: conditional_factory_var.clone(), source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), - rhs: Box::new_in(expr, allocator), + rhs: Box::new_in(expr, &allocator), source_span: None, }, - allocator, + &allocator, )); OutputStatement::Expression(Box::new_in( ExpressionStatement { expr: assignment, source_span: None }, - allocator, + &allocator, )) } None => { @@ -348,7 +348,7 @@ fn make_conditional_factory<'a>( let invalid_factory_call = create_invalid_factory_call(allocator); OutputStatement::Expression(Box::new_in( ExpressionStatement { expr: invalid_factory_call, source_span: None }, - allocator, + &allocator, )) } }; @@ -360,43 +360,43 @@ fn make_conditional_factory<'a>( lhs: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: conditional_factory_var.clone(), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), - rhs: Box::new_in(non_ctor_expr, allocator), + rhs: Box::new_in(non_ctor_expr, &allocator), source_span: None, }, - allocator, + &allocator, )); let false_stmt = OutputStatement::Expression(Box::new_in( ExpressionStatement { expr: false_assignment, source_span: None }, - allocator, + &allocator, )); // Create the if statement - let mut true_case = Vec::new_in(allocator); + let mut true_case = Vec::new_in(&allocator); true_case.push(true_stmt); - let mut false_case = Vec::new_in(allocator); + let mut false_case = Vec::new_in(&allocator); false_case.push(false_stmt); body.push(OutputStatement::If(Box::new_in( IfStmt { condition: OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: factory_type_param.clone(), source_span: None }, - allocator, + &allocator, )), true_case, false_case, source_span: None, }, - allocator, + &allocator, ))); // Return the variable reference OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: conditional_factory_var, source_span: None }, - allocator, + &allocator, )) } @@ -420,7 +420,7 @@ fn compile_inherited_factory<'a>( ) -> FactoryCompileResult<'a> { // Create base factory variable name: ɵMyClass_BaseFactory let base_factory_var_name = - Ident::from_in(format!("ɵ{}_BaseFactory", base.name).as_str(), allocator); + Ident::from_in(format!("ɵ{}_BaseFactory", base.name).as_str(), &allocator); let factory_type_param = Ident::from("__ngFactoryType__"); // Create ɵɵgetInheritedFactory(MyClass) call @@ -430,29 +430,29 @@ fn compile_inherited_factory<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(Identifiers::GET_INHERITED_FACTORY), optional: false, source_span: None, }, - allocator, + &allocator, )); - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(base.type_expr.clone_in(allocator)); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(fn_expr, allocator), + fn_expr: Box::new_in(fn_expr, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) }; @@ -463,14 +463,14 @@ fn compile_inherited_factory<'a>( lhs: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: base_factory_var_name.clone(), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), - rhs: Box::new_in(get_inherited_factory_call, allocator), + rhs: Box::new_in(get_inherited_factory_call, &allocator), source_span: None, }, - allocator, + &allocator, )); // Create memoization pattern: baseFactoryVar || (baseFactoryVar = ɵɵgetInheritedFactory(...)) @@ -480,14 +480,14 @@ fn compile_inherited_factory<'a>( lhs: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: base_factory_var_name.clone(), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), - rhs: Box::new_in(assignment, allocator), + rhs: Box::new_in(assignment, &allocator), source_span: None, }, - allocator, + &allocator, )); // Create (__ngFactoryType__ || MyClass) @@ -497,40 +497,40 @@ fn compile_inherited_factory<'a>( lhs: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: factory_type_param.clone(), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), - rhs: Box::new_in(base.type_expr.clone_in(allocator), allocator), + rhs: Box::new_in(base.type_expr.clone_in(allocator), &allocator), source_span: None, }, - allocator, + &allocator, )); // Create the factory call: (memoizedFactory)(__ngFactoryType__ || MyClass) - let mut factory_call_args = Vec::new_in(allocator); + let mut factory_call_args = Vec::new_in(&allocator); factory_call_args.push(type_for_ctor); let factory_call = OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(memoized_factory, allocator), + fn_expr: Box::new_in(memoized_factory, &allocator), args: factory_call_args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )); // Create return statement for inner function - let mut inner_body: Vec<'a, OutputStatement<'a>> = Vec::new_in(allocator); + let mut inner_body: Vec<'a, OutputStatement<'a>> = Vec::new_in(&allocator); inner_body.push(OutputStatement::Return(Box::new_in( ReturnStatement { value: factory_call, source_span: None }, - allocator, + &allocator, ))); // Create inner function: function MyClass_Factory(__ngFactoryType__) { ... } - let mut inner_params = Vec::new_in(allocator); + let mut inner_params = Vec::new_in(&allocator); inner_params.push(FnParam { name: factory_type_param }); let inner_fn = OutputExpression::Function(Box::new_in( @@ -540,11 +540,11 @@ fn compile_inherited_factory<'a>( statements: inner_body, source_span: None, }, - allocator, + &allocator, )); // Create IIFE body: let ɵMyClass_BaseFactory; return function...; - let mut iife_body: Vec<'a, OutputStatement<'a>> = Vec::new_in(allocator); + let mut iife_body: Vec<'a, OutputStatement<'a>> = Vec::new_in(&allocator); // Declaration: let ɵMyClass_BaseFactory; iife_body.push(OutputStatement::DeclareVar(Box::new_in( @@ -555,38 +555,38 @@ fn compile_inherited_factory<'a>( leading_comment: None, source_span: None, }, - allocator, + &allocator, ))); // Return the inner function iife_body.push(OutputStatement::Return(Box::new_in( ReturnStatement { value: inner_fn, source_span: None }, - allocator, + &allocator, ))); // Create arrow function IIFE: () => { let x; return function...; } let arrow_fn = OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { - params: Vec::new_in(allocator), + params: Vec::new_in(&allocator), body: ArrowFunctionBody::Statements(iife_body), source_span: None, }, - allocator, + &allocator, )); // Invoke the IIFE: (() => { ... })() let iife = OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(arrow_fn, allocator), - args: Vec::new_in(allocator), + fn_expr: Box::new_in(arrow_fn, &allocator), + args: Vec::new_in(&allocator), pure: true, // Mark as @__PURE__ for tree-shaking optional: false, source_span: None, }, - allocator, + &allocator, )); - FactoryCompileResult { expression: iife, statements: Vec::new_in(allocator) } + FactoryCompileResult { expression: iife, statements: Vec::new_in(&allocator) } } /// Injects dependencies by creating inject calls. @@ -595,7 +595,7 @@ fn inject_dependencies<'a>( deps: &[R3DependencyMetadata<'a>], target: FactoryTarget, ) -> Vec<'a, OutputExpression<'a>> { - let mut result = Vec::new_in(allocator); + let mut result = Vec::new_in(&allocator); for (index, dep) in deps.iter().enumerate() { result.push(compile_inject_dependency(allocator, dep, target, index)); } @@ -634,13 +634,13 @@ fn compile_inject_dependency<'a>( } let inject_fn = get_inject_fn(target); - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(token.clone_in(allocator)); if flags != InjectFlags::DEFAULT || dep.optional { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(flags as f64), source_span: None }, - allocator, + &allocator, ))); } @@ -648,7 +648,7 @@ fn compile_inject_dependency<'a>( } (Some(token), Some(_attr_type)) => { // Attribute injection - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(token.clone_in(allocator)); create_import_call(allocator, Identifiers::INJECT_ATTRIBUTE, args) } @@ -678,32 +678,32 @@ fn create_import_call<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(name), optional: false, source_span: None, }, - allocator, + &allocator, )); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(fn_expr, allocator), + fn_expr: Box::new_in(fn_expr, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } /// Creates `i0.ɵɵinvalidFactory()` call. pub fn create_invalid_factory_call<'a>(allocator: &'a Allocator) -> OutputExpression<'a> { - create_import_call(allocator, Identifiers::INVALID_FACTORY, Vec::new_in(allocator)) + create_import_call(allocator, Identifiers::INVALID_FACTORY, Vec::new_in(&allocator)) } /// Creates i0.ɵɵinvalidFactoryDep(index) call. @@ -711,10 +711,10 @@ fn create_invalid_factory_dep_call<'a>( allocator: &'a Allocator, index: usize, ) -> OutputExpression<'a> { - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(index as f64), source_span: None }, - allocator, + &allocator, ))); create_import_call(allocator, Identifiers::INVALID_FACTORY_DEP, args) } @@ -730,7 +730,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("TestClass"), source_span: None }, - &allocator, + &&allocator, )); let meta = R3FactoryMetadata::Constructor(R3ConstructorFactoryMetadata { @@ -738,7 +738,7 @@ mod tests { type_expr: type_expr.clone_in(&allocator), type_decl: type_expr, type_argument_count: 0, - deps: R3FactoryDeps::Valid(Vec::new_in(&allocator)), + deps: R3FactoryDeps::Valid(Vec::new_in(&&allocator)), target: FactoryTarget::Pipe, }); @@ -755,15 +755,15 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("MyPipe"), source_span: None }, - &allocator, + &&allocator, )); let dep_token = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("SomeService"), source_span: None }, - &allocator, + &&allocator, )); - let mut deps = Vec::new_in(&allocator); + let mut deps = Vec::new_in(&&allocator); deps.push(R3DependencyMetadata::simple(dep_token)); let meta = R3FactoryMetadata::Constructor(R3ConstructorFactoryMetadata { @@ -788,7 +788,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("BrokenClass"), source_span: None }, - &allocator, + &&allocator, )); let meta = R3FactoryMetadata::Constructor(R3ConstructorFactoryMetadata { @@ -812,7 +812,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("ChildClass"), source_span: None }, - &allocator, + &&allocator, )); // R3FactoryDeps::None indicates no constructor, use inherited factory diff --git a/crates/oxc_angular_compiler/src/factory/metadata.rs b/crates/oxc_angular_compiler/src/factory/metadata.rs index 7d7b9f2dd..c83f87a04 100644 --- a/crates/oxc_angular_compiler/src/factory/metadata.rs +++ b/crates/oxc_angular_compiler/src/factory/metadata.rs @@ -201,7 +201,7 @@ mod tests { let allocator = Allocator::default(); let token = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("TestService"), source_span: None }, - &allocator, + &&allocator, )); let dep = R3DependencyMetadata::simple(token); @@ -217,7 +217,7 @@ mod tests { let allocator = Allocator::default(); let token = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("OptionalService"), source_span: None }, - &allocator, + &&allocator, )); let dep = R3DependencyMetadata::optional_dep(token); diff --git a/crates/oxc_angular_compiler/src/hmr/dependencies.rs b/crates/oxc_angular_compiler/src/hmr/dependencies.rs index a9537c772..d3ef7a5a8 100644 --- a/crates/oxc_angular_compiler/src/hmr/dependencies.rs +++ b/crates/oxc_angular_compiler/src/hmr/dependencies.rs @@ -323,7 +323,7 @@ pub fn extract_compiled_dependencies<'a>( // Create variable reference as runtime representation let runtime_representation = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(allocator.alloc_str(name)), source_span: None }, - allocator, + &allocator, )); LocalDependency { name: Ident::from(allocator.alloc_str(name)), runtime_representation } }) @@ -499,7 +499,7 @@ mod tests { // Create a variable read expression let var_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("myVar"), source_span: None }, - &allocator, + &&allocator, )); collector.visit_expression(&var_expr); @@ -521,7 +521,7 @@ mod tests { }, source_span: None, }, - &allocator, + &&allocator, )); collector.visit_expression(&external_expr); @@ -545,7 +545,7 @@ mod tests { }, source_span: None, }, - &allocator, + &&allocator, )); let expr2 = OutputExpression::External(Box::new_in( @@ -556,7 +556,7 @@ mod tests { }, source_span: None, }, - &allocator, + &&allocator, )); collector.visit_expression(&expr1); @@ -580,7 +580,7 @@ mod tests { }, source_span: None, }, - &allocator, + &&allocator, )); let expr2 = OutputExpression::External(Box::new_in( @@ -591,7 +591,7 @@ mod tests { }, source_span: None, }, - &allocator, + &&allocator, )); collector.visit_expression(&expr1); @@ -613,7 +613,7 @@ mod tests { for name in ["MyService", "localVar", "AppComponent", "helperFn"] { let expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(name), source_span: None }, - &allocator, + &&allocator, )); collector.visit_expression(&expr); } @@ -648,7 +648,7 @@ mod tests { }, source_span: None, }, - &allocator, + &&allocator, )); // Top-level symbols diff --git a/crates/oxc_angular_compiler/src/hmr/initializer.rs b/crates/oxc_angular_compiler/src/hmr/initializer.rs index 64f6adce6..6cf993c75 100644 --- a/crates/oxc_angular_compiler/src/hmr/initializer.rs +++ b/crates/oxc_angular_compiler/src/hmr/initializer.rs @@ -46,13 +46,13 @@ pub fn compile_hmr_initializer<'a>( // Use the assigned_name (e.g., "i0") as a variable reference read_var(allocator, &dep.assigned_name) }), - allocator, + &allocator, ); // Build local dependencies array let locals: Vec<'a, OutputExpression<'a>> = Vec::from_iter_in( meta.local_dependencies.iter().map(|l| l.runtime_representation.clone_in(allocator)), - allocator, + &allocator, ); // m.default @@ -60,7 +60,7 @@ pub fn compile_hmr_initializer<'a>( // i0.ɵɵreplaceMetadata(Comp, m.default, [...namespaces], [...locals], import.meta, id) let replace_call = invoke_fn( - allocator, + &allocator, read_prop(allocator, read_var(allocator, "i0"), Identifiers::REPLACE_METADATA), vec![ meta.component_type.clone_in(allocator), @@ -75,25 +75,25 @@ pub fn compile_hmr_initializer<'a>( // (m) => m.default && ɵɵreplaceMetadata(...) let replace_callback = OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { - params: Vec::from_iter_in([FnParam { name: Ident::from(module_name) }], allocator), + params: Vec::from_iter_in([FnParam { name: Ident::from(module_name) }], &allocator), body: ArrowFunctionBody::Expression(Box::new_in( binary_op(allocator, BinaryOperator::And, default_read, replace_call), - allocator, + &allocator, )), source_span: None, }, - allocator, + &allocator, )); // i0.ɵɵgetReplaceMetadataURL(id, timestamp, import.meta.url) let url = invoke_fn( - allocator, + &allocator, read_prop(allocator, read_var(allocator, "i0"), Identifiers::GET_REPLACE_METADATA_URL), vec![ read_var(allocator, id_name), read_var(allocator, timestamp_name), read_prop( - allocator, + &allocator, read_prop(allocator, read_var(allocator, "import"), "meta"), "url", ), @@ -103,11 +103,11 @@ pub fn compile_hmr_initializer<'a>( // import(/* @vite-ignore */ url).then((m) => ...) let dynamic_import = OutputExpression::DynamicImport(Box::new_in( DynamicImportExpr { - url: DynamicImportUrl::Expression(Box::new_in(url, allocator)), + url: DynamicImportUrl::Expression(Box::new_in(url, &allocator)), url_comment: Some(Ident::from("@vite-ignore")), source_span: None, }, - allocator, + &allocator, )); let import_then_call = @@ -117,47 +117,47 @@ pub fn compile_hmr_initializer<'a>( let import_callback = OutputStatement::DeclareFunction(Box::new_in( DeclareFunctionStmt { name: Ident::from(allocator.alloc_str(&import_callback_name)), - params: Vec::from_iter_in([FnParam { name: Ident::from(timestamp_name) }], allocator), - statements: Vec::from_iter_in([expr_stmt(allocator, import_then_call)], allocator), + params: Vec::from_iter_in([FnParam { name: Ident::from(timestamp_name) }], &allocator), + statements: Vec::from_iter_in([expr_stmt(allocator, import_then_call)], &allocator), modifiers: StmtModifier::FINAL, source_span: None, }, - allocator, + &allocator, )); // (d) => d.id === id && Cmp_HmrLoad(d.timestamp) let update_callback = OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { - params: Vec::from_iter_in([FnParam { name: Ident::from(data_name) }], allocator), + params: Vec::from_iter_in([FnParam { name: Ident::from(data_name) }], &allocator), body: ArrowFunctionBody::Expression(Box::new_in( binary_op( - allocator, + &allocator, BinaryOperator::And, binary_op( - allocator, + &allocator, BinaryOperator::Identical, read_prop(allocator, read_var(allocator, data_name), "id"), read_var(allocator, id_name), ), invoke_fn( - allocator, + &allocator, read_var(allocator, &import_callback_name), vec![read_prop(allocator, read_var(allocator, data_name), "timestamp")], ), ), - allocator, + &allocator, )), source_span: None, }, - allocator, + &allocator, )); // Cmp_HmrLoad(Date.now()) let initial_call = invoke_fn( - allocator, + &allocator, read_var(allocator, &import_callback_name), vec![invoke_fn( - allocator, + &allocator, read_prop(allocator, read_var(allocator, "Date"), "now"), vec![], )], @@ -169,7 +169,7 @@ pub fn compile_hmr_initializer<'a>( // import.meta.hot.on('angular:component-update', updateCallback) let hot_listener = invoke_fn( - allocator, + &allocator, read_prop(allocator, hot_read.clone_in(allocator), "on"), vec![literal_str(allocator, "angular:component-update"), update_callback], ); @@ -178,33 +178,33 @@ pub fn compile_hmr_initializer<'a>( // Handles the angular:invalidate event sent when HMR fails let invalidate_callback = OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { - params: Vec::from_iter_in([FnParam { name: Ident::from(data_name) }], allocator), + params: Vec::from_iter_in([FnParam { name: Ident::from(data_name) }], &allocator), body: ArrowFunctionBody::Expression(Box::new_in( binary_op( - allocator, + &allocator, BinaryOperator::And, binary_op( - allocator, + &allocator, BinaryOperator::Identical, read_prop(allocator, read_var(allocator, data_name), "id"), read_var(allocator, id_name), ), invoke_fn( - allocator, + &allocator, read_prop(allocator, read_var(allocator, "location"), "reload"), vec![], ), ), - allocator, + &allocator, )), source_span: None, }, - allocator, + &allocator, )); // import.meta.hot.on('angular:invalidate', invalidateCallback) let invalidate_listener = invoke_fn( - allocator, + &allocator, read_prop(allocator, hot_read.clone_in(allocator), "on"), vec![literal_str(allocator, "angular:invalidate"), invalidate_callback], ); @@ -226,33 +226,33 @@ pub fn compile_hmr_initializer<'a>( // The empty callback means we handle updates via custom events, not accept() itself let empty_callback = OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { - params: Vec::new_in(allocator), - body: ArrowFunctionBody::Statements(Vec::new_in(allocator)), + params: Vec::new_in(&allocator), + body: ArrowFunctionBody::Statements(Vec::new_in(&allocator)), source_span: None, }, - allocator, + &allocator, )); let hot_accept = invoke_fn( - allocator, + &allocator, read_prop(allocator, hot_read.clone_in(allocator), "accept"), vec![empty_callback], ); // ngDevMode && import.meta.hot && import.meta.hot.accept(() => {}) let guarded_accept = dev_only_guarded( - allocator, + &allocator, binary_op(allocator, BinaryOperator::And, hot_read.clone_in(allocator), hot_accept), ); // ngDevMode && import.meta.hot && import.meta.hot.on('angular:component-update', ...) let guarded_listener = dev_only_guarded( - allocator, + &allocator, binary_op(allocator, BinaryOperator::And, hot_read.clone_in(allocator), hot_listener), ); // ngDevMode && import.meta.hot && import.meta.hot.on('angular:invalidate', ...) let guarded_invalidate_listener = dev_only_guarded( - allocator, + &allocator, binary_op(allocator, BinaryOperator::And, hot_read, invalidate_listener), ); @@ -266,16 +266,16 @@ pub fn compile_hmr_initializer<'a>( expr_stmt(allocator, guarded_listener), expr_stmt(allocator, guarded_invalidate_listener), ], - allocator, + &allocator, ); let iife = OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { - params: Vec::new_in(allocator), + params: Vec::new_in(&allocator), body: ArrowFunctionBody::Statements(body), source_span: None, }, - allocator, + &allocator, )); // Call the IIFE @@ -316,14 +316,14 @@ pub fn compile_hmr_update_callback<'a>( let namespaces_param = "ɵɵnamespaces"; // Build function parameters: [className, ɵɵnamespaces, ...locals] - let mut params: Vec<'a, FnParam<'a>> = Vec::new_in(allocator); + let mut params: Vec<'a, FnParam<'a>> = Vec::new_in(&allocator); params.push(FnParam { name: meta.class_name.clone() }); params.push(FnParam { name: Ident::from(namespaces_param) }); for local in &meta.local_dependencies { params.push(FnParam { name: local.name.clone() }); } - let mut body: Vec<'a, OutputStatement<'a>> = Vec::new_in(allocator); + let mut body: Vec<'a, OutputStatement<'a>> = Vec::new_in(&allocator); // Declare variables that read out the individual namespaces // const i0 = ɵɵnamespaces[0]; @@ -331,12 +331,12 @@ pub fn compile_hmr_update_callback<'a>( for (i, dep) in meta.namespace_dependencies.iter().enumerate() { let namespace_read = OutputExpression::ReadKey(Box::new_in( ReadKeyExpr { - receiver: Box::new_in(read_var(allocator, namespaces_param), allocator), - index: Box::new_in(literal_num(allocator, i as f64), allocator), + receiver: Box::new_in(read_var(allocator, namespaces_param), &allocator), + index: Box::new_in(literal_num(allocator, i as f64), &allocator), optional: false, source_span: None, }, - allocator, + &allocator, )); body.push(var_decl(allocator, dep.assigned_name.as_str(), namespace_read, true)); } @@ -350,10 +350,10 @@ pub fn compile_hmr_update_callback<'a>( for def in definitions { if let Some(initializer) = def.initializer { let assignment = binary_op( - allocator, + &allocator, BinaryOperator::Assign, read_prop( - allocator, + &allocator, read_var(allocator, meta.class_name.as_str()), def.name.as_str(), ), @@ -378,7 +378,7 @@ pub fn compile_hmr_update_callback<'a>( modifiers: StmtModifier::FINAL, source_span: None, }, - allocator, + &allocator, )) } @@ -390,7 +390,7 @@ pub fn compile_hmr_update_callback<'a>( fn read_var<'a>(allocator: &'a Allocator, name: &str) -> OutputExpression<'a> { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(allocator.alloc_str(name)), source_span: None }, - allocator, + &allocator, )) } @@ -402,12 +402,12 @@ fn read_prop<'a>( ) -> OutputExpression<'a> { OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(receiver, allocator), + receiver: Box::new_in(receiver, &allocator), name: Ident::from(allocator.alloc_str(name)), optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -419,13 +419,13 @@ fn invoke_fn<'a>( ) -> OutputExpression<'a> { OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(fn_expr, allocator), - args: Vec::from_iter_in(args, allocator), + fn_expr: Box::new_in(fn_expr, &allocator), + args: Vec::from_iter_in(args, &allocator), pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -436,7 +436,7 @@ fn literal_str<'a>(allocator: &'a Allocator, value: &str) -> OutputExpression<'a value: LiteralValue::String(Ident::from(allocator.alloc_str(value))), source_span: None, }, - allocator, + &allocator, )) } @@ -444,7 +444,7 @@ fn literal_str<'a>(allocator: &'a Allocator, value: &str) -> OutputExpression<'a fn literal_num<'a>(allocator: &'a Allocator, value: f64) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(value), source_span: None }, - allocator, + &allocator, )) } @@ -455,7 +455,7 @@ fn literal_arr<'a>( ) -> OutputExpression<'a> { OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: None }, - allocator, + &allocator, )) } @@ -469,11 +469,11 @@ fn binary_op<'a>( OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: op, - lhs: Box::new_in(lhs, allocator), - rhs: Box::new_in(rhs, allocator), + lhs: Box::new_in(lhs, &allocator), + rhs: Box::new_in(rhs, &allocator), source_span: None, }, - allocator, + &allocator, )) } @@ -493,7 +493,7 @@ fn var_decl<'a>( source_span: None, leading_comment: None, }, - allocator, + &allocator, )) } @@ -501,7 +501,7 @@ fn var_decl<'a>( fn expr_stmt<'a>(allocator: &'a Allocator, expr: OutputExpression<'a>) -> OutputStatement<'a> { OutputStatement::Expression(Box::new_in( ExpressionStatement { expr, source_span: None }, - allocator, + &allocator, )) } @@ -524,15 +524,15 @@ fn dev_only_guarded<'a>( // typeof ngDevMode let typeof_guard = OutputExpression::Typeof(Box::new_in( TypeofExpr { - expr: Box::new_in(guard_var.clone_in(allocator), allocator), + expr: Box::new_in(guard_var.clone_in(allocator), &allocator), source_span: None, }, - allocator, + &allocator, )); // typeof ngDevMode === "undefined" let guard_not_defined = binary_op( - allocator, + &allocator, BinaryOperator::Identical, typeof_guard, literal_str(allocator, "undefined"), diff --git a/crates/oxc_angular_compiler/src/i18n/parser.rs b/crates/oxc_angular_compiler/src/i18n/parser.rs index 109b3f5b3..ce9bbd834 100644 --- a/crates/oxc_angular_compiler/src/i18n/parser.rs +++ b/crates/oxc_angular_compiler/src/i18n/parser.rs @@ -861,10 +861,10 @@ mod tests { value: Ident::from("Hello {{name}}!"), span: Span::default(), full_start: None, - tokens: AllocVec::new_in(&allocator), + tokens: AllocVec::new_in(&&allocator), }; - let nodes = vec![HtmlNode::Text(Box::new_in(text, &allocator))]; + let nodes = vec![HtmlNode::Text(Box::new_in(text, &&allocator))]; let source_file = Arc::new(ParseSourceFile::new("Hello {{name}}!", "")); let message = factory.create_message(&nodes, None, None, None, None, source_file); @@ -892,10 +892,10 @@ mod tests { value: Ident::from("Hello World"), span: Span::default(), full_start: None, - tokens: AllocVec::new_in(&allocator), + tokens: AllocVec::new_in(&&allocator), }; - let nodes = vec![HtmlNode::Text(Box::new_in(text, &allocator))]; + let nodes = vec![HtmlNode::Text(Box::new_in(text, &&allocator))]; let source_file = Arc::new(ParseSourceFile::new("Hello World", "")); let message = factory.create_message(&nodes, None, None, None, None, source_file); @@ -913,10 +913,10 @@ mod tests { value: Ident::from("{{greeting}} {{name}}!"), span: Span::default(), full_start: None, - tokens: AllocVec::new_in(&allocator), + tokens: AllocVec::new_in(&&allocator), }; - let nodes = vec![HtmlNode::Text(Box::new_in(text, &allocator))]; + let nodes = vec![HtmlNode::Text(Box::new_in(text, &&allocator))]; let source_file = Arc::new(ParseSourceFile::new("{{greeting}} {{name}}!", "")); let message = factory.create_message(&nodes, None, None, None, None, source_file); diff --git a/crates/oxc_angular_compiler/src/injectable/compiler.rs b/crates/oxc_angular_compiler/src/injectable/compiler.rs index 83cc6fec8..7d7a70968 100644 --- a/crates/oxc_angular_compiler/src/injectable/compiler.rs +++ b/crates/oxc_angular_compiler/src/injectable/compiler.rs @@ -60,7 +60,7 @@ pub fn compile_injectable_from_metadata<'a>( // Create the expression: ɵɵdefineInjectable(definitionMap) let expression = create_define_injectable_call(allocator, definition_map); - InjectableCompileResult { expression, statements: Vec::new_in(allocator) } + InjectableCompileResult { expression, statements: Vec::new_in(&allocator) } } /// Builds the factory expression based on the provider type. @@ -82,7 +82,7 @@ fn build_factory_expression<'a>( type_expr: metadata.r#type.clone_in(allocator), type_decl: metadata.r#type.clone_in(allocator), type_argument_count: metadata.type_argument_count, - deps: R3FactoryDeps::Valid(Vec::new_in(allocator)), // Empty deps for base + deps: R3FactoryDeps::Valid(Vec::new_in(&allocator)), // Empty deps for base target: FactoryTarget::Injectable, }; @@ -179,7 +179,7 @@ fn clone_deps_vec<'a>( allocator: &'a Allocator, deps: &[R3DependencyMetadata<'a>], ) -> Vec<'a, R3DependencyMetadata<'a>> { - let mut result = Vec::with_capacity_in(deps.len(), allocator); + let mut result = Vec::with_capacity_in(deps.len(), &allocator); for dep in deps { result.push(R3DependencyMetadata { token: dep.token.as_ref().map(|t| t.clone_in(allocator)), @@ -207,29 +207,29 @@ fn create_inject_call<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(Identifiers::RESOLVE_FORWARD_REF), optional: false, source_span: None, }, - allocator, + &allocator, )); - let mut resolve_args = Vec::new_in(allocator); + let mut resolve_args = Vec::new_in(&allocator); resolve_args.push(existing.clone_in(allocator)); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(resolve_fn, allocator), + fn_expr: Box::new_in(resolve_fn, &allocator), args: resolve_args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } else { existing.clone_in(allocator) @@ -241,29 +241,29 @@ fn create_inject_call<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(Identifiers::INJECT), optional: false, source_span: None, }, - allocator, + &allocator, )); - let mut inject_args = Vec::new_in(allocator); + let mut inject_args = Vec::new_in(&allocator); inject_args.push(token_expr); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(inject_fn, allocator), + fn_expr: Box::new_in(inject_fn, &allocator), args: inject_args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -274,12 +274,12 @@ fn create_factory_delegation<'a>( ) -> OutputExpression<'a> { OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(type_expr.clone_in(allocator), allocator), + receiver: Box::new_in(type_expr.clone_in(allocator), &allocator), name: Ident::from("ɵfac"), optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -289,7 +289,7 @@ fn create_forward_ref_factory<'a>( type_expr: &OutputExpression<'a>, ) -> OutputExpression<'a> { let param_name = Ident::from("t"); - let mut params = Vec::new_in(allocator); + let mut params = Vec::new_in(&allocator); params.push(FnParam { name: param_name.clone() }); // resolveForwardRef(Type) @@ -298,70 +298,70 @@ fn create_forward_ref_factory<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(Identifiers::RESOLVE_FORWARD_REF), optional: false, source_span: None, }, - allocator, + &allocator, )); - let mut resolve_args = Vec::new_in(allocator); + let mut resolve_args = Vec::new_in(&allocator); resolve_args.push(type_expr.clone_in(allocator)); let resolved_type = OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(resolve_fn, allocator), + fn_expr: Box::new_in(resolve_fn, &allocator), args: resolve_args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )); // resolveForwardRef(Type).ɵfac let fac_access = OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(resolved_type, allocator), + receiver: Box::new_in(resolved_type, &allocator), name: Ident::from("ɵfac"), optional: false, source_span: None, }, - allocator, + &allocator, )); // resolveForwardRef(Type).ɵfac(t) - let mut call_args = Vec::new_in(allocator); + let mut call_args = Vec::new_in(&allocator); call_args.push(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: param_name, source_span: None }, - allocator, + &allocator, ))); let fac_call = OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(fac_access, allocator), + fn_expr: Box::new_in(fac_access, &allocator), args: call_args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )); // Create the arrow function - let mut body = Vec::new_in(allocator); + let mut body = Vec::new_in(&allocator); body.push(OutputStatement::Return(Box::new_in( ReturnStatement { value: fac_call, source_span: None }, - allocator, + &allocator, ))); OutputExpression::Function(Box::new_in( FunctionExpr { name: None, params, statements: body, source_span: None }, - allocator, + &allocator, )) } @@ -370,29 +370,29 @@ fn create_use_factory_wrapper<'a>( allocator: &'a Allocator, factory: &OutputExpression<'a>, ) -> OutputExpression<'a> { - let params = Vec::new_in(allocator); + let params = Vec::new_in(&allocator); // factory() let factory_call = OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(factory.clone_in(allocator), allocator), - args: Vec::new_in(allocator), + fn_expr: Box::new_in(factory.clone_in(allocator), &allocator), + args: Vec::new_in(&allocator), pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )); - let mut body = Vec::new_in(allocator); + let mut body = Vec::new_in(&allocator); body.push(OutputStatement::Return(Box::new_in( ReturnStatement { value: factory_call, source_span: None }, - allocator, + &allocator, ))); OutputExpression::Function(Box::new_in( FunctionExpr { name: None, params, statements: body, source_span: None }, - allocator, + &allocator, )) } @@ -402,7 +402,7 @@ fn build_definition_map<'a>( metadata: &R3InjectableMetadata<'a>, factory_expr: OutputExpression<'a>, ) -> Vec<'a, LiteralMapEntry<'a>> { - let mut entries = Vec::new_in(allocator); + let mut entries = Vec::new_in(&allocator); // token: MyService entries.push(LiteralMapEntry::new( @@ -424,7 +424,7 @@ fn build_definition_map<'a>( value: LiteralValue::String(Ident::from("root")), source_span: None, }, - allocator, + &allocator, )), false, )); @@ -437,7 +437,7 @@ fn build_definition_map<'a>( value: LiteralValue::String(Ident::from("platform")), source_span: None, }, - allocator, + &allocator, )), false, )); @@ -450,7 +450,7 @@ fn build_definition_map<'a>( value: LiteralValue::String(Ident::from("any")), source_span: None, }, - allocator, + &allocator, )), false, )); @@ -481,36 +481,36 @@ fn create_define_injectable_call<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(Identifiers::DEFINE_INJECTABLE), optional: false, source_span: None, }, - allocator, + &allocator, )); // Create the literal map expression let map_expr = OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries: definition_map, source_span: None }, - allocator, + &allocator, )); // Create the function call - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(map_expr); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(define_injectable_fn, allocator), + fn_expr: Box::new_in(define_injectable_fn, &allocator), args, pure: true, // Pure function for tree-shaking optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -525,7 +525,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("MyService"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3InjectableMetadataBuilder::new() @@ -550,14 +550,14 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("CONFIG_TOKEN"), source_span: None }, - &allocator, + &&allocator, )); let value_expr = OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(Ident::from("config_value")), source_span: None, }, - &allocator, + &&allocator, )); let metadata = R3InjectableMetadataBuilder::new() @@ -582,11 +582,11 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("AliasService"), source_span: None }, - &allocator, + &&allocator, )); let existing_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("RealService"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3InjectableMetadataBuilder::new() @@ -610,7 +610,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("LocalService"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3InjectableMetadataBuilder::new() @@ -646,19 +646,19 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("CipherService"), source_span: None }, - &allocator, + &&allocator, )); let factory_fn = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("cipherServiceFactory"), source_span: None }, - &allocator, + &&allocator, )); // Create dependency metadata - let mut deps = Vec::new_in(&allocator); + let mut deps = Vec::new_in(&&allocator); deps.push(R3DependencyMetadata { token: Some(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("LogService"), source_span: None }, - &allocator, + &&allocator, ))), attribute_name_type: None, host: false, @@ -704,19 +704,19 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("BaseService"), source_span: None }, - &allocator, + &&allocator, )); let class_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("ConcreteService"), source_span: None }, - &allocator, + &&allocator, )); // Create dependency metadata - let mut deps = Vec::new_in(&allocator); + let mut deps = Vec::new_in(&&allocator); deps.push(R3DependencyMetadata { token: Some(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("DepService"), source_span: None }, - &allocator, + &&allocator, ))), attribute_name_type: None, host: false, diff --git a/crates/oxc_angular_compiler/src/injectable/decorator.rs b/crates/oxc_angular_compiler/src/injectable/decorator.rs index 95ddfe5f3..14f86a6c8 100644 --- a/crates/oxc_angular_compiler/src/injectable/decorator.rs +++ b/crates/oxc_angular_compiler/src/injectable/decorator.rs @@ -112,7 +112,7 @@ impl<'a> InjectableMetadata<'a> { let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: self.class_name.clone(), source_span: None }, - allocator, + &allocator, )); let mut builder = @@ -172,7 +172,7 @@ fn clone_r3_deps<'a>( allocator: &'a Allocator, deps: &[R3DependencyMetadata<'a>], ) -> Vec<'a, R3DependencyMetadata<'a>> { - let mut result = Vec::with_capacity_in(deps.len(), allocator); + let mut result = Vec::with_capacity_in(deps.len(), &allocator); for dep in deps { result.push(R3DependencyMetadata { token: dep.token.as_ref().map(|t| t.clone_in(allocator)), @@ -191,7 +191,7 @@ fn convert_deps_to_r3<'a>( allocator: &'a Allocator, deps: &[DependencyMetadata<'a>], ) -> oxc_allocator::Vec<'a, crate::factory::R3DependencyMetadata<'a>> { - let mut result = oxc_allocator::Vec::new_in(allocator); + let mut result = oxc_allocator::Vec::new_in(&allocator); for dep in deps { result.push(crate::factory::R3DependencyMetadata { token: Some(dep.token.clone_in(allocator)), @@ -443,7 +443,7 @@ fn extract_forward_ref_or_expression<'a>( arrow.body.statements.first() { if let Some(expression) = convert_oxc_expression( - allocator, + &allocator, &expr_stmt.expression, source_text, ) { @@ -463,7 +463,7 @@ fn extract_deps_from_config<'a>( config_obj: &'a oxc_ast::ast::ObjectExpression<'a>, source_text: Option<&'a str>, ) -> Vec<'a, DependencyMetadata<'a>> { - let mut deps = Vec::new_in(allocator); + let mut deps = Vec::new_in(&allocator); for prop in &config_obj.properties { if let ObjectPropertyKind::ObjectProperty(prop) = prop { @@ -546,7 +546,7 @@ pub fn extract_constructor_deps<'a>( // Get the constructor's parameters let params = &constructor.value.params; - let mut deps = Vec::with_capacity_in(params.items.len(), allocator); + let mut deps = Vec::with_capacity_in(params.items.len(), &allocator); for param in ¶ms.items { let dep = extract_param_dependency(allocator, param, source_text); @@ -612,7 +612,7 @@ fn extract_param_dependency<'a>( value: crate::output::ast::LiteralValue::String(attr_name), source_span: None, }, - allocator, + &allocator, ))), attribute_name_type: token, // The type annotation host, @@ -675,7 +675,7 @@ fn extract_param_token<'a>( return Some(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: type_name, source_span: None }, - allocator, + &allocator, ))); } diff --git a/crates/oxc_angular_compiler/src/injectable/definition.rs b/crates/oxc_angular_compiler/src/injectable/definition.rs index 235fda750..4fb42876d 100644 --- a/crates/oxc_angular_compiler/src/injectable/definition.rs +++ b/crates/oxc_angular_compiler/src/injectable/definition.rs @@ -155,7 +155,7 @@ fn generate_fac_definition<'a>( Some(deps) => { // Clone deps to new allocator-owned vec let mut factory_deps: OxcVec<'a, R3DependencyMetadata<'a>> = - OxcVec::with_capacity_in(deps.len(), allocator); + OxcVec::with_capacity_in(deps.len(), &allocator); for dep in deps { factory_deps.push(R3DependencyMetadata { token: dep.token.as_ref().map(|t| t.clone_in(allocator)), @@ -227,7 +227,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("MyService"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3InjectableMetadataBuilder::new() @@ -260,7 +260,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("LocalService"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3InjectableMetadataBuilder::new() @@ -286,7 +286,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("PlatformService"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3InjectableMetadataBuilder::new() @@ -310,7 +310,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("AnyService"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3InjectableMetadataBuilder::new() @@ -337,7 +337,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("TreeShakableService"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3InjectableMetadataBuilder::new() diff --git a/crates/oxc_angular_compiler/src/injector/compiler.rs b/crates/oxc_angular_compiler/src/injector/compiler.rs index 5651d191f..de7f709b2 100644 --- a/crates/oxc_angular_compiler/src/injector/compiler.rs +++ b/crates/oxc_angular_compiler/src/injector/compiler.rs @@ -51,7 +51,7 @@ pub fn compile_injector_from_metadata<'a>( // Create the expression: ɵɵdefineInjector(definitionMap) let expression = create_define_injector_call(allocator, definition_map); - InjectorCompileResult { expression, statements: Vec::new_in(allocator) } + InjectorCompileResult { expression, statements: Vec::new_in(&allocator) } } /// Builds the definition map for the injector. @@ -59,7 +59,7 @@ fn build_definition_map<'a>( allocator: &'a Allocator, metadata: &R3InjectorMetadata<'a>, ) -> Vec<'a, LiteralMapEntry<'a>> { - let mut entries = Vec::new_in(allocator); + let mut entries = Vec::new_in(&allocator); // providers: [...] (only if present) if let Some(providers) = &metadata.providers { @@ -76,13 +76,13 @@ fn build_definition_map<'a>( let imports_value = if let Some(raw_imports) = &metadata.raw_imports { raw_imports.clone_in(allocator) } else { - let mut imports_items = Vec::new_in(allocator); + let mut imports_items = Vec::new_in(&allocator); for import in &metadata.imports { imports_items.push(import.clone_in(allocator)); } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: imports_items, source_span: None }, - allocator, + &allocator, )) }; @@ -103,36 +103,36 @@ fn create_define_injector_call<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(Identifiers::DEFINE_INJECTOR), optional: false, source_span: None, }, - allocator, + &allocator, )); // Create the literal map expression let map_expr = OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries: definition_map, source_span: None }, - allocator, + &allocator, )); // Create the function call - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(map_expr); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(define_injector_fn, allocator), + fn_expr: Box::new_in(define_injector_fn, &allocator), args, pure: true, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -147,7 +147,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("MyModule"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3InjectorMetadataBuilder::new(&allocator) @@ -169,12 +169,12 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("ProviderModule"), source_span: None }, - &allocator, + &&allocator, )); let providers_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("PROVIDERS"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3InjectorMetadataBuilder::new(&allocator) @@ -198,16 +198,16 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("ImportModule"), source_span: None }, - &allocator, + &&allocator, )); let import1 = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("CommonModule"), source_span: None }, - &allocator, + &&allocator, )); let import2 = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("FormsModule"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3InjectorMetadataBuilder::new(&allocator) @@ -233,7 +233,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("EmptyModule"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3InjectorMetadataBuilder::new(&allocator) diff --git a/crates/oxc_angular_compiler/src/injector/metadata.rs b/crates/oxc_angular_compiler/src/injector/metadata.rs index b8611b855..04f3bee3a 100644 --- a/crates/oxc_angular_compiler/src/injector/metadata.rs +++ b/crates/oxc_angular_compiler/src/injector/metadata.rs @@ -60,7 +60,7 @@ impl<'a> R3InjectorMetadataBuilder<'a> { name: None, r#type: None, providers: None, - imports: Vec::new_in(allocator), + imports: Vec::new_in(&allocator), raw_imports: None, } } diff --git a/crates/oxc_angular_compiler/src/ir/expression.rs b/crates/oxc_angular_compiler/src/ir/expression.rs index 8eb6aa385..27bcb02b4 100644 --- a/crates/oxc_angular_compiler/src/ir/expression.rs +++ b/crates/oxc_angular_compiler/src/ir/expression.rs @@ -278,12 +278,12 @@ impl<'a> IrExpression<'a> { impl<'a> IrExpression<'a> { /// Creates a new Ast expression wrapping an AngularExpression. pub fn from_ast(allocator: &'a oxc_allocator::Allocator, expr: AngularExpression<'a>) -> Self { - IrExpression::Ast(Box::new_in(expr, allocator)) + IrExpression::Ast(Box::new_in(expr, &allocator)) } /// Creates a new Empty expression. pub fn empty(allocator: &'a oxc_allocator::Allocator, source_span: Option) -> Self { - IrExpression::Empty(Box::new_in(EmptyExpr { source_span }, allocator)) + IrExpression::Empty(Box::new_in(EmptyExpr { source_span }, &allocator)) } /// Returns true if this is an empty expression. @@ -322,7 +322,7 @@ impl<'a> IrExpression<'a> { match self { IrExpression::LexicalRead(e) => IrExpression::LexicalRead(Box::new_in( LexicalReadExpr { name: e.name.clone(), source_span: e.source_span }, - allocator, + &allocator, )), IrExpression::Reference(e) => IrExpression::Reference(Box::new_in( ReferenceExpr { @@ -331,48 +331,48 @@ impl<'a> IrExpression<'a> { offset: e.offset, source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::Context(e) => IrExpression::Context(Box::new_in( ContextExpr { view: e.view, source_span: e.source_span }, - allocator, + &allocator, )), IrExpression::NextContext(e) => IrExpression::NextContext(Box::new_in( NextContextExpr { steps: e.steps, source_span: e.source_span }, - allocator, + &allocator, )), IrExpression::GetCurrentView(e) => IrExpression::GetCurrentView(Box::new_in( GetCurrentViewExpr { source_span: e.source_span }, - allocator, + &allocator, )), IrExpression::RestoreView(e) => IrExpression::RestoreView(Box::new_in( RestoreViewExpr { view: match &e.view { RestoreViewTarget::Static(xref) => RestoreViewTarget::Static(*xref), RestoreViewTarget::Dynamic(expr) => RestoreViewTarget::Dynamic( - Box::new_in(expr.clone_in(allocator), allocator), + Box::new_in(expr.clone_in(allocator), &allocator), ), }, source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::ResetView(e) => IrExpression::ResetView(Box::new_in( ResetViewExpr { - expr: Box::new_in(e.expr.clone_in(allocator), allocator), + expr: Box::new_in(e.expr.clone_in(allocator), &allocator), source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::ReadVariable(e) => IrExpression::ReadVariable(Box::new_in( ReadVariableExpr { xref: e.xref, name: e.name.clone(), source_span: e.source_span }, - allocator, + &allocator, )), IrExpression::PureFunction(e) => { - let body = e.body.as_ref().map(|b| Box::new_in(b.clone_in(allocator), allocator)); + let body = e.body.as_ref().map(|b| Box::new_in(b.clone_in(allocator), &allocator)); let fn_ref = - e.fn_ref.as_ref().map(|f| Box::new_in(f.clone_in(allocator), allocator)); - let mut args = Vec::with_capacity_in(e.args.len(), allocator); + e.fn_ref.as_ref().map(|f| Box::new_in(f.clone_in(allocator), &allocator)); + let mut args = Vec::with_capacity_in(e.args.len(), &allocator); for arg in e.args.iter() { args.push(arg.clone_in(allocator)); } @@ -384,17 +384,17 @@ impl<'a> IrExpression<'a> { var_offset: e.var_offset, source_span: e.source_span, }, - allocator, + &allocator, )) } IrExpression::PureFunctionParameter(e) => { IrExpression::PureFunctionParameter(Box::new_in( PureFunctionParameterExpr { index: e.index, source_span: e.source_span }, - allocator, + &allocator, )) } IrExpression::PipeBinding(e) => { - let mut args = Vec::with_capacity_in(e.args.len(), allocator); + let mut args = Vec::with_capacity_in(e.args.len(), &allocator); for arg in e.args.iter() { args.push(arg.clone_in(allocator)); } @@ -407,7 +407,7 @@ impl<'a> IrExpression<'a> { var_offset: e.var_offset, source_span: e.source_span, }, - allocator, + &allocator, )) } IrExpression::PipeBindingVariadic(e) => IrExpression::PipeBindingVariadic(Box::new_in( @@ -415,63 +415,63 @@ impl<'a> IrExpression<'a> { target: e.target, target_slot: e.target_slot, name: e.name.clone(), - args: Box::new_in(e.args.clone_in(allocator), allocator), + args: Box::new_in(e.args.clone_in(allocator), &allocator), num_args: e.num_args, var_offset: e.var_offset, source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::SafePropertyRead(e) => IrExpression::SafePropertyRead(Box::new_in( SafePropertyReadExpr { - receiver: Box::new_in(e.receiver.clone_in(allocator), allocator), + receiver: Box::new_in(e.receiver.clone_in(allocator), &allocator), name: e.name.clone(), source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::SafeKeyedRead(e) => IrExpression::SafeKeyedRead(Box::new_in( SafeKeyedReadExpr { - receiver: Box::new_in(e.receiver.clone_in(allocator), allocator), - index: Box::new_in(e.index.clone_in(allocator), allocator), + receiver: Box::new_in(e.receiver.clone_in(allocator), &allocator), + index: Box::new_in(e.index.clone_in(allocator), &allocator), source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::SafeInvokeFunction(e) => { - let mut args = Vec::with_capacity_in(e.args.len(), allocator); + let mut args = Vec::with_capacity_in(e.args.len(), &allocator); for arg in e.args.iter() { args.push(arg.clone_in(allocator)); } IrExpression::SafeInvokeFunction(Box::new_in( SafeInvokeFunctionExpr { - receiver: Box::new_in(e.receiver.clone_in(allocator), allocator), + receiver: Box::new_in(e.receiver.clone_in(allocator), &allocator), args, source_span: e.source_span, }, - allocator, + &allocator, )) } IrExpression::SafeTernary(e) => IrExpression::SafeTernary(Box::new_in( SafeTernaryExpr { - guard: Box::new_in(e.guard.clone_in(allocator), allocator), - expr: Box::new_in(e.expr.clone_in(allocator), allocator), + guard: Box::new_in(e.guard.clone_in(allocator), &allocator), + expr: Box::new_in(e.expr.clone_in(allocator), &allocator), source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::Empty(e) => IrExpression::Empty(Box::new_in( EmptyExpr { source_span: e.source_span }, - allocator, + &allocator, )), IrExpression::AssignTemporary(e) => IrExpression::AssignTemporary(Box::new_in( AssignTemporaryExpr { - expr: Box::new_in(e.expr.clone_in(allocator), allocator), + expr: Box::new_in(e.expr.clone_in(allocator), &allocator), xref: e.xref, name: e.name.clone(), source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::ReadTemporary(e) => IrExpression::ReadTemporary(Box::new_in( ReadTemporaryExpr { @@ -479,7 +479,7 @@ impl<'a> IrExpression<'a> { name: e.name.clone(), source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::SlotLiteral(e) => IrExpression::SlotLiteral(Box::new_in( SlotLiteralExpr { @@ -487,36 +487,36 @@ impl<'a> IrExpression<'a> { target_xref: e.target_xref, source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::ConditionalCase(e) => IrExpression::ConditionalCase(Box::new_in( ConditionalCaseExpr { - expr: e.expr.as_ref().map(|ex| Box::new_in(ex.clone_in(allocator), allocator)), + expr: e.expr.as_ref().map(|ex| Box::new_in(ex.clone_in(allocator), &allocator)), target: e.target, target_slot: e.target_slot, alias: e.alias.clone(), source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::ConstCollected(e) => IrExpression::ConstCollected(Box::new_in( ConstCollectedExpr { - expr: Box::new_in(e.expr.clone_in(allocator), allocator), + expr: Box::new_in(e.expr.clone_in(allocator), &allocator), source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::ConstReference(e) => IrExpression::ConstReference(Box::new_in( ConstReferenceExpr { index: e.index, source_span: e.source_span }, - allocator, + &allocator, )), IrExpression::TwoWayBindingSet(e) => IrExpression::TwoWayBindingSet(Box::new_in( TwoWayBindingSetExpr { - target: Box::new_in(e.target.clone_in(allocator), allocator), - value: Box::new_in(e.value.clone_in(allocator), allocator), + target: Box::new_in(e.target.clone_in(allocator), &allocator), + value: Box::new_in(e.value.clone_in(allocator), &allocator), source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::ContextLetReference(e) => IrExpression::ContextLetReference(Box::new_in( ContextLetReferenceExpr { @@ -524,50 +524,50 @@ impl<'a> IrExpression<'a> { target_slot: e.target_slot, source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::StoreLet(e) => IrExpression::StoreLet(Box::new_in( StoreLetExpr { target: e.target, - value: Box::new_in(e.value.clone_in(allocator), allocator), + value: Box::new_in(e.value.clone_in(allocator), &allocator), var_offset: e.var_offset, source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::TrackContext(e) => IrExpression::TrackContext(Box::new_in( TrackContextExpr { view: e.view, source_span: e.source_span }, - allocator, + &allocator, )), IrExpression::Binary(e) => IrExpression::Binary(Box::new_in( BinaryExpr { operator: e.operator, - lhs: Box::new_in(e.lhs.clone_in(allocator), allocator), - rhs: Box::new_in(e.rhs.clone_in(allocator), allocator), + lhs: Box::new_in(e.lhs.clone_in(allocator), &allocator), + rhs: Box::new_in(e.rhs.clone_in(allocator), &allocator), source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::Ternary(e) => IrExpression::Ternary(Box::new_in( TernaryExpr { - condition: Box::new_in(e.condition.clone_in(allocator), allocator), - true_expr: Box::new_in(e.true_expr.clone_in(allocator), allocator), - false_expr: Box::new_in(e.false_expr.clone_in(allocator), allocator), + condition: Box::new_in(e.condition.clone_in(allocator), &allocator), + true_expr: Box::new_in(e.true_expr.clone_in(allocator), &allocator), + false_expr: Box::new_in(e.false_expr.clone_in(allocator), &allocator), source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::Interpolation(e) => { - let mut strings = Vec::with_capacity_in(e.strings.len(), allocator); + let mut strings = Vec::with_capacity_in(e.strings.len(), &allocator); for s in e.strings.iter() { strings.push(s.clone()); } - let mut expressions = Vec::with_capacity_in(e.expressions.len(), allocator); + let mut expressions = Vec::with_capacity_in(e.expressions.len(), &allocator); for expr in e.expressions.iter() { expressions.push(expr.clone_in(allocator)); } let mut i18n_placeholders = - Vec::with_capacity_in(e.i18n_placeholders.len(), allocator); + Vec::with_capacity_in(e.i18n_placeholders.len(), &allocator); for ph in e.i18n_placeholders.iter() { i18n_placeholders.push(ph.clone()); } @@ -578,7 +578,7 @@ impl<'a> IrExpression<'a> { i18n_placeholders, source_span: e.source_span, }, - allocator, + &allocator, )) } IrExpression::Ast(ast_expr) => { @@ -587,8 +587,8 @@ impl<'a> IrExpression<'a> { // For now, we'll mark this as needing implementation // A full implementation would clone the entire AngularExpression tree IrExpression::Ast(Box::new_in( - clone_angular_expression(ast_expr, allocator), - allocator, + clone_angular_expression(ast_expr, &allocator), + &allocator, )) } IrExpression::ExpressionRef(id) => IrExpression::ExpressionRef(*id), @@ -596,90 +596,90 @@ impl<'a> IrExpression<'a> { // OutputExpr contains an already-converted output expression. // We need to clone the OutputExpression, which requires its own clone implementation. // For now, we'll use the output expression's CloneIn trait. - IrExpression::OutputExpr(Box::new_in(e.clone_in(allocator), allocator)) + IrExpression::OutputExpr(Box::new_in(e.clone_in(allocator), &allocator)) } IrExpression::ResolvedPropertyRead(e) => { IrExpression::ResolvedPropertyRead(Box::new_in( ResolvedPropertyReadExpr { - receiver: Box::new_in(e.receiver.clone_in(allocator), allocator), + receiver: Box::new_in(e.receiver.clone_in(allocator), &allocator), name: e.name.clone(), optional: e.optional, source_span: e.source_span, }, - allocator, + &allocator, )) } IrExpression::ResolvedBinary(e) => IrExpression::ResolvedBinary(Box::new_in( ResolvedBinaryExpr { operator: e.operator, - left: Box::new_in(e.left.clone_in(allocator), allocator), - right: Box::new_in(e.right.clone_in(allocator), allocator), + left: Box::new_in(e.left.clone_in(allocator), &allocator), + right: Box::new_in(e.right.clone_in(allocator), &allocator), source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::ResolvedCall(e) => { - let mut args = Vec::with_capacity_in(e.args.len(), allocator); + let mut args = Vec::with_capacity_in(e.args.len(), &allocator); for arg in e.args.iter() { args.push(arg.clone_in(allocator)); } IrExpression::ResolvedCall(Box::new_in( ResolvedCallExpr { - receiver: Box::new_in(e.receiver.clone_in(allocator), allocator), + receiver: Box::new_in(e.receiver.clone_in(allocator), &allocator), args, optional: e.optional, source_span: e.source_span, }, - allocator, + &allocator, )) } IrExpression::ResolvedKeyedRead(e) => IrExpression::ResolvedKeyedRead(Box::new_in( ResolvedKeyedReadExpr { - receiver: Box::new_in(e.receiver.clone_in(allocator), allocator), - key: Box::new_in(e.key.clone_in(allocator), allocator), + receiver: Box::new_in(e.receiver.clone_in(allocator), &allocator), + key: Box::new_in(e.key.clone_in(allocator), &allocator), optional: e.optional, source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::ResolvedSafePropertyRead(e) => { IrExpression::ResolvedSafePropertyRead(Box::new_in( ResolvedSafePropertyReadExpr { - receiver: Box::new_in(e.receiver.clone_in(allocator), allocator), + receiver: Box::new_in(e.receiver.clone_in(allocator), &allocator), name: e.name.clone(), source_span: e.source_span, }, - allocator, + &allocator, )) } IrExpression::DerivedLiteralArray(e) => { - let mut entries = Vec::with_capacity_in(e.entries.len(), allocator); + let mut entries = Vec::with_capacity_in(e.entries.len(), &allocator); for entry in e.entries.iter() { entries.push(entry.clone_in(allocator)); } - let mut spreads = Vec::with_capacity_in(e.spreads.len(), allocator); + let mut spreads = Vec::with_capacity_in(e.spreads.len(), &allocator); for s in e.spreads.iter() { spreads.push(*s); } IrExpression::DerivedLiteralArray(Box::new_in( DerivedLiteralArrayExpr { entries, spreads, source_span: e.source_span }, - allocator, + &allocator, )) } IrExpression::DerivedLiteralMap(e) => { - let mut keys = Vec::with_capacity_in(e.keys.len(), allocator); + let mut keys = Vec::with_capacity_in(e.keys.len(), &allocator); for key in e.keys.iter() { keys.push(key.clone()); } - let mut values = Vec::with_capacity_in(e.values.len(), allocator); + let mut values = Vec::with_capacity_in(e.values.len(), &allocator); for value in e.values.iter() { values.push(value.clone_in(allocator)); } - let mut quoted = Vec::with_capacity_in(e.quoted.len(), allocator); + let mut quoted = Vec::with_capacity_in(e.quoted.len(), &allocator); for q in e.quoted.iter() { quoted.push(*q); } - let mut spreads = Vec::with_capacity_in(e.spreads.len(), allocator); + let mut spreads = Vec::with_capacity_in(e.spreads.len(), &allocator); for s in e.spreads.iter() { spreads.push(*s); } @@ -691,83 +691,83 @@ impl<'a> IrExpression<'a> { spreads, source_span: e.source_span, }, - allocator, + &allocator, )) } IrExpression::LiteralArray(e) => { - let mut elements = Vec::with_capacity_in(e.elements.len(), allocator); + let mut elements = Vec::with_capacity_in(e.elements.len(), &allocator); for elem in e.elements.iter() { elements.push(elem.clone_in(allocator)); } - let mut spreads = Vec::with_capacity_in(e.spreads.len(), allocator); + let mut spreads = Vec::with_capacity_in(e.spreads.len(), &allocator); for s in e.spreads.iter() { spreads.push(*s); } IrExpression::LiteralArray(Box::new_in( IrLiteralArrayExpr { elements, spreads, source_span: e.source_span }, - allocator, + &allocator, )) } IrExpression::LiteralMap(e) => { - let mut keys = Vec::with_capacity_in(e.keys.len(), allocator); + let mut keys = Vec::with_capacity_in(e.keys.len(), &allocator); for key in e.keys.iter() { keys.push(key.clone()); } - let mut values = Vec::with_capacity_in(e.values.len(), allocator); + let mut values = Vec::with_capacity_in(e.values.len(), &allocator); for value in e.values.iter() { values.push(value.clone_in(allocator)); } - let mut quoted = Vec::with_capacity_in(e.quoted.len(), allocator); + let mut quoted = Vec::with_capacity_in(e.quoted.len(), &allocator); for q in e.quoted.iter() { quoted.push(*q); } - let mut spreads = Vec::with_capacity_in(e.spreads.len(), allocator); + let mut spreads = Vec::with_capacity_in(e.spreads.len(), &allocator); for s in e.spreads.iter() { spreads.push(*s); } IrExpression::LiteralMap(Box::new_in( IrLiteralMapExpr { keys, values, quoted, spreads, source_span: e.source_span }, - allocator, + &allocator, )) } IrExpression::Not(e) => IrExpression::Not(Box::new_in( NotExpr { - expr: Box::new_in(e.expr.clone_in(allocator), allocator), + expr: Box::new_in(e.expr.clone_in(allocator), &allocator), source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::Unary(e) => IrExpression::Unary(Box::new_in( UnaryExpr { operator: e.operator, - expr: Box::new_in(e.expr.clone_in(allocator), allocator), + expr: Box::new_in(e.expr.clone_in(allocator), &allocator), source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::Typeof(e) => IrExpression::Typeof(Box::new_in( TypeofExpr { - expr: Box::new_in(e.expr.clone_in(allocator), allocator), + expr: Box::new_in(e.expr.clone_in(allocator), &allocator), source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::Void(e) => IrExpression::Void(Box::new_in( VoidExpr { - expr: Box::new_in(e.expr.clone_in(allocator), allocator), + expr: Box::new_in(e.expr.clone_in(allocator), &allocator), source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::ResolvedTemplateLiteral(e) => { - let mut elements = Vec::with_capacity_in(e.elements.len(), allocator); + let mut elements = Vec::with_capacity_in(e.elements.len(), &allocator); for elem in e.elements.iter() { elements.push(IrTemplateLiteralElement { text: elem.text.clone(), source_span: elem.source_span, }); } - let mut expressions = Vec::with_capacity_in(e.expressions.len(), allocator); + let mut expressions = Vec::with_capacity_in(e.expressions.len(), &allocator); for expr in e.expressions.iter() { expressions.push(expr.clone_in(allocator)); } @@ -777,40 +777,40 @@ impl<'a> IrExpression<'a> { expressions, source_span: e.source_span, }, - allocator, + &allocator, )) } IrExpression::ArrowFunction(e) => { - let mut params = Vec::with_capacity_in(e.params.len(), allocator); + let mut params = Vec::with_capacity_in(e.params.len(), &allocator); for param in e.params.iter() { params.push(crate::output::ast::FnParam { name: param.name.clone() }); } IrExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { params, - body: Box::new_in(e.body.clone_in(allocator), allocator), + body: Box::new_in(e.body.clone_in(allocator), &allocator), // ops are not cloned as they are transient data added during compilation - ops: Vec::new_in(allocator), + ops: Vec::new_in(&allocator), var_offset: e.var_offset, source_span: e.source_span, }, - allocator, + &allocator, )) } IrExpression::Parenthesized(e) => IrExpression::Parenthesized(Box::new_in( IrParenthesizedExpr { - expr: Box::new_in(e.expr.clone_in(allocator), allocator), + expr: Box::new_in(e.expr.clone_in(allocator), &allocator), source_span: e.source_span, }, - allocator, + &allocator, )), IrExpression::SafeNavigationMigration(e) => { IrExpression::SafeNavigationMigration(Box::new_in( SafeNavigationMigrationExpr { - expr: Box::new_in(e.expr.clone_in(allocator), allocator), + expr: Box::new_in(e.expr.clone_in(allocator), &allocator), source_span: e.source_span, }, - allocator, + &allocator, )) } } @@ -2514,82 +2514,82 @@ pub fn clone_angular_expression<'a>( match expr { AngularExpression::Empty(e) => AngularExpression::Empty(Box::new_in( AstEmptyExpr { span: e.span, source_span: e.source_span }, - allocator, + &allocator, )), AngularExpression::ImplicitReceiver(e) => AngularExpression::ImplicitReceiver(Box::new_in( ImplicitReceiver { span: e.span, source_span: e.source_span }, - allocator, + &allocator, )), AngularExpression::ThisReceiver(e) => AngularExpression::ThisReceiver(Box::new_in( ThisReceiver { span: e.span, source_span: e.source_span }, - allocator, + &allocator, )), AngularExpression::Chain(e) => { - let mut expressions = Vec::with_capacity_in(e.expressions.len(), allocator); + let mut expressions = Vec::with_capacity_in(e.expressions.len(), &allocator); for expr in e.expressions.iter() { - expressions.push(clone_angular_expression(expr, allocator)); + expressions.push(clone_angular_expression(expr, &allocator)); } AngularExpression::Chain(Box::new_in( Chain { expressions, span: e.span, source_span: e.source_span }, - allocator, + &allocator, )) } AngularExpression::Conditional(e) => AngularExpression::Conditional(Box::new_in( Conditional { - condition: clone_angular_expression(&e.condition, allocator), - true_exp: clone_angular_expression(&e.true_exp, allocator), - false_exp: clone_angular_expression(&e.false_exp, allocator), + condition: clone_angular_expression(&e.condition, &allocator), + true_exp: clone_angular_expression(&e.true_exp, &allocator), + false_exp: clone_angular_expression(&e.false_exp, &allocator), span: e.span, source_span: e.source_span, }, - allocator, + &allocator, )), AngularExpression::PropertyRead(e) => AngularExpression::PropertyRead(Box::new_in( PropertyRead { - receiver: clone_angular_expression(&e.receiver, allocator), + receiver: clone_angular_expression(&e.receiver, &allocator), name: e.name.clone(), name_span: e.name_span, span: e.span, source_span: e.source_span, }, - allocator, + &allocator, )), AngularExpression::SafePropertyRead(e) => AngularExpression::SafePropertyRead(Box::new_in( SafePropertyRead { - receiver: clone_angular_expression(&e.receiver, allocator), + receiver: clone_angular_expression(&e.receiver, &allocator), name: e.name.clone(), name_span: e.name_span, span: e.span, source_span: e.source_span, }, - allocator, + &allocator, )), AngularExpression::KeyedRead(e) => AngularExpression::KeyedRead(Box::new_in( KeyedRead { - receiver: clone_angular_expression(&e.receiver, allocator), - key: clone_angular_expression(&e.key, allocator), + receiver: clone_angular_expression(&e.receiver, &allocator), + key: clone_angular_expression(&e.key, &allocator), span: e.span, source_span: e.source_span, }, - allocator, + &allocator, )), AngularExpression::SafeKeyedRead(e) => AngularExpression::SafeKeyedRead(Box::new_in( SafeKeyedRead { - receiver: clone_angular_expression(&e.receiver, allocator), - key: clone_angular_expression(&e.key, allocator), + receiver: clone_angular_expression(&e.receiver, &allocator), + key: clone_angular_expression(&e.key, &allocator), span: e.span, source_span: e.source_span, }, - allocator, + &allocator, )), AngularExpression::BindingPipe(e) => { - let mut args = Vec::with_capacity_in(e.args.len(), allocator); + let mut args = Vec::with_capacity_in(e.args.len(), &allocator); for arg in e.args.iter() { - args.push(clone_angular_expression(arg, allocator)); + args.push(clone_angular_expression(arg, &allocator)); } AngularExpression::BindingPipe(Box::new_in( BindingPipe { - exp: clone_angular_expression(&e.exp, allocator), + exp: clone_angular_expression(&e.exp, &allocator), name: e.name.clone(), name_span: e.name_span, args, @@ -2597,29 +2597,29 @@ pub fn clone_angular_expression<'a>( span: e.span, source_span: e.source_span, }, - allocator, + &allocator, )) } AngularExpression::LiteralPrimitive(e) => AngularExpression::LiteralPrimitive(Box::new_in( LiteralPrimitive { - value: clone_literal_value(&e.value, allocator), + value: clone_literal_value(&e.value, &allocator), span: e.span, source_span: e.source_span, }, - allocator, + &allocator, )), AngularExpression::LiteralArray(e) => { - let mut expressions = Vec::with_capacity_in(e.expressions.len(), allocator); + let mut expressions = Vec::with_capacity_in(e.expressions.len(), &allocator); for expr in e.expressions.iter() { - expressions.push(clone_angular_expression(expr, allocator)); + expressions.push(clone_angular_expression(expr, &allocator)); } AngularExpression::LiteralArray(Box::new_in( LiteralArray { expressions, span: e.span, source_span: e.source_span }, - allocator, + &allocator, )) } AngularExpression::LiteralMap(e) => { - let mut keys = Vec::with_capacity_in(e.keys.len(), allocator); + let mut keys = Vec::with_capacity_in(e.keys.len(), &allocator); for key in e.keys.iter() { keys.push(match key { LiteralMapKey::Property(prop) => { @@ -2635,143 +2635,143 @@ pub fn clone_angular_expression<'a>( }), }); } - let mut values = Vec::with_capacity_in(e.values.len(), allocator); + let mut values = Vec::with_capacity_in(e.values.len(), &allocator); for val in e.values.iter() { - values.push(clone_angular_expression(val, allocator)); + values.push(clone_angular_expression(val, &allocator)); } AngularExpression::LiteralMap(Box::new_in( LiteralMap { keys, values, span: e.span, source_span: e.source_span }, - allocator, + &allocator, )) } AngularExpression::SpreadElement(e) => AngularExpression::SpreadElement(Box::new_in( SpreadElement { span: e.span, source_span: e.source_span, - expression: clone_angular_expression(&e.expression, allocator), + expression: clone_angular_expression(&e.expression, &allocator), }, - allocator, + &allocator, )), AngularExpression::Interpolation(e) => { - let mut strings = Vec::with_capacity_in(e.strings.len(), allocator); + let mut strings = Vec::with_capacity_in(e.strings.len(), &allocator); for s in e.strings.iter() { strings.push(s.clone()); } - let mut expressions = Vec::with_capacity_in(e.expressions.len(), allocator); + let mut expressions = Vec::with_capacity_in(e.expressions.len(), &allocator); for expr in e.expressions.iter() { - expressions.push(clone_angular_expression(expr, allocator)); + expressions.push(clone_angular_expression(expr, &allocator)); } AngularExpression::Interpolation(Box::new_in( AstInterpolation { strings, expressions, span: e.span, source_span: e.source_span }, - allocator, + &allocator, )) } AngularExpression::Binary(e) => AngularExpression::Binary(Box::new_in( Binary { operation: e.operation, - left: clone_angular_expression(&e.left, allocator), - right: clone_angular_expression(&e.right, allocator), + left: clone_angular_expression(&e.left, &allocator), + right: clone_angular_expression(&e.right, &allocator), span: e.span, source_span: e.source_span, }, - allocator, + &allocator, )), AngularExpression::Unary(e) => AngularExpression::Unary(Box::new_in( Unary { operator: e.operator, - expr: clone_angular_expression(&e.expr, allocator), + expr: clone_angular_expression(&e.expr, &allocator), span: e.span, source_span: e.source_span, }, - allocator, + &allocator, )), AngularExpression::PrefixNot(e) => AngularExpression::PrefixNot(Box::new_in( PrefixNot { - expression: clone_angular_expression(&e.expression, allocator), + expression: clone_angular_expression(&e.expression, &allocator), span: e.span, source_span: e.source_span, }, - allocator, + &allocator, )), AngularExpression::TypeofExpression(e) => AngularExpression::TypeofExpression(Box::new_in( TypeofExpression { - expression: clone_angular_expression(&e.expression, allocator), + expression: clone_angular_expression(&e.expression, &allocator), span: e.span, source_span: e.source_span, }, - allocator, + &allocator, )), AngularExpression::VoidExpression(e) => AngularExpression::VoidExpression(Box::new_in( VoidExpression { - expression: clone_angular_expression(&e.expression, allocator), + expression: clone_angular_expression(&e.expression, &allocator), span: e.span, source_span: e.source_span, }, - allocator, + &allocator, )), AngularExpression::NonNullAssert(e) => AngularExpression::NonNullAssert(Box::new_in( NonNullAssert { - expression: clone_angular_expression(&e.expression, allocator), + expression: clone_angular_expression(&e.expression, &allocator), span: e.span, source_span: e.source_span, }, - allocator, + &allocator, )), AngularExpression::Call(e) => { - let mut args = Vec::with_capacity_in(e.args.len(), allocator); + let mut args = Vec::with_capacity_in(e.args.len(), &allocator); for arg in e.args.iter() { - args.push(clone_angular_expression(arg, allocator)); + args.push(clone_angular_expression(arg, &allocator)); } AngularExpression::Call(Box::new_in( Call { - receiver: clone_angular_expression(&e.receiver, allocator), + receiver: clone_angular_expression(&e.receiver, &allocator), args, argument_span: e.argument_span, span: e.span, source_span: e.source_span, }, - allocator, + &allocator, )) } AngularExpression::SafeCall(e) => { - let mut args = Vec::with_capacity_in(e.args.len(), allocator); + let mut args = Vec::with_capacity_in(e.args.len(), &allocator); for arg in e.args.iter() { - args.push(clone_angular_expression(arg, allocator)); + args.push(clone_angular_expression(arg, &allocator)); } AngularExpression::SafeCall(Box::new_in( SafeCall { - receiver: clone_angular_expression(&e.receiver, allocator), + receiver: clone_angular_expression(&e.receiver, &allocator), args, argument_span: e.argument_span, span: e.span, source_span: e.source_span, }, - allocator, + &allocator, )) } AngularExpression::TaggedTemplateLiteral(e) => { AngularExpression::TaggedTemplateLiteral(Box::new_in( TaggedTemplateLiteral { - tag: clone_angular_expression(&e.tag, allocator), - template: clone_template_literal(&e.template, allocator), + tag: clone_angular_expression(&e.tag, &allocator), + template: clone_template_literal(&e.template, &allocator), span: e.span, source_span: e.source_span, }, - allocator, + &allocator, )) } AngularExpression::TemplateLiteral(e) => AngularExpression::TemplateLiteral(Box::new_in( - clone_template_literal(e, allocator), - allocator, + clone_template_literal(e, &allocator), + &allocator, )), AngularExpression::ParenthesizedExpression(e) => { AngularExpression::ParenthesizedExpression(Box::new_in( ParenthesizedExpression { - expression: clone_angular_expression(&e.expression, allocator), + expression: clone_angular_expression(&e.expression, &allocator), span: e.span, source_span: e.source_span, }, - allocator, + &allocator, )) } AngularExpression::RegularExpressionLiteral(e) => { @@ -2782,11 +2782,11 @@ pub fn clone_angular_expression<'a>( span: e.span, source_span: e.source_span, }, - allocator, + &allocator, )) } AngularExpression::ArrowFunction(e) => { - let mut parameters = Vec::with_capacity_in(e.parameters.len(), allocator); + let mut parameters = Vec::with_capacity_in(e.parameters.len(), &allocator); for p in e.parameters.iter() { parameters.push(AstArrowFunctionParameter { name: p.name.clone(), @@ -2797,11 +2797,11 @@ pub fn clone_angular_expression<'a>( AngularExpression::ArrowFunction(Box::new_in( AstArrowFunction { parameters, - body: clone_angular_expression(&e.body, allocator), + body: clone_angular_expression(&e.body, &allocator), span: e.span, source_span: e.source_span, }, - allocator, + &allocator, )) } } @@ -2826,7 +2826,7 @@ fn clone_template_literal<'a>( tl: &TemplateLiteral<'a>, allocator: &'a oxc_allocator::Allocator, ) -> TemplateLiteral<'a> { - let mut elements = Vec::with_capacity_in(tl.elements.len(), allocator); + let mut elements = Vec::with_capacity_in(tl.elements.len(), &allocator); for elem in tl.elements.iter() { elements.push(TemplateLiteralElement { text: elem.text.clone(), @@ -2834,9 +2834,9 @@ fn clone_template_literal<'a>( source_span: elem.source_span, }); } - let mut expressions = Vec::with_capacity_in(tl.expressions.len(), allocator); + let mut expressions = Vec::with_capacity_in(tl.expressions.len(), &allocator); for expr in tl.expressions.iter() { - expressions.push(clone_angular_expression(expr, allocator)); + expressions.push(clone_angular_expression(expr, &allocator)); } TemplateLiteral { elements, expressions, span: tl.span, source_span: tl.source_span } } diff --git a/crates/oxc_angular_compiler/src/ir/ops.rs b/crates/oxc_angular_compiler/src/ir/ops.rs index 94359640e..1fd451457 100644 --- a/crates/oxc_angular_compiler/src/ir/ops.rs +++ b/crates/oxc_angular_compiler/src/ir/ops.rs @@ -2023,7 +2023,7 @@ mod tests { host_listener: true, name: Ident::from(""), handler_expression: None, - handler_ops: AllocVec::new_in(allocator), + handler_ops: AllocVec::new_in(&allocator), handler_fn_name: None, consume_fn_name: None, is_animation_listener: legacy_animation_phase.is_some(), diff --git a/crates/oxc_angular_compiler/src/ng_module/compiler.rs b/crates/oxc_angular_compiler/src/ng_module/compiler.rs index fe59e92df..eda484972 100644 --- a/crates/oxc_angular_compiler/src/ng_module/compiler.rs +++ b/crates/oxc_angular_compiler/src/ng_module/compiler.rs @@ -49,7 +49,7 @@ pub fn compile_ng_module_from_metadata<'a>( allocator: &'a Allocator, metadata: &R3NgModuleMetadata<'a>, ) -> NgModuleCompileResult<'a> { - let mut statements = Vec::new_in(allocator); + let mut statements = Vec::new_in(&allocator); // Build the definition map let definition_map = build_definition_map(allocator, metadata); @@ -78,7 +78,7 @@ fn build_definition_map<'a>( allocator: &'a Allocator, metadata: &R3NgModuleMetadata<'a>, ) -> Vec<'a, LiteralMapEntry<'a>> { - let mut entries = Vec::new_in(allocator); + let mut entries = Vec::new_in(&allocator); // type: ModuleClass entries.push(LiteralMapEntry::new( @@ -99,7 +99,7 @@ fn build_definition_map<'a>( // declarations: [DirectiveClass, PipeClass, ...] if metadata.has_declarations() { let declarations_array = create_reference_array( - allocator, + &allocator, &metadata.declarations, metadata.contains_forward_decls, ); @@ -113,7 +113,7 @@ fn build_definition_map<'a>( // imports: [ImportedModule, ...] if metadata.has_imports() { let imports_array = create_reference_array( - allocator, + &allocator, &metadata.imports, metadata.contains_forward_decls, ); @@ -123,7 +123,7 @@ fn build_definition_map<'a>( // exports: [ExportedClass, ...] if metadata.has_exports() { let exports_array = create_reference_array( - allocator, + &allocator, &metadata.exports, metadata.contains_forward_decls, ); @@ -153,28 +153,28 @@ fn create_reference_array<'a>( refs: &[R3Reference<'a>], wrap_in_function: bool, ) -> OutputExpression<'a> { - let mut items = Vec::new_in(allocator); + let mut items = Vec::new_in(&allocator); for r in refs { items.push(r.value.clone_in(allocator)); } let array = OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: items, source_span: None }, - allocator, + &allocator, )); if wrap_in_function { // () => [Class1, Class2, ...] - let params = Vec::new_in(allocator); - let mut body = Vec::new_in(allocator); + let params = Vec::new_in(&allocator); + let mut body = Vec::new_in(&allocator); body.push(OutputStatement::Return(Box::new_in( ReturnStatement { value: array, source_span: None }, - allocator, + &allocator, ))); OutputExpression::Function(Box::new_in( FunctionExpr { name: None, params, statements: body, source_span: None }, - allocator, + &allocator, )) } else { array @@ -192,36 +192,36 @@ fn create_define_ng_module_call<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(Identifiers::DEFINE_NG_MODULE), optional: false, source_span: None, }, - allocator, + &allocator, )); // Create the literal map expression let map_expr = OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries: definition_map, source_span: None }, - allocator, + &allocator, )); // Create the function call - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(map_expr); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(define_ng_module_fn, allocator), + fn_expr: Box::new_in(define_ng_module_fn, &allocator), args, pure: true, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -248,11 +248,11 @@ fn create_set_scope_side_effect<'a>( } // Build the scope map - let mut scope_entries = Vec::new_in(allocator); + let mut scope_entries = Vec::new_in(&allocator); if metadata.has_declarations() { let decls = create_reference_array( - allocator, + &allocator, &metadata.declarations, metadata.contains_forward_decls, ); @@ -273,7 +273,7 @@ fn create_set_scope_side_effect<'a>( let scope_map = OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries: scope_entries, source_span: None }, - allocator, + &allocator, )); // Create: ɵɵsetNgModuleScope(ModuleClass, scopeMap) @@ -282,110 +282,110 @@ fn create_set_scope_side_effect<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(Identifiers::SET_NG_MODULE_SCOPE), optional: false, source_span: None, }, - allocator, + &allocator, )); - let mut set_scope_args = Vec::new_in(allocator); + let mut set_scope_args = Vec::new_in(&allocator); set_scope_args.push(metadata.r#type.value.clone_in(allocator)); set_scope_args.push(scope_map); let set_scope_call = OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(set_scope_fn, allocator), + fn_expr: Box::new_in(set_scope_fn, &allocator), args: set_scope_args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )); // Create: (typeof ngJitMode === "undefined" || ngJitMode) let typeof_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("typeof ngJitMode"), source_span: None }, - allocator, + &allocator, )); let undefined_check = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Equals, - lhs: Box::new_in(typeof_expr, allocator), + lhs: Box::new_in(typeof_expr, &allocator), rhs: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(Ident::from("undefined")), source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), source_span: None, }, - allocator, + &allocator, )); let ng_jit_mode = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("ngJitMode"), source_span: None }, - allocator, + &allocator, )); let jit_mode_check = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Or, - lhs: Box::new_in(undefined_check, allocator), - rhs: Box::new_in(ng_jit_mode, allocator), + lhs: Box::new_in(undefined_check, &allocator), + rhs: Box::new_in(ng_jit_mode, &allocator), source_span: None, }, - allocator, + &allocator, )); // Create: (jitModeCheck) && setNgModuleScope(...) let guarded_call = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::And, - lhs: Box::new_in(jit_mode_check, allocator), - rhs: Box::new_in(set_scope_call, allocator), + lhs: Box::new_in(jit_mode_check, &allocator), + rhs: Box::new_in(set_scope_call, &allocator), source_span: None, }, - allocator, + &allocator, )); // Wrap in IIFE: (function() { ... })() - let params = Vec::new_in(allocator); - let mut body = Vec::new_in(allocator); + let params = Vec::new_in(&allocator); + let mut body = Vec::new_in(&allocator); body.push(OutputStatement::Expression(Box::new_in( crate::output::ast::ExpressionStatement { expr: guarded_call, source_span: None }, - allocator, + &allocator, ))); let iife_fn = OutputExpression::Function(Box::new_in( FunctionExpr { name: None, params, statements: body, source_span: None }, - allocator, + &allocator, )); let iife_call = OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(iife_fn, allocator), - args: Vec::new_in(allocator), + fn_expr: Box::new_in(iife_fn, &allocator), + args: Vec::new_in(&allocator), pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )); Some(OutputStatement::Expression(Box::new_in( crate::output::ast::ExpressionStatement { expr: iife_call, source_span: None }, - allocator, + &allocator, ))) } @@ -400,35 +400,35 @@ fn create_register_ng_module_type<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(Identifiers::REGISTER_NG_MODULE_TYPE), optional: false, source_span: None, }, - allocator, + &allocator, )); - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(module_type.clone_in(allocator)); args.push(id.clone_in(allocator)); let call = OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(register_fn, allocator), + fn_expr: Box::new_in(register_fn, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )); OutputStatement::Expression(Box::new_in( crate::output::ast::ExpressionStatement { expr: call, source_span: None }, - allocator, + &allocator, )) } @@ -443,7 +443,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("AppModule"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3NgModuleMetadataBuilder::new(&allocator) @@ -465,11 +465,11 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("MyModule"), source_span: None }, - &allocator, + &&allocator, )); let component_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("MyComponent"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3NgModuleMetadataBuilder::new(&allocator) @@ -493,15 +493,15 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("SharedModule"), source_span: None }, - &allocator, + &&allocator, )); let import_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("CommonModule"), source_span: None }, - &allocator, + &&allocator, )); let export_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("SharedComponent"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3NgModuleMetadataBuilder::new(&allocator) @@ -527,11 +527,11 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("JitModule"), source_span: None }, - &allocator, + &&allocator, )); let decl_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("JitComponent"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3NgModuleMetadataBuilder::new(&allocator) @@ -552,11 +552,11 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("ForwardModule"), source_span: None }, - &allocator, + &&allocator, )); let decl_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("ForwardComponent"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3NgModuleMetadataBuilder::new(&allocator) diff --git a/crates/oxc_angular_compiler/src/ng_module/decorator.rs b/crates/oxc_angular_compiler/src/ng_module/decorator.rs index 15c952bb7..6f924bbe6 100644 --- a/crates/oxc_angular_compiler/src/ng_module/decorator.rs +++ b/crates/oxc_angular_compiler/src/ng_module/decorator.rs @@ -68,13 +68,13 @@ impl<'a> NgModuleMetadata<'a> { Self { class_name, class_span, - declarations: Vec::new_in(allocator), - imports: Vec::new_in(allocator), + declarations: Vec::new_in(&allocator), + imports: Vec::new_in(&allocator), raw_imports_expr: None, - exports: Vec::new_in(allocator), + exports: Vec::new_in(&allocator), providers: None, - bootstrap: Vec::new_in(allocator), - schemas: Vec::new_in(allocator), + bootstrap: Vec::new_in(&allocator), + schemas: Vec::new_in(&allocator), id: None, contains_forward_decls: false, deps: None, @@ -90,7 +90,7 @@ impl<'a> NgModuleMetadata<'a> { let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: self.class_name.clone(), source_span: None }, - allocator, + &allocator, )); let mut builder = R3NgModuleMetadataBuilder::new(allocator) @@ -102,7 +102,7 @@ impl<'a> NgModuleMetadata<'a> { for decl in &self.declarations { let decl_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: decl.clone(), source_span: None }, - allocator, + &allocator, )); builder = builder.add_declaration(R3Reference::value_only(decl_expr)); } @@ -111,7 +111,7 @@ impl<'a> NgModuleMetadata<'a> { for import in &self.imports { let import_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: import.clone(), source_span: None }, - allocator, + &allocator, )); builder = builder.add_import(R3Reference::value_only(import_expr)); } @@ -120,7 +120,7 @@ impl<'a> NgModuleMetadata<'a> { for export in &self.exports { let export_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: export.clone(), source_span: None }, - allocator, + &allocator, )); builder = builder.add_export(R3Reference::value_only(export_expr)); } @@ -129,7 +129,7 @@ impl<'a> NgModuleMetadata<'a> { for bootstrap in &self.bootstrap { let bootstrap_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: bootstrap.clone(), source_span: None }, - allocator, + &allocator, )); builder = builder.add_bootstrap(R3Reference::value_only(bootstrap_expr)); } @@ -138,7 +138,7 @@ impl<'a> NgModuleMetadata<'a> { for schema in &self.schemas { let schema_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: schema.clone(), source_span: None }, - allocator, + &allocator, )); builder = builder.add_schema(R3Reference::value_only(schema_expr)); } @@ -150,7 +150,7 @@ impl<'a> NgModuleMetadata<'a> { value: crate::output::ast::LiteralValue::String(id.clone()), source_span: None, }, - allocator, + &allocator, )); builder = builder.id(id_expr); } @@ -336,7 +336,7 @@ fn extract_reference_array<'a>( allocator: &'a Allocator, expr: &Expression<'a>, ) -> (Vec<'a, Ident<'a>>, bool) { - let mut result = Vec::new_in(allocator); + let mut result = Vec::new_in(&allocator); let mut has_forward_refs = false; let Expression::ArrayExpression(arr) = expr else { @@ -384,7 +384,7 @@ fn extract_identifier_array<'a>( allocator: &'a Allocator, expr: &Expression<'a>, ) -> Vec<'a, Ident<'a>> { - let mut result = Vec::new_in(allocator); + let mut result = Vec::new_in(&allocator); let Expression::ArrayExpression(arr) = expr else { return result; @@ -430,7 +430,7 @@ pub fn extract_constructor_deps<'a>( // Get the constructor's parameters let params = &constructor.value.params; - let mut deps = Vec::with_capacity_in(params.items.len(), allocator); + let mut deps = Vec::with_capacity_in(params.items.len(), &allocator); for param in ¶ms.items { let dep = extract_param_dependency(allocator, param); @@ -483,7 +483,7 @@ fn extract_param_dependency<'a>( value: crate::output::ast::LiteralValue::String(attr_name), source_span: None, }, - allocator, + &allocator, ))), attribute_name_type: token, // The type annotation host, @@ -546,7 +546,7 @@ fn extract_param_token<'a>( return Some(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: type_name, source_span: None }, - allocator, + &allocator, ))); } diff --git a/crates/oxc_angular_compiler/src/ng_module/definition.rs b/crates/oxc_angular_compiler/src/ng_module/definition.rs index a6657f76a..bb5fb3f42 100644 --- a/crates/oxc_angular_compiler/src/ng_module/definition.rs +++ b/crates/oxc_angular_compiler/src/ng_module/definition.rs @@ -226,7 +226,7 @@ pub fn generate_full_ng_module_definition<'a>( mod_definition, fac_definition, inj_definition, - statements: OxcVec::new_in(allocator), + statements: OxcVec::new_in(&allocator), }) } } @@ -241,14 +241,14 @@ fn generate_ng_module_fac<'a>( let type_expr = OutputExpression::ReadVar(oxc_allocator::Box::new_in( ReadVarExpr { name: metadata.class_name.clone(), source_span: None }, - allocator, + &allocator, )); // Convert deps to R3FactoryDeps let factory_deps = match &metadata.deps { Some(deps) => { let mut factory_deps: OxcVec<'a, R3DependencyMetadata<'a>> = - OxcVec::with_capacity_in(deps.len(), allocator); + OxcVec::with_capacity_in(deps.len(), &allocator); for dep in deps { factory_deps.push(R3DependencyMetadata { token: dep.token.as_ref().map(|t| t.clone_in(allocator)), @@ -299,7 +299,7 @@ fn build_injector_metadata<'a>( ) -> crate::injector::R3InjectorMetadata<'a> { let type_expr = OutputExpression::ReadVar(oxc_allocator::Box::new_in( ReadVarExpr { name: metadata.class_name.clone(), source_span: None }, - allocator, + &allocator, )); let mut builder = R3InjectorMetadataBuilder::new(allocator) @@ -318,7 +318,7 @@ fn build_injector_metadata<'a>( for import in &metadata.imports { let import_expr = OutputExpression::ReadVar(oxc_allocator::Box::new_in( ReadVarExpr { name: import.clone(), source_span: None }, - allocator, + &allocator, )); builder = builder.add_import(import_expr); } @@ -373,7 +373,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("AppModule"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3NgModuleMetadataBuilder::new(&allocator) @@ -400,11 +400,11 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("MyModule"), source_span: None }, - &allocator, + &&allocator, )); let component_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("MyComponent"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3NgModuleMetadataBuilder::new(&allocator) @@ -429,15 +429,15 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("SharedModule"), source_span: None }, - &allocator, + &&allocator, )); let import_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("CommonModule"), source_span: None }, - &allocator, + &&allocator, )); let export_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("SharedComponent"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3NgModuleMetadataBuilder::new(&allocator) @@ -465,11 +465,11 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("RootModule"), source_span: None }, - &allocator, + &&allocator, )); let bootstrap_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("AppComponent"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3NgModuleMetadataBuilder::new(&allocator) @@ -493,11 +493,11 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("JitModule"), source_span: None }, - &allocator, + &&allocator, )); let decl_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("JitComponent"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3NgModuleMetadataBuilder::new(&allocator) @@ -519,7 +519,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("TestModule"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3NgModuleMetadataBuilder::new(&allocator) @@ -651,7 +651,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("TreeShakableModule"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3NgModuleMetadataBuilder::new(&allocator) diff --git a/crates/oxc_angular_compiler/src/ng_module/metadata.rs b/crates/oxc_angular_compiler/src/ng_module/metadata.rs index 0d42d36a0..9569bc8a4 100644 --- a/crates/oxc_angular_compiler/src/ng_module/metadata.rs +++ b/crates/oxc_angular_compiler/src/ng_module/metadata.rs @@ -135,11 +135,11 @@ impl<'a> R3NgModuleMetadataBuilder<'a> { pub fn new(allocator: &'a oxc_allocator::Allocator) -> Self { Self { r#type: None, - bootstrap: Vec::new_in(allocator), - declarations: Vec::new_in(allocator), - imports: Vec::new_in(allocator), - exports: Vec::new_in(allocator), - schemas: Vec::new_in(allocator), + bootstrap: Vec::new_in(&allocator), + declarations: Vec::new_in(&allocator), + imports: Vec::new_in(&allocator), + exports: Vec::new_in(&allocator), + schemas: Vec::new_in(&allocator), id: None, selector_scope_mode: R3SelectorScopeMode::Inline, contains_forward_decls: false, diff --git a/crates/oxc_angular_compiler/src/output/ast.rs b/crates/oxc_angular_compiler/src/output/ast.rs index 08b3d8ff1..eee7f799f 100644 --- a/crates/oxc_angular_compiler/src/output/ast.rs +++ b/crates/oxc_angular_compiler/src/output/ast.rs @@ -343,42 +343,42 @@ impl<'a> OutputType<'a> { /// Create a dynamic type (any). pub fn dynamic_type(allocator: &oxc_allocator::Allocator) -> OutputType<'_> { - OutputType::Builtin(Box::new_in(BuiltinType::new(BuiltinTypeName::Dynamic), allocator)) + OutputType::Builtin(Box::new_in(BuiltinType::new(BuiltinTypeName::Dynamic), &allocator)) } /// Create an inferred type. pub fn inferred_type(allocator: &oxc_allocator::Allocator) -> OutputType<'_> { - OutputType::Builtin(Box::new_in(BuiltinType::new(BuiltinTypeName::Inferred), allocator)) + OutputType::Builtin(Box::new_in(BuiltinType::new(BuiltinTypeName::Inferred), &allocator)) } /// Create a bool type. pub fn bool_type(allocator: &oxc_allocator::Allocator) -> OutputType<'_> { - OutputType::Builtin(Box::new_in(BuiltinType::new(BuiltinTypeName::Bool), allocator)) + OutputType::Builtin(Box::new_in(BuiltinType::new(BuiltinTypeName::Bool), &allocator)) } /// Create an int type. pub fn int_type(allocator: &oxc_allocator::Allocator) -> OutputType<'_> { - OutputType::Builtin(Box::new_in(BuiltinType::new(BuiltinTypeName::Int), allocator)) + OutputType::Builtin(Box::new_in(BuiltinType::new(BuiltinTypeName::Int), &allocator)) } /// Create a number type. pub fn number_type(allocator: &oxc_allocator::Allocator) -> OutputType<'_> { - OutputType::Builtin(Box::new_in(BuiltinType::new(BuiltinTypeName::Number), allocator)) + OutputType::Builtin(Box::new_in(BuiltinType::new(BuiltinTypeName::Number), &allocator)) } /// Create a string type. pub fn string_type(allocator: &oxc_allocator::Allocator) -> OutputType<'_> { - OutputType::Builtin(Box::new_in(BuiltinType::new(BuiltinTypeName::String), allocator)) + OutputType::Builtin(Box::new_in(BuiltinType::new(BuiltinTypeName::String), &allocator)) } /// Create a function type. pub fn function_type(allocator: &oxc_allocator::Allocator) -> OutputType<'_> { - OutputType::Builtin(Box::new_in(BuiltinType::new(BuiltinTypeName::Function), allocator)) + OutputType::Builtin(Box::new_in(BuiltinType::new(BuiltinTypeName::Function), &allocator)) } /// Create a none type (void). pub fn none_type(allocator: &oxc_allocator::Allocator) -> OutputType<'_> { - OutputType::Builtin(Box::new_in(BuiltinType::new(BuiltinTypeName::None), allocator)) + OutputType::Builtin(Box::new_in(BuiltinType::new(BuiltinTypeName::None), &allocator)) } // ============================================================================ @@ -1115,23 +1115,23 @@ impl<'a> OutputExpression<'a> { match self { OutputExpression::Literal(e) => OutputExpression::Literal(Box::new_in( LiteralExpr { - value: clone_literal_value(&e.value, allocator), + value: clone_literal_value(&e.value, &allocator), source_span: e.source_span, }, - allocator, + &allocator, )), OutputExpression::LiteralArray(e) => { - let mut entries = Vec::with_capacity_in(e.entries.len(), allocator); + let mut entries = Vec::with_capacity_in(e.entries.len(), &allocator); for entry in e.entries.iter() { entries.push(entry.clone_in(allocator)); } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: e.source_span }, - allocator, + &allocator, )) } OutputExpression::LiteralMap(e) => { - let mut entries = Vec::with_capacity_in(e.entries.len(), allocator); + let mut entries = Vec::with_capacity_in(e.entries.len(), &allocator); for entry in e.entries.iter() { entries.push(LiteralMapEntry { key: entry.key.clone(), @@ -1142,7 +1142,7 @@ impl<'a> OutputExpression<'a> { } OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: e.source_span }, - allocator, + &allocator, )) } OutputExpression::RegularExpressionLiteral(e) => { @@ -1152,11 +1152,11 @@ impl<'a> OutputExpression<'a> { flags: e.flags.clone(), source_span: e.source_span, }, - allocator, + &allocator, )) } OutputExpression::TemplateLiteral(e) => { - let mut elements = Vec::with_capacity_in(e.elements.len(), allocator); + let mut elements = Vec::with_capacity_in(e.elements.len(), &allocator); for elem in e.elements.iter() { elements.push(TemplateLiteralElement { text: elem.text.clone(), @@ -1164,17 +1164,17 @@ impl<'a> OutputExpression<'a> { source_span: elem.source_span, }); } - let mut expressions = Vec::with_capacity_in(e.expressions.len(), allocator); + let mut expressions = Vec::with_capacity_in(e.expressions.len(), &allocator); for expr in e.expressions.iter() { expressions.push(expr.clone_in(allocator)); } OutputExpression::TemplateLiteral(Box::new_in( TemplateLiteralExpr { elements, expressions, source_span: e.source_span }, - allocator, + &allocator, )) } OutputExpression::TaggedTemplateLiteral(e) => { - let mut elements = Vec::with_capacity_in(e.template.elements.len(), allocator); + let mut elements = Vec::with_capacity_in(e.template.elements.len(), &allocator); for elem in e.template.elements.iter() { elements.push(TemplateLiteralElement { text: elem.text.clone(), @@ -1183,124 +1183,124 @@ impl<'a> OutputExpression<'a> { }); } let mut expressions = - Vec::with_capacity_in(e.template.expressions.len(), allocator); + Vec::with_capacity_in(e.template.expressions.len(), &allocator); for expr in e.template.expressions.iter() { expressions.push(expr.clone_in(allocator)); } OutputExpression::TaggedTemplateLiteral(Box::new_in( TaggedTemplateLiteralExpr { - tag: Box::new_in(e.tag.clone_in(allocator), allocator), + tag: Box::new_in(e.tag.clone_in(allocator), &allocator), template: Box::new_in( TemplateLiteralExpr { elements, expressions, source_span: e.template.source_span, }, - allocator, + &allocator, ), source_span: e.source_span, }, - allocator, + &allocator, )) } OutputExpression::ReadVar(e) => OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: e.name.clone(), source_span: e.source_span }, - allocator, + &allocator, )), OutputExpression::ReadProp(e) => OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(e.receiver.clone_in(allocator), allocator), + receiver: Box::new_in(e.receiver.clone_in(allocator), &allocator), name: e.name.clone(), optional: e.optional, source_span: e.source_span, }, - allocator, + &allocator, )), OutputExpression::ReadKey(e) => OutputExpression::ReadKey(Box::new_in( ReadKeyExpr { - receiver: Box::new_in(e.receiver.clone_in(allocator), allocator), - index: Box::new_in(e.index.clone_in(allocator), allocator), + receiver: Box::new_in(e.receiver.clone_in(allocator), &allocator), + index: Box::new_in(e.index.clone_in(allocator), &allocator), optional: e.optional, source_span: e.source_span, }, - allocator, + &allocator, )), OutputExpression::BinaryOperator(e) => OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: e.operator, - lhs: Box::new_in(e.lhs.clone_in(allocator), allocator), - rhs: Box::new_in(e.rhs.clone_in(allocator), allocator), + lhs: Box::new_in(e.lhs.clone_in(allocator), &allocator), + rhs: Box::new_in(e.rhs.clone_in(allocator), &allocator), source_span: e.source_span, }, - allocator, + &allocator, )), OutputExpression::UnaryOperator(e) => OutputExpression::UnaryOperator(Box::new_in( UnaryOperatorExpr { operator: e.operator, - expr: Box::new_in(e.expr.clone_in(allocator), allocator), + expr: Box::new_in(e.expr.clone_in(allocator), &allocator), parens: e.parens, source_span: e.source_span, }, - allocator, + &allocator, )), OutputExpression::Conditional(e) => OutputExpression::Conditional(Box::new_in( ConditionalExpr { - condition: Box::new_in(e.condition.clone_in(allocator), allocator), - true_case: Box::new_in(e.true_case.clone_in(allocator), allocator), + condition: Box::new_in(e.condition.clone_in(allocator), &allocator), + true_case: Box::new_in(e.true_case.clone_in(allocator), &allocator), false_case: e .false_case .as_ref() - .map(|fc| Box::new_in(fc.clone_in(allocator), allocator)), + .map(|fc| Box::new_in(fc.clone_in(allocator), &allocator)), source_span: e.source_span, }, - allocator, + &allocator, )), OutputExpression::Not(e) => OutputExpression::Not(Box::new_in( NotExpr { - condition: Box::new_in(e.condition.clone_in(allocator), allocator), + condition: Box::new_in(e.condition.clone_in(allocator), &allocator), source_span: e.source_span, }, - allocator, + &allocator, )), OutputExpression::Typeof(e) => OutputExpression::Typeof(Box::new_in( TypeofExpr { - expr: Box::new_in(e.expr.clone_in(allocator), allocator), + expr: Box::new_in(e.expr.clone_in(allocator), &allocator), source_span: e.source_span, }, - allocator, + &allocator, )), OutputExpression::Void(e) => OutputExpression::Void(Box::new_in( VoidExpr { - expr: Box::new_in(e.expr.clone_in(allocator), allocator), + expr: Box::new_in(e.expr.clone_in(allocator), &allocator), source_span: e.source_span, }, - allocator, + &allocator, )), OutputExpression::Parenthesized(e) => OutputExpression::Parenthesized(Box::new_in( ParenthesizedExpr { - expr: Box::new_in(e.expr.clone_in(allocator), allocator), + expr: Box::new_in(e.expr.clone_in(allocator), &allocator), source_span: e.source_span, }, - allocator, + &allocator, )), OutputExpression::Comma(e) => { - let mut parts = Vec::with_capacity_in(e.parts.len(), allocator); + let mut parts = Vec::with_capacity_in(e.parts.len(), &allocator); for part in e.parts.iter() { parts.push(part.clone_in(allocator)); } OutputExpression::Comma(Box::new_in( CommaExpr { parts, source_span: e.source_span }, - allocator, + &allocator, )) } OutputExpression::Function(e) => { - let mut params = Vec::with_capacity_in(e.params.len(), allocator); + let mut params = Vec::with_capacity_in(e.params.len(), &allocator); for param in e.params.iter() { params.push(FnParam { name: param.name.clone() }); } - let mut statements = Vec::with_capacity_in(e.statements.len(), allocator); + let mut statements = Vec::with_capacity_in(e.statements.len(), &allocator); for stmt in e.statements.iter() { - statements.push(clone_output_statement(stmt, allocator)); + statements.push(clone_output_statement(stmt, &allocator)); } OutputExpression::Function(Box::new_in( FunctionExpr { @@ -1309,66 +1309,66 @@ impl<'a> OutputExpression<'a> { statements, source_span: e.source_span, }, - allocator, + &allocator, )) } OutputExpression::ArrowFunction(e) => { - let mut params = Vec::with_capacity_in(e.params.len(), allocator); + let mut params = Vec::with_capacity_in(e.params.len(), &allocator); for param in e.params.iter() { params.push(FnParam { name: param.name.clone() }); } let body = match &e.body { ArrowFunctionBody::Expression(expr) => ArrowFunctionBody::Expression( - Box::new_in(expr.clone_in(allocator), allocator), + Box::new_in(expr.clone_in(allocator), &allocator), ), ArrowFunctionBody::Statements(stmts) => { - let mut statements = Vec::with_capacity_in(stmts.len(), allocator); + let mut statements = Vec::with_capacity_in(stmts.len(), &allocator); for stmt in stmts.iter() { - statements.push(clone_output_statement(stmt, allocator)); + statements.push(clone_output_statement(stmt, &allocator)); } ArrowFunctionBody::Statements(statements) } }; OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { params, body, source_span: e.source_span }, - allocator, + &allocator, )) } OutputExpression::InvokeFunction(e) => { - let mut args = Vec::with_capacity_in(e.args.len(), allocator); + let mut args = Vec::with_capacity_in(e.args.len(), &allocator); for arg in e.args.iter() { args.push(arg.clone_in(allocator)); } OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(e.fn_expr.clone_in(allocator), allocator), + fn_expr: Box::new_in(e.fn_expr.clone_in(allocator), &allocator), args, pure: e.pure, optional: e.optional, source_span: e.source_span, }, - allocator, + &allocator, )) } OutputExpression::Instantiate(e) => { - let mut args = Vec::with_capacity_in(e.args.len(), allocator); + let mut args = Vec::with_capacity_in(e.args.len(), &allocator); for arg in e.args.iter() { args.push(arg.clone_in(allocator)); } OutputExpression::Instantiate(Box::new_in( InstantiateExpr { - class_expr: Box::new_in(e.class_expr.clone_in(allocator), allocator), + class_expr: Box::new_in(e.class_expr.clone_in(allocator), &allocator), args, source_span: e.source_span, }, - allocator, + &allocator, )) } OutputExpression::DynamicImport(e) => { let url = match &e.url { DynamicImportUrl::String(s) => DynamicImportUrl::String(s.clone()), DynamicImportUrl::Expression(expr) => DynamicImportUrl::Expression( - Box::new_in(expr.clone_in(allocator), allocator), + Box::new_in(expr.clone_in(allocator), &allocator), ), }; OutputExpression::DynamicImport(Box::new_in( @@ -1377,7 +1377,7 @@ impl<'a> OutputExpression<'a> { url_comment: e.url_comment.clone(), source_span: e.source_span, }, - allocator, + &allocator, )) } OutputExpression::External(e) => OutputExpression::External(Box::new_in( @@ -1388,19 +1388,19 @@ impl<'a> OutputExpression<'a> { }, source_span: e.source_span, }, - allocator, + &allocator, )), OutputExpression::LocalizedString(e) => { - let mut message_parts = Vec::with_capacity_in(e.message_parts.len(), allocator); + let mut message_parts = Vec::with_capacity_in(e.message_parts.len(), &allocator); for part in e.message_parts.iter() { message_parts.push(part.clone()); } let mut placeholder_names = - Vec::with_capacity_in(e.placeholder_names.len(), allocator); + Vec::with_capacity_in(e.placeholder_names.len(), &allocator); for name in e.placeholder_names.iter() { placeholder_names.push(name.clone()); } - let mut expressions = Vec::with_capacity_in(e.expressions.len(), allocator); + let mut expressions = Vec::with_capacity_in(e.expressions.len(), &allocator); for expr in e.expressions.iter() { expressions.push(expr.clone_in(allocator)); } @@ -1414,12 +1414,12 @@ impl<'a> OutputExpression<'a> { expressions, source_span: e.source_span, }, - allocator, + &allocator, )) } OutputExpression::WrappedNode(e) => OutputExpression::WrappedNode(Box::new_in( WrappedNodeExpr { node_id: e.node_id.clone(), source_span: e.source_span }, - allocator, + &allocator, )), OutputExpression::WrappedIrNode(_) => { // WrappedIrNode expressions wrap IR expressions for deferred processing. @@ -1427,19 +1427,19 @@ impl<'a> OutputExpression<'a> { // Return a placeholder undefined literal as a safe fallback. OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Undefined, source_span: None }, - allocator, + &allocator, )) } OutputExpression::SpreadElement(e) => OutputExpression::SpreadElement(Box::new_in( SpreadElementExpr { - expr: Box::new_in(e.expr.clone_in(allocator), allocator), + expr: Box::new_in(e.expr.clone_in(allocator), &allocator), source_span: e.source_span, }, - allocator, + &allocator, )), OutputExpression::RawSource(e) => OutputExpression::RawSource(Box::new_in( RawSourceExpr { source: e.source.clone(), source_span: e.source_span }, - allocator, + &allocator, )), } } @@ -1537,16 +1537,16 @@ pub fn clone_output_statement<'a>( leading_comment: s.leading_comment.clone(), source_span: s.source_span, }, - allocator, + &allocator, )), OutputStatement::DeclareFunction(s) => { - let mut params = Vec::with_capacity_in(s.params.len(), allocator); + let mut params = Vec::with_capacity_in(s.params.len(), &allocator); for param in s.params.iter() { params.push(FnParam { name: param.name.clone() }); } - let mut statements = Vec::with_capacity_in(s.statements.len(), allocator); + let mut statements = Vec::with_capacity_in(s.statements.len(), &allocator); for inner_stmt in s.statements.iter() { - statements.push(clone_output_statement(inner_stmt, allocator)); + statements.push(clone_output_statement(inner_stmt, &allocator)); } OutputStatement::DeclareFunction(Box::new_in( DeclareFunctionStmt { @@ -1556,25 +1556,25 @@ pub fn clone_output_statement<'a>( modifiers: s.modifiers, source_span: s.source_span, }, - allocator, + &allocator, )) } OutputStatement::Expression(s) => OutputStatement::Expression(Box::new_in( ExpressionStatement { expr: s.expr.clone_in(allocator), source_span: s.source_span }, - allocator, + &allocator, )), OutputStatement::Return(s) => OutputStatement::Return(Box::new_in( ReturnStatement { value: s.value.clone_in(allocator), source_span: s.source_span }, - allocator, + &allocator, )), OutputStatement::If(s) => { - let mut true_case = Vec::with_capacity_in(s.true_case.len(), allocator); + let mut true_case = Vec::with_capacity_in(s.true_case.len(), &allocator); for inner_stmt in s.true_case.iter() { - true_case.push(clone_output_statement(inner_stmt, allocator)); + true_case.push(clone_output_statement(inner_stmt, &allocator)); } - let mut false_case = Vec::with_capacity_in(s.false_case.len(), allocator); + let mut false_case = Vec::with_capacity_in(s.false_case.len(), &allocator); for inner_stmt in s.false_case.iter() { - false_case.push(clone_output_statement(inner_stmt, allocator)); + false_case.push(clone_output_statement(inner_stmt, &allocator)); } OutputStatement::If(Box::new_in( IfStmt { @@ -1583,7 +1583,7 @@ pub fn clone_output_statement<'a>( false_case, source_span: s.source_span, }, - allocator, + &allocator, )) } } @@ -1601,7 +1601,7 @@ impl OutputAstBuilder { pub fn null<'a>(allocator: &'a oxc_allocator::Allocator) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )) } @@ -1612,7 +1612,7 @@ impl OutputAstBuilder { ) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(value), source_span: None }, - allocator, + &allocator, )) } @@ -1620,7 +1620,7 @@ impl OutputAstBuilder { pub fn number<'a>(allocator: &'a oxc_allocator::Allocator, value: f64) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(value), source_span: None }, - allocator, + &allocator, )) } @@ -1631,7 +1631,7 @@ impl OutputAstBuilder { ) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(value), source_span: None }, - allocator, + &allocator, )) } @@ -1640,7 +1640,7 @@ impl OutputAstBuilder { allocator: &'a oxc_allocator::Allocator, name: Ident<'a>, ) -> OutputExpression<'a> { - OutputExpression::ReadVar(Box::new_in(ReadVarExpr { name, source_span: None }, allocator)) + OutputExpression::ReadVar(Box::new_in(ReadVarExpr { name, source_span: None }, &allocator)) } } diff --git a/crates/oxc_angular_compiler/src/output/emitter.rs b/crates/oxc_angular_compiler/src/output/emitter.rs index 908152a5b..ce77f5104 100644 --- a/crates/oxc_angular_compiler/src/output/emitter.rs +++ b/crates/oxc_angular_compiler/src/output/emitter.rs @@ -1415,7 +1415,7 @@ mod tests { let alloc = Allocator::default(); let expr = OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - &alloc, + &&alloc, )); assert_eq!(emitter.emit_expression(&expr), "null"); } @@ -1426,7 +1426,7 @@ mod tests { let alloc = Allocator::default(); let expr = OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(true), source_span: None }, - &alloc, + &&alloc, )); assert_eq!(emitter.emit_expression(&expr), "true"); } @@ -1437,7 +1437,7 @@ mod tests { let alloc = Allocator::default(); let expr = OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(42.5), source_span: None }, - &alloc, + &&alloc, )); assert_eq!(emitter.emit_expression(&expr), "42.5"); } @@ -1493,7 +1493,7 @@ mod tests { let alloc = Allocator::default(); let expr = OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(Ident::from("hello")), source_span: None }, - &alloc, + &&alloc, )); // Uses double quotes to match Angular's output style assert_eq!(emitter.emit_expression(&expr), "\"hello\""); @@ -1505,7 +1505,7 @@ mod tests { let alloc = Allocator::default(); let expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("myVar"), source_span: None }, - &alloc, + &&alloc, )); assert_eq!(emitter.emit_expression(&expr), "myVar"); } @@ -1796,7 +1796,7 @@ mod tests { }; let output = emitter.emit_statement(&crate::output::ast::OutputStatement::DeclareVar( - oxc_allocator::Box::new_in(stmt, &oxc_allocator::Allocator::default()), + oxc_allocator::Box::new_in(stmt, &&oxc_allocator::Allocator::default()), )); assert!(output.contains("/** @desc Hello world @meaning greeting */")); @@ -1824,7 +1824,7 @@ mod tests { }; let output = emitter.emit_statement(&crate::output::ast::OutputStatement::DeclareVar( - oxc_allocator::Box::new_in(stmt, &oxc_allocator::Allocator::default()), + oxc_allocator::Box::new_in(stmt, &&oxc_allocator::Allocator::default()), )); assert!(output.contains("/** @suppress {msgDescriptions} */")); @@ -1847,7 +1847,7 @@ mod tests { }; let output = emitter.emit_statement(&crate::output::ast::OutputStatement::DeclareVar( - oxc_allocator::Box::new_in(stmt, &oxc_allocator::Allocator::default()), + oxc_allocator::Box::new_in(stmt, &&oxc_allocator::Allocator::default()), )); assert!(output.contains("// test comment")); @@ -1870,7 +1870,7 @@ mod tests { }; let output = emitter.emit_statement(&crate::output::ast::OutputStatement::DeclareVar( - oxc_allocator::Box::new_in(stmt, &oxc_allocator::Allocator::default()), + oxc_allocator::Box::new_in(stmt, &&oxc_allocator::Allocator::default()), )); // Multi-line comments get " * " prefix on continuation lines @@ -1897,7 +1897,7 @@ mod tests { }; let output = emitter.emit_statement(&crate::output::ast::OutputStatement::DeclareVar( - oxc_allocator::Box::new_in(stmt, &oxc_allocator::Allocator::default()), + oxc_allocator::Box::new_in(stmt, &&oxc_allocator::Allocator::default()), )); // Should have space before * on each continuation line @@ -1918,25 +1918,25 @@ mod tests { // Build: (condition? true: false) let condition = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("condition"), source_span: None }, - &alloc, + &&alloc, )); let true_case = OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(2.0), source_span: None }, - &alloc, + &&alloc, )); let false_case = OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(-1.0), source_span: None }, - &alloc, + &&alloc, )); let expr = OutputExpression::Conditional(Box::new_in( ConditionalExpr { - condition: Box::new_in(condition, &alloc), - true_case: Box::new_in(true_case, &alloc), - false_case: Some(Box::new_in(false_case, &alloc)), + condition: Box::new_in(condition, &&alloc), + true_case: Box::new_in(true_case, &&alloc), + false_case: Some(Box::new_in(false_case, &&alloc)), source_span: None, }, - &alloc, + &&alloc, )); let output = emitter.emit_expression(&expr); @@ -1963,9 +1963,9 @@ mod tests { lhs: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("tmp"), source_span: None }, - &alloc, + &&alloc, )), - &alloc, + &&alloc, ), rhs: Box::new_in( OutputExpression::Literal(Box::new_in( @@ -1973,35 +1973,35 @@ mod tests { value: LiteralValue::String(Ident::from("year")), source_span: None, }, - &alloc, + &&alloc, )), - &alloc, + &&alloc, ), source_span: None, }, - &alloc, + &&alloc, )); let inner_cond_expr = OutputExpression::Conditional(Box::new_in( ConditionalExpr { - condition: Box::new_in(inner_condition, &alloc), + condition: Box::new_in(inner_condition, &&alloc), true_case: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(3.0), source_span: None }, - &alloc, + &&alloc, )), - &alloc, + &&alloc, ), false_case: Some(Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(-1.0), source_span: None }, - &alloc, + &&alloc, )), - &alloc, + &&alloc, )), source_span: None, }, - &alloc, + &&alloc, )); // Outer conditional: (tmp === "month")? 2: inner @@ -2011,9 +2011,9 @@ mod tests { lhs: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("tmp"), source_span: None }, - &alloc, + &&alloc, )), - &alloc, + &&alloc, ), rhs: Box::new_in( OutputExpression::Literal(Box::new_in( @@ -2021,29 +2021,29 @@ mod tests { value: LiteralValue::String(Ident::from("month")), source_span: None, }, - &alloc, + &&alloc, )), - &alloc, + &&alloc, ), source_span: None, }, - &alloc, + &&alloc, )); let expr = OutputExpression::Conditional(Box::new_in( ConditionalExpr { - condition: Box::new_in(outer_condition, &alloc), + condition: Box::new_in(outer_condition, &&alloc), true_case: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(2.0), source_span: None }, - &alloc, + &&alloc, )), - &alloc, + &&alloc, ), - false_case: Some(Box::new_in(inner_cond_expr, &alloc)), + false_case: Some(Box::new_in(inner_cond_expr, &&alloc)), source_span: None, }, - &alloc, + &&alloc, )); let output = emitter.emit_expression(&expr); @@ -2061,29 +2061,29 @@ mod tests { // Build: [...arr, 1, 2] let arr_var = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("arr"), source_span: None }, - &alloc, + &&alloc, )); let spread_expr = OutputExpression::SpreadElement(Box::new_in( - SpreadElementExpr { expr: Box::new_in(arr_var, &alloc), source_span: None }, - &alloc, + SpreadElementExpr { expr: Box::new_in(arr_var, &&alloc), source_span: None }, + &&alloc, )); let one = OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(1.0), source_span: None }, - &alloc, + &&alloc, )); let two = OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(2.0), source_span: None }, - &alloc, + &&alloc, )); - let mut entries = oxc_allocator::Vec::new_in(&alloc); + let mut entries = oxc_allocator::Vec::new_in(&&alloc); entries.push(spread_expr); entries.push(one); entries.push(two); let array_expr = OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: None }, - &alloc, + &&alloc, )); let output = emitter.emit_expression(&array_expr); @@ -2100,28 +2100,28 @@ mod tests { // Build: [...a, ...b] let a_var = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("a"), source_span: None }, - &alloc, + &&alloc, )); let b_var = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("b"), source_span: None }, - &alloc, + &&alloc, )); let spread_a = OutputExpression::SpreadElement(Box::new_in( - SpreadElementExpr { expr: Box::new_in(a_var, &alloc), source_span: None }, - &alloc, + SpreadElementExpr { expr: Box::new_in(a_var, &&alloc), source_span: None }, + &&alloc, )); let spread_b = OutputExpression::SpreadElement(Box::new_in( - SpreadElementExpr { expr: Box::new_in(b_var, &alloc), source_span: None }, - &alloc, + SpreadElementExpr { expr: Box::new_in(b_var, &&alloc), source_span: None }, + &&alloc, )); - let mut entries = oxc_allocator::Vec::new_in(&alloc); + let mut entries = oxc_allocator::Vec::new_in(&&alloc); entries.push(spread_a); entries.push(spread_b); let array_expr = OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: None }, - &alloc, + &&alloc, )); let output = emitter.emit_expression(&array_expr); @@ -2144,37 +2144,37 @@ mod tests { // Build: (a && b) ?? c let a = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("a"), source_span: None }, - &alloc, + &&alloc, )); let b = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("b"), source_span: None }, - &alloc, + &&alloc, )); let c = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("c"), source_span: None }, - &alloc, + &&alloc, )); // a && b let and_expr = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: super::super::ast::BinaryOperator::And, - lhs: Box::new_in(a, &alloc), - rhs: Box::new_in(b, &alloc), + lhs: Box::new_in(a, &&alloc), + rhs: Box::new_in(b, &&alloc), source_span: None, }, - &alloc, + &&alloc, )); // (a && b) ?? c let expr = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: super::super::ast::BinaryOperator::NullishCoalesce, - lhs: Box::new_in(and_expr, &alloc), - rhs: Box::new_in(c, &alloc), + lhs: Box::new_in(and_expr, &&alloc), + rhs: Box::new_in(c, &&alloc), source_span: None, }, - &alloc, + &&alloc, )); let output = emitter.emit_expression(&expr); @@ -2194,37 +2194,37 @@ mod tests { // Build: a ?? (b || c) let a = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("a"), source_span: None }, - &alloc, + &&alloc, )); let b = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("b"), source_span: None }, - &alloc, + &&alloc, )); let c = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("c"), source_span: None }, - &alloc, + &&alloc, )); // b || c let or_expr = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: super::super::ast::BinaryOperator::Or, - lhs: Box::new_in(b, &alloc), - rhs: Box::new_in(c, &alloc), + lhs: Box::new_in(b, &&alloc), + rhs: Box::new_in(c, &&alloc), source_span: None, }, - &alloc, + &&alloc, )); // a ?? (b || c) let expr = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: super::super::ast::BinaryOperator::NullishCoalesce, - lhs: Box::new_in(a, &alloc), - rhs: Box::new_in(or_expr, &alloc), + lhs: Box::new_in(a, &&alloc), + rhs: Box::new_in(or_expr, &&alloc), source_span: None, }, - &alloc, + &&alloc, )); let output = emitter.emit_expression(&expr); @@ -2244,37 +2244,37 @@ mod tests { // Build: (a ?? b) && c let a = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("a"), source_span: None }, - &alloc, + &&alloc, )); let b = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("b"), source_span: None }, - &alloc, + &&alloc, )); let c = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("c"), source_span: None }, - &alloc, + &&alloc, )); // a ?? b let nullish_expr = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: super::super::ast::BinaryOperator::NullishCoalesce, - lhs: Box::new_in(a, &alloc), - rhs: Box::new_in(b, &alloc), + lhs: Box::new_in(a, &&alloc), + rhs: Box::new_in(b, &&alloc), source_span: None, }, - &alloc, + &&alloc, )); // (a ?? b) && c let expr = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: super::super::ast::BinaryOperator::And, - lhs: Box::new_in(nullish_expr, &alloc), - rhs: Box::new_in(c, &alloc), + lhs: Box::new_in(nullish_expr, &&alloc), + rhs: Box::new_in(c, &&alloc), source_span: None, }, - &alloc, + &&alloc, )); let output = emitter.emit_expression(&expr); @@ -2294,41 +2294,41 @@ mod tests { // Build: (a ? b : c) ?? d let a = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("a"), source_span: None }, - &alloc, + &&alloc, )); let b = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("b"), source_span: None }, - &alloc, + &&alloc, )); let c = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("c"), source_span: None }, - &alloc, + &&alloc, )); let d = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("d"), source_span: None }, - &alloc, + &&alloc, )); // a ? b : c let cond_expr = OutputExpression::Conditional(Box::new_in( ConditionalExpr { - condition: Box::new_in(a, &alloc), - true_case: Box::new_in(b, &alloc), - false_case: Some(Box::new_in(c, &alloc)), + condition: Box::new_in(a, &&alloc), + true_case: Box::new_in(b, &&alloc), + false_case: Some(Box::new_in(c, &&alloc)), source_span: None, }, - &alloc, + &&alloc, )); // (a ? b : c) ?? d let expr = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: super::super::ast::BinaryOperator::NullishCoalesce, - lhs: Box::new_in(cond_expr, &alloc), - rhs: Box::new_in(d, &alloc), + lhs: Box::new_in(cond_expr, &&alloc), + rhs: Box::new_in(d, &&alloc), source_span: None, }, - &alloc, + &&alloc, )); let output = emitter.emit_expression(&expr); @@ -2352,32 +2352,32 @@ mod tests { // Build: (x) =>(x + 1) let x_var = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("x"), source_span: None }, - &alloc, + &&alloc, )); let one = OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(1.0), source_span: None }, - &alloc, + &&alloc, )); let body = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: super::super::ast::BinaryOperator::Plus, - lhs: Box::new_in(x_var, &alloc), - rhs: Box::new_in(one, &alloc), + lhs: Box::new_in(x_var, &&alloc), + rhs: Box::new_in(one, &&alloc), source_span: None, }, - &alloc, + &&alloc, )); - let mut params = oxc_allocator::Vec::new_in(&alloc); + let mut params = oxc_allocator::Vec::new_in(&&alloc); params.push(FnParam { name: Ident::from("x") }); let expr = OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { params, - body: ArrowFunctionBody::Expression(Box::new_in(body, &alloc)), + body: ArrowFunctionBody::Expression(Box::new_in(body, &&alloc)), source_span: None, }, - &alloc, + &&alloc, )); let output = emitter.emit_expression(&expr); @@ -2397,33 +2397,33 @@ mod tests { // Build: (x, y) =>(x + y) let x_var = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("x"), source_span: None }, - &alloc, + &&alloc, )); let y_var = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("y"), source_span: None }, - &alloc, + &&alloc, )); let body = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: super::super::ast::BinaryOperator::Plus, - lhs: Box::new_in(x_var, &alloc), - rhs: Box::new_in(y_var, &alloc), + lhs: Box::new_in(x_var, &&alloc), + rhs: Box::new_in(y_var, &&alloc), source_span: None, }, - &alloc, + &&alloc, )); - let mut params = oxc_allocator::Vec::new_in(&alloc); + let mut params = oxc_allocator::Vec::new_in(&&alloc); params.push(FnParam { name: Ident::from("x") }); params.push(FnParam { name: Ident::from("y") }); let expr = OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { params, - body: ArrowFunctionBody::Expression(Box::new_in(body, &alloc)), + body: ArrowFunctionBody::Expression(Box::new_in(body, &&alloc)), source_span: None, }, - &alloc, + &&alloc, )); let output = emitter.emit_expression(&expr); @@ -2441,18 +2441,18 @@ mod tests { // Build: () =>42 let body = OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(42.0), source_span: None }, - &alloc, + &&alloc, )); - let params = oxc_allocator::Vec::new_in(&alloc); + let params = oxc_allocator::Vec::new_in(&&alloc); let expr = OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { params, - body: ArrowFunctionBody::Expression(Box::new_in(body, &alloc)), + body: ArrowFunctionBody::Expression(Box::new_in(body, &&alloc)), source_span: None, }, - &alloc, + &&alloc, )); let output = emitter.emit_expression(&expr); @@ -2468,11 +2468,11 @@ mod tests { let alloc = Allocator::default(); // Simple $localize with a single message part and no expressions - let mut message_parts = oxc_allocator::Vec::new_in(&alloc); + let mut message_parts = oxc_allocator::Vec::new_in(&&alloc); message_parts.push(Ident::from("Hello")); - let placeholder_names = oxc_allocator::Vec::new_in(&alloc); - let expressions = oxc_allocator::Vec::new_in(&alloc); + let placeholder_names = oxc_allocator::Vec::new_in(&&alloc); + let expressions = oxc_allocator::Vec::new_in(&&alloc); let expr = OutputExpression::LocalizedString(Box::new_in( LocalizedStringExpr { @@ -2484,7 +2484,7 @@ mod tests { expressions, source_span: None, }, - &alloc, + &&alloc, )); let output = emitter.emit_expression(&expr); @@ -2500,17 +2500,17 @@ mod tests { let alloc = Allocator::default(); // $localize with interpolation: "Hello {$name}!" - let mut message_parts = oxc_allocator::Vec::new_in(&alloc); + let mut message_parts = oxc_allocator::Vec::new_in(&&alloc); message_parts.push(Ident::from("Hello ")); message_parts.push(Ident::from("!")); - let mut placeholder_names = oxc_allocator::Vec::new_in(&alloc); + let mut placeholder_names = oxc_allocator::Vec::new_in(&&alloc); placeholder_names.push(Ident::from("name")); - let mut expressions = oxc_allocator::Vec::new_in(&alloc); + let mut expressions = oxc_allocator::Vec::new_in(&&alloc); expressions.push(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("name"), source_span: None }, - &alloc, + &&alloc, ))); let expr = OutputExpression::LocalizedString(Box::new_in( @@ -2523,7 +2523,7 @@ mod tests { expressions, source_span: None, }, - &alloc, + &&alloc, )); let output = emitter.emit_expression(&expr); @@ -2547,11 +2547,11 @@ mod tests { let expr = OutputExpression::Function(Box::new_in( FunctionExpr { name: None, - params: oxc_allocator::Vec::new_in(&alloc), - statements: oxc_allocator::Vec::new_in(&alloc), + params: oxc_allocator::Vec::new_in(&&alloc), + statements: oxc_allocator::Vec::new_in(&&alloc), source_span: None, }, - &alloc, + &&alloc, )); let output = emitter.emit_expression(&expr); @@ -2568,11 +2568,11 @@ mod tests { let expr = OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { - params: oxc_allocator::Vec::new_in(&alloc), - body: ArrowFunctionBody::Statements(oxc_allocator::Vec::new_in(&alloc)), + params: oxc_allocator::Vec::new_in(&&alloc), + body: ArrowFunctionBody::Statements(oxc_allocator::Vec::new_in(&&alloc)), source_span: None, }, - &alloc, + &&alloc, )); let output = emitter.emit_expression(&expr); @@ -2589,17 +2589,17 @@ mod tests { let condition = OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(true), source_span: None }, - &alloc, + &&alloc, )); let stmt = OutputStatement::If(Box::new_in( IfStmt { condition, - true_case: oxc_allocator::Vec::new_in(&alloc), - false_case: oxc_allocator::Vec::new_in(&alloc), + true_case: oxc_allocator::Vec::new_in(&&alloc), + false_case: oxc_allocator::Vec::new_in(&&alloc), source_span: None, }, - &alloc, + &&alloc, )); let output = emitter.emit_statement(&stmt); @@ -2618,12 +2618,12 @@ mod tests { let stmt = OutputStatement::DeclareFunction(Box::new_in( DeclareFunctionStmt { name: Ident::from("foo"), - params: oxc_allocator::Vec::new_in(&alloc), - statements: oxc_allocator::Vec::new_in(&alloc), + params: oxc_allocator::Vec::new_in(&&alloc), + statements: oxc_allocator::Vec::new_in(&&alloc), modifiers: StmtModifier::NONE, source_span: None, }, - &alloc, + &&alloc, )); let output = emitter.emit_statement(&stmt); @@ -2649,15 +2649,15 @@ mod tests { fn_expr: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("signal"), source_span: None }, - &alloc, + &&alloc, )), - &alloc, + &&alloc, ), args: { - let mut args = oxc_allocator::Vec::new_in(&alloc); + let mut args = oxc_allocator::Vec::new_in(&&alloc); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(true), source_span: None }, - &alloc, + &&alloc, ))); args }, @@ -2665,26 +2665,26 @@ mod tests { optional: false, source_span: None, }, - &alloc, + &&alloc, )); - let mut entries = oxc_allocator::Vec::new_in(&alloc); + let mut entries = oxc_allocator::Vec::new_in(&&alloc); entries.push(LiteralMapEntry::new(Ident::from("showMenu"), signal_call, false)); let obj_literal = OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - &alloc, + &&alloc, )); - let params = oxc_allocator::Vec::new_in(&alloc); + let params = oxc_allocator::Vec::new_in(&&alloc); let expr = OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { params, - body: ArrowFunctionBody::Expression(Box::new_in(obj_literal, &alloc)), + body: ArrowFunctionBody::Expression(Box::new_in(obj_literal, &&alloc)), source_span: None, }, - &alloc, + &&alloc, )); let output = emitter.emit_expression(&expr); @@ -2710,15 +2710,15 @@ mod tests { fn_expr: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("signal"), source_span: None }, - &alloc, + &&alloc, )), - &alloc, + &&alloc, ), args: { - let mut args = oxc_allocator::Vec::new_in(&alloc); + let mut args = oxc_allocator::Vec::new_in(&&alloc); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(true), source_span: None }, - &alloc, + &&alloc, ))); args }, @@ -2726,32 +2726,32 @@ mod tests { optional: false, source_span: None, }, - &alloc, + &&alloc, )); - let mut entries = oxc_allocator::Vec::new_in(&alloc); + let mut entries = oxc_allocator::Vec::new_in(&&alloc); entries.push(LiteralMapEntry::new(Ident::from("showMenu"), signal_call, false)); let obj_literal = OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - &alloc, + &&alloc, )); // Wrap in Parenthesized (this is what convert_oxc_expression produces) let parenthesized = OutputExpression::Parenthesized(Box::new_in( - ParenthesizedExpr { expr: Box::new_in(obj_literal, &alloc), source_span: None }, - &alloc, + ParenthesizedExpr { expr: Box::new_in(obj_literal, &&alloc), source_span: None }, + &&alloc, )); - let params = oxc_allocator::Vec::new_in(&alloc); + let params = oxc_allocator::Vec::new_in(&&alloc); let expr = OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { params, - body: ArrowFunctionBody::Expression(Box::new_in(parenthesized, &alloc)), + body: ArrowFunctionBody::Expression(Box::new_in(parenthesized, &&alloc)), source_span: None, }, - &alloc, + &&alloc, )); let output = emitter.emit_expression(&expr); diff --git a/crates/oxc_angular_compiler/src/output/oxc_converter.rs b/crates/oxc_angular_compiler/src/output/oxc_converter.rs index 1f7d704b7..af872d410 100644 --- a/crates/oxc_angular_compiler/src/output/oxc_converter.rs +++ b/crates/oxc_angular_compiler/src/output/oxc_converter.rs @@ -55,17 +55,17 @@ pub fn convert_oxc_expression<'a>( // Literals Expression::BooleanLiteral(lit) => Some(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(lit.value.into()), source_span: None }, - allocator, + &allocator, ))), Expression::NullLiteral(_) => Some(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))), Expression::NumericLiteral(lit) => Some(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(lit.value.into()), source_span: None }, - allocator, + &allocator, ))), Expression::StringLiteral(lit) => Some(OutputExpression::Literal(Box::new_in( @@ -73,13 +73,13 @@ pub fn convert_oxc_expression<'a>( value: LiteralValue::String(lit.value.clone().into()), source_span: None, }, - allocator, + &allocator, ))), // Identifiers Expression::Identifier(id) => Some(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: id.name.clone().into(), source_span: None }, - allocator, + &allocator, ))), // Array expressions @@ -109,12 +109,12 @@ pub fn convert_oxc_expression<'a>( let receiver = convert_oxc_expression(allocator, &member.object, source_text)?; Some(OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(receiver, allocator), + receiver: Box::new_in(receiver, &allocator), name: member.property.name.clone().into(), optional: member.optional, source_span: None, }, - allocator, + &allocator, ))) } @@ -123,12 +123,12 @@ pub fn convert_oxc_expression<'a>( let index = convert_oxc_expression(allocator, &member.expression, source_text)?; Some(OutputExpression::ReadKey(Box::new_in( ReadKeyExpr { - receiver: Box::new_in(receiver, allocator), - index: Box::new_in(index, allocator), + receiver: Box::new_in(receiver, &allocator), + index: Box::new_in(index, &allocator), optional: member.optional, source_span: None, }, - allocator, + &allocator, ))) } @@ -145,11 +145,11 @@ pub fn convert_oxc_expression<'a>( Some(OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator, - lhs: Box::new_in(lhs, allocator), - rhs: Box::new_in(rhs, allocator), + lhs: Box::new_in(lhs, &allocator), + rhs: Box::new_in(rhs, &allocator), source_span: None, }, - allocator, + &allocator, ))) } @@ -165,11 +165,11 @@ pub fn convert_oxc_expression<'a>( Some(OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator, - lhs: Box::new_in(lhs, allocator), - rhs: Box::new_in(rhs, allocator), + lhs: Box::new_in(lhs, &allocator), + rhs: Box::new_in(rhs, &allocator), source_span: None, }, - allocator, + &allocator, ))) } @@ -185,12 +185,12 @@ pub fn convert_oxc_expression<'a>( let false_case = convert_oxc_expression(allocator, &cond.alternate, source_text)?; Some(OutputExpression::Conditional(Box::new_in( ConditionalExpr { - condition: Box::new_in(condition, allocator), - true_case: Box::new_in(true_case, allocator), - false_case: Some(Box::new_in(false_case, allocator)), + condition: Box::new_in(condition, &allocator), + true_case: Box::new_in(true_case, &allocator), + false_case: Some(Box::new_in(false_case, &allocator)), source_span: None, }, - allocator, + &allocator, ))) } @@ -201,27 +201,27 @@ pub fn convert_oxc_expression<'a>( Expression::ParenthesizedExpression(paren) => { let inner = convert_oxc_expression(allocator, &paren.expression, source_text)?; Some(OutputExpression::Parenthesized(Box::new_in( - ParenthesizedExpr { expr: Box::new_in(inner, allocator), source_span: None }, - allocator, + ParenthesizedExpr { expr: Box::new_in(inner, &allocator), source_span: None }, + &allocator, ))) } // Sequence expressions (comma operator) Expression::SequenceExpression(seq) => { - let mut parts = OxcVec::with_capacity_in(seq.expressions.len(), allocator); + let mut parts = OxcVec::with_capacity_in(seq.expressions.len(), &allocator); for expr in &seq.expressions { parts.push(convert_oxc_expression(allocator, expr, source_text)?); } Some(OutputExpression::Comma(Box::new_in( CommaExpr { parts, source_span: None }, - allocator, + &allocator, ))) } // This expression Expression::ThisExpression(_) => Some(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("this"), source_span: None }, - allocator, + &allocator, ))), // TypeScript type expressions - unwrap the inner expression @@ -257,7 +257,7 @@ fn convert_array_expression<'a>( arr: &oxc_ast::ast::ArrayExpression<'a>, source_text: Option<&'a str>, ) -> Option> { - let mut entries = OxcVec::with_capacity_in(arr.elements.len(), allocator); + let mut entries = OxcVec::with_capacity_in(arr.elements.len(), &allocator); for element in &arr.elements { match element { @@ -266,10 +266,10 @@ fn convert_array_expression<'a>( let inner_expr = convert_oxc_expression(allocator, &spread.argument, source_text)?; let spread_expr = OutputExpression::SpreadElement(Box::new_in( SpreadElementExpr { - expr: Box::new_in(inner_expr, allocator), + expr: Box::new_in(inner_expr, &allocator), source_span: None, }, - allocator, + &allocator, )); entries.push(spread_expr); } @@ -277,7 +277,7 @@ fn convert_array_expression<'a>( // Elision (empty slot) - push undefined entries.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Undefined, source_span: None }, - allocator, + &allocator, ))); } _ => { @@ -291,7 +291,7 @@ fn convert_array_expression<'a>( Some(OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: None }, - allocator, + &allocator, ))) } @@ -301,7 +301,7 @@ fn convert_object_expression<'a>( obj: &oxc_ast::ast::ObjectExpression<'a>, source_text: Option<&'a str>, ) -> Option> { - let mut entries = OxcVec::with_capacity_in(obj.properties.len(), allocator); + let mut entries = OxcVec::with_capacity_in(obj.properties.len(), &allocator); for prop in &obj.properties { match prop { @@ -335,7 +335,7 @@ fn convert_object_expression<'a>( Some(OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, ))) } @@ -359,7 +359,7 @@ fn convert_call_expression_with_optional<'a>( let fn_expr = convert_oxc_expression(allocator, &call.callee, source_text)?; // Convert arguments - let mut args = OxcVec::with_capacity_in(call.arguments.len(), allocator); + let mut args = OxcVec::with_capacity_in(call.arguments.len(), &allocator); for arg in &call.arguments { match arg { Argument::SpreadElement(spread) => { @@ -377,13 +377,13 @@ fn convert_call_expression_with_optional<'a>( Some(OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(fn_expr, allocator), + fn_expr: Box::new_in(fn_expr, &allocator), args, pure: false, optional, source_span: None, }, - allocator, + &allocator, ))) } @@ -397,7 +397,7 @@ fn convert_new_expression<'a>( let class_expr = convert_oxc_expression(allocator, &new_expr.callee, source_text)?; // Convert arguments - let mut args = OxcVec::with_capacity_in(new_expr.arguments.len(), allocator); + let mut args = OxcVec::with_capacity_in(new_expr.arguments.len(), &allocator); for arg in &new_expr.arguments { match arg { Argument::SpreadElement(spread) => { @@ -413,8 +413,12 @@ fn convert_new_expression<'a>( } Some(OutputExpression::Instantiate(Box::new_in( - InstantiateExpr { class_expr: Box::new_in(class_expr, allocator), args, source_span: None }, - allocator, + InstantiateExpr { + class_expr: Box::new_in(class_expr, &allocator), + args, + source_span: None, + }, + &allocator, ))) } @@ -425,7 +429,7 @@ fn convert_arrow_function_expression<'a>( source_text: Option<&'a str>, ) -> Option> { // Convert parameters - let mut params = OxcVec::with_capacity_in(arrow.params.items.len(), allocator); + let mut params = OxcVec::with_capacity_in(arrow.params.items.len(), &allocator); for param in &arrow.params.items { // For simplicity, only handle identifier patterns if let BindingPattern::BindingIdentifier(id) = ¶m.pattern { @@ -442,7 +446,9 @@ fn convert_arrow_function_expression<'a>( let expr_body = arrow.body.statements.first()?; if let oxc_ast::ast::Statement::ExpressionStatement(expr_stmt) = expr_body { match convert_oxc_expression(allocator, &expr_stmt.expression, source_text) { - Some(converted) => ArrowFunctionBody::Expression(Box::new_in(converted, allocator)), + Some(converted) => { + ArrowFunctionBody::Expression(Box::new_in(converted, &allocator)) + } None => { // Unsupported expression (e.g., await, yield, class) — // fall back to raw source for the entire arrow @@ -456,7 +462,7 @@ fn convert_arrow_function_expression<'a>( // Block body: () => { ... } // If any statement cannot be converted, fall back to raw source to avoid // silently dropping statements (which corrupts the function body). - let mut statements = OxcVec::with_capacity_in(arrow.body.statements.len(), allocator); + let mut statements = OxcVec::with_capacity_in(arrow.body.statements.len(), &allocator); for stmt in &arrow.body.statements { match convert_statement(allocator, stmt, source_text) { Some(output_stmt) => statements.push(output_stmt), @@ -471,7 +477,7 @@ fn convert_arrow_function_expression<'a>( Some(OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { params, body, source_span: None }, - allocator, + &allocator, ))) } @@ -495,19 +501,19 @@ fn convert_statement<'a>( .unwrap_or_else(|| { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Undefined, source_span: None }, - allocator, + &allocator, )) }); Some(OutputStatement::Return(Box::new_in( ReturnStatement { value, source_span: None }, - allocator, + &allocator, ))) } oxc_ast::ast::Statement::ExpressionStatement(expr_stmt) => { let expr = convert_oxc_expression(allocator, &expr_stmt.expression, source_text)?; Some(OutputStatement::Expression(Box::new_in( super::ast::ExpressionStatement { expr, source_span: None }, - allocator, + &allocator, ))) } // Other statement types not supported — caller should fall back to raw source @@ -525,34 +531,34 @@ fn convert_unary_expression<'a>( match unary.operator { OxcUnaryOperator::LogicalNot => Some(OutputExpression::Not(Box::new_in( - NotExpr { condition: Box::new_in(expr, allocator), source_span: None }, - allocator, + NotExpr { condition: Box::new_in(expr, &allocator), source_span: None }, + &allocator, ))), OxcUnaryOperator::Typeof => Some(OutputExpression::Typeof(Box::new_in( - TypeofExpr { expr: Box::new_in(expr, allocator), source_span: None }, - allocator, + TypeofExpr { expr: Box::new_in(expr, &allocator), source_span: None }, + &allocator, ))), OxcUnaryOperator::Void => Some(OutputExpression::Void(Box::new_in( - VoidExpr { expr: Box::new_in(expr, allocator), source_span: None }, - allocator, + VoidExpr { expr: Box::new_in(expr, &allocator), source_span: None }, + &allocator, ))), OxcUnaryOperator::UnaryPlus => Some(OutputExpression::UnaryOperator(Box::new_in( UnaryOperatorExpr { operator: UnaryOperator::Plus, - expr: Box::new_in(expr, allocator), + expr: Box::new_in(expr, &allocator), parens: false, source_span: None, }, - allocator, + &allocator, ))), OxcUnaryOperator::UnaryNegation => Some(OutputExpression::UnaryOperator(Box::new_in( UnaryOperatorExpr { operator: UnaryOperator::Minus, - expr: Box::new_in(expr, allocator), + expr: Box::new_in(expr, &allocator), parens: false, source_span: None, }, - allocator, + &allocator, ))), // BitwiseNot and Delete operators not directly supported in OutputExpression OxcUnaryOperator::BitwiseNot | OxcUnaryOperator::Delete => None, @@ -566,7 +572,7 @@ fn convert_template_literal<'a>( source_text: Option<&'a str>, ) -> Option> { // Convert quasis to template literal elements - let mut elements = OxcVec::with_capacity_in(tpl.quasis.len(), allocator); + let mut elements = OxcVec::with_capacity_in(tpl.quasis.len(), &allocator); for quasi in &tpl.quasis { let text = quasi .value @@ -583,14 +589,14 @@ fn convert_template_literal<'a>( } // Convert expressions - let mut expressions = OxcVec::with_capacity_in(tpl.expressions.len(), allocator); + let mut expressions = OxcVec::with_capacity_in(tpl.expressions.len(), &allocator); for expr in &tpl.expressions { expressions.push(convert_oxc_expression(allocator, expr, source_text)?); } Some(OutputExpression::TemplateLiteral(Box::new_in( TemplateLiteralExpr { elements, expressions, source_span: None }, - allocator, + &allocator, ))) } @@ -619,24 +625,24 @@ fn convert_chain_element<'a>( let index = convert_oxc_expression(allocator, &member.expression, source_text)?; Some(OutputExpression::ReadKey(Box::new_in( ReadKeyExpr { - receiver: Box::new_in(receiver, allocator), - index: Box::new_in(index, allocator), + receiver: Box::new_in(receiver, &allocator), + index: Box::new_in(index, &allocator), optional: member.optional, source_span: None, }, - allocator, + &allocator, ))) } ChainElement::StaticMemberExpression(member) => { let receiver = convert_oxc_expression(allocator, &member.object, source_text)?; Some(OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(receiver, allocator), + receiver: Box::new_in(receiver, &allocator), name: member.property.name.clone().into(), optional: member.optional, source_span: None, }, - allocator, + &allocator, ))) } ChainElement::PrivateFieldExpression(_) => { @@ -692,7 +698,7 @@ fn make_raw_source<'a>( let js = strip_expression_types(raw); Some(OutputExpression::RawSource(Box::new_in( RawSourceExpr { source: Ident::from(allocator.alloc_str(&js)), source_span: None }, - allocator, + &allocator, ))) } diff --git a/crates/oxc_angular_compiler/src/parser/expression/lexer.rs b/crates/oxc_angular_compiler/src/parser/expression/lexer.rs index d84816936..f0680c00e 100644 --- a/crates/oxc_angular_compiler/src/parser/expression/lexer.rs +++ b/crates/oxc_angular_compiler/src/parser/expression/lexer.rs @@ -97,7 +97,7 @@ impl<'a> Token<'a> { index, end, code as u32 as f64, - Ident::from_in(String::from(code), allocator), + Ident::from_in(String::from(code), &allocator), StringTokenKind::Plain, ) } @@ -109,7 +109,7 @@ impl<'a> Token<'a> { index, end, 0.0, - Ident::from_in(text, allocator), + Ident::from_in(text, &allocator), StringTokenKind::Plain, ) } @@ -121,7 +121,7 @@ impl<'a> Token<'a> { index, end, 0.0, - Ident::from_in(text, allocator), + Ident::from_in(text, &allocator), StringTokenKind::Plain, ) } @@ -133,7 +133,7 @@ impl<'a> Token<'a> { index, end, 0.0, - Ident::from_in(text, allocator), + Ident::from_in(text, &allocator), StringTokenKind::Plain, ) } @@ -145,7 +145,7 @@ impl<'a> Token<'a> { index, end, 0.0, - Ident::from_in(text, allocator), + Ident::from_in(text, &allocator), StringTokenKind::Plain, ) } @@ -157,7 +157,7 @@ impl<'a> Token<'a> { index, end, 0.0, - Ident::from_in(text, allocator), + Ident::from_in(text, &allocator), StringTokenKind::Plain, ) } @@ -169,7 +169,7 @@ impl<'a> Token<'a> { index, end, value, - Ident::from_in("", allocator), + Ident::from_in("", &allocator), StringTokenKind::Plain, ) } @@ -181,7 +181,7 @@ impl<'a> Token<'a> { index, end, 0.0, - Ident::from_in(message, allocator), + Ident::from_in(message, &allocator), StringTokenKind::Plain, ) } @@ -198,7 +198,7 @@ impl<'a> Token<'a> { index, end, 0.0, - Ident::from_in(text, allocator), + Ident::from_in(text, &allocator), StringTokenKind::TemplateLiteralEnd, ) } @@ -210,7 +210,7 @@ impl<'a> Token<'a> { index, end, 0.0, - Ident::from_in(text, allocator), + Ident::from_in(text, &allocator), StringTokenKind::TemplateLiteralPart, ) } @@ -222,7 +222,7 @@ impl<'a> Token<'a> { index, end, 0.0, - Ident::from_in(text, allocator), + Ident::from_in(text, &allocator), StringTokenKind::TemplateLiteralPart, ) } @@ -234,7 +234,7 @@ impl<'a> Token<'a> { index, end, 0.0, - Ident::from_in(text, allocator), + Ident::from_in(text, &allocator), StringTokenKind::TemplateLiteralEnd, ) } @@ -246,7 +246,7 @@ impl<'a> Token<'a> { index, end, 0.0, - Ident::from_in(text, allocator), + Ident::from_in(text, &allocator), StringTokenKind::Plain, ) } @@ -258,7 +258,7 @@ impl<'a> Token<'a> { index, end, 0.0, - Ident::from_in(text, allocator), + Ident::from_in(text, &allocator), StringTokenKind::Plain, ) } @@ -709,13 +709,13 @@ impl<'a> Lexer<'a> { /// Scans a character token. fn scan_character(&mut self, start: u32, ch: char) { - let token = Token::new_character(start, self.index, ch, self.allocator); + let token = Token::new_character(start, self.index, ch, &self.allocator); self.tokens.push(token); } /// Scans an operator token. fn scan_operator(&mut self, start: u32, op: &str) { - let token = Token::new_operator(start, self.index, op, self.allocator); + let token = Token::new_operator(start, self.index, op, &self.allocator); self.tokens.push(token); } @@ -727,9 +727,9 @@ impl<'a> Lexer<'a> { let text = &self.input[start as usize..self.index as usize]; let token = if KEYWORDS.contains(&text) { - Token::new_keyword(start, self.index, text, self.allocator) + Token::new_keyword(start, self.index, text, &self.allocator) } else { - Token::new_identifier(start, self.index, text, self.allocator) + Token::new_identifier(start, self.index, text, &self.allocator) }; self.tokens.push(token); } @@ -743,7 +743,7 @@ impl<'a> Lexer<'a> { // Include the # in the str_value to match Angular's TypeScript implementation let text = &self.input[start as usize..self.index as usize]; - let token = Token::new_private_identifier(start, self.index, text, self.allocator); + let token = Token::new_private_identifier(start, self.index, text, &self.allocator); self.tokens.push(token); } @@ -877,7 +877,7 @@ impl<'a> Lexer<'a> { cleaned_text.parse::().unwrap_or(0) as f64 }; - let token = Token::new_number(start, self.index, value, self.allocator); + let token = Token::new_number(start, self.index, value, &self.allocator); self.tokens.push(token); } @@ -893,7 +893,7 @@ impl<'a> Lexer<'a> { let text = &self.input[(start + 2) as usize..self.index as usize]; let text = text.replace('_', ""); let value = i64::from_str_radix(&text, 16).unwrap_or(0) as f64; - let token = Token::new_number(start, self.index, value, self.allocator); + let token = Token::new_number(start, self.index, value, &self.allocator); self.tokens.push(token); } @@ -909,7 +909,7 @@ impl<'a> Lexer<'a> { let text = &self.input[(start + 2) as usize..self.index as usize]; let text = text.replace('_', ""); let value = i64::from_str_radix(&text, 8).unwrap_or(0) as f64; - let token = Token::new_number(start, self.index, value, self.allocator); + let token = Token::new_number(start, self.index, value, &self.allocator); self.tokens.push(token); } @@ -925,7 +925,7 @@ impl<'a> Lexer<'a> { let text = &self.input[(start + 2) as usize..self.index as usize]; let text = text.replace('_', ""); let value = i64::from_str_radix(&text, 2).unwrap_or(0) as f64; - let token = Token::new_number(start, self.index, value, self.allocator); + let token = Token::new_number(start, self.index, value, &self.allocator); self.tokens.push(token); } @@ -958,7 +958,7 @@ impl<'a> Lexer<'a> { } } - let token = Token::new_string(start, self.index, &result, self.allocator); + let token = Token::new_string(start, self.index, &result, &self.allocator); self.tokens.push(token); } @@ -987,7 +987,7 @@ impl<'a> Lexer<'a> { part_start, self.index, &result, - self.allocator, + &self.allocator, ); self.tokens.push(token); return; @@ -995,7 +995,8 @@ impl<'a> Lexer<'a> { if ch == chars::DOLLAR && self.peek_at(1) == chars::LBRACE { // Start of substitution - create TemplateHead ending at current position let head_end = self.index; - let token = Token::new_template_head(part_start, head_end, &result, self.allocator); + let token = + Token::new_template_head(part_start, head_end, &result, &self.allocator); self.tokens.push(token); // Emit the ${ as an operator token @@ -1003,7 +1004,7 @@ impl<'a> Lexer<'a> { self.advance(); // $ self.advance(); // { let interp_token = - Token::new_operator(interp_start, self.index, "${", self.allocator); + Token::new_operator(interp_start, self.index, "${", &self.allocator); self.tokens.push(interp_token); // Scan the expression tokens inside ${...} @@ -1087,7 +1088,7 @@ impl<'a> Lexer<'a> { self.advance(); // End of template - create TemplateTail let token = - Token::new_template_tail(part_start, self.index, &result, self.allocator); + Token::new_template_tail(part_start, self.index, &result, &self.allocator); self.tokens.push(token); return; } @@ -1095,7 +1096,7 @@ impl<'a> Lexer<'a> { // Another substitution - create TemplateMiddle ending at current position let middle_end = self.index; let token = - Token::new_template_middle(part_start, middle_end, &result, self.allocator); + Token::new_template_middle(part_start, middle_end, &result, &self.allocator); self.tokens.push(token); // Emit the ${ as an operator token @@ -1103,7 +1104,7 @@ impl<'a> Lexer<'a> { self.advance(); // $ self.advance(); // { let interp_token = - Token::new_operator(interp_start, self.index, "${", self.allocator); + Token::new_operator(interp_start, self.index, "${", &self.allocator); self.tokens.push(interp_token); // Scan the expression tokens @@ -1372,13 +1373,13 @@ impl<'a> Lexer<'a> { /// Records an error with the current position as the end. fn error(&mut self, start: u32, message: &str) { - let token = Token::new_error(start, self.index, message, self.allocator); + let token = Token::new_error(start, self.index, message, &self.allocator); self.tokens.push(token); } /// Records an error at specific index and end positions. fn error_at(&mut self, index: u32, end: u32, message: &str) { - let token = Token::new_error(index, end, message, self.allocator); + let token = Token::new_error(index, end, message, &self.allocator); self.tokens.push(token); } @@ -1441,7 +1442,7 @@ impl<'a> Lexer<'a> { let body_end = self.index; // Create the body token (just the pattern, not including slashes) - let body_token = Token::new_regexp_body(start, body_end, &pattern, self.allocator); + let body_token = Token::new_regexp_body(start, body_end, &pattern, &self.allocator); self.tokens.push(body_token); // Scan flags @@ -1454,7 +1455,7 @@ impl<'a> Lexer<'a> { if self.index > flags_start { let flags = &self.input[flags_start as usize..self.index as usize]; let flags_token = - Token::new_regexp_flags(flags_start, self.index, flags, self.allocator); + Token::new_regexp_flags(flags_start, self.index, flags, &self.allocator); self.tokens.push(flags_token); // Validate flags (this reports errors but doesn't prevent token creation) diff --git a/crates/oxc_angular_compiler/src/parser/expression/parser.rs b/crates/oxc_angular_compiler/src/parser/expression/parser.rs index 0b11d94ad..52cd9d8d2 100644 --- a/crates/oxc_angular_compiler/src/parser/expression/parser.rs +++ b/crates/oxc_angular_compiler/src/parser/expression/parser.rs @@ -314,17 +314,17 @@ impl<'a> Parser<'a> { let source_span = span.to_absolute(absolute_offset); let value = match input { - Some(s) => LiteralValue::String(Ident::from_in(s, self.allocator)), + Some(s) => LiteralValue::String(Ident::from_in(s, &self.allocator)), None => LiteralValue::Null, }; let literal = LiteralPrimitive { span, source_span, value }; - let ast = AngularExpression::LiteralPrimitive(Box::new_in(literal, self.allocator)); + let ast = AngularExpression::LiteralPrimitive(Box::new_in(literal, &self.allocator)); ASTWithSource { ast, - source: input.map(|s| Ident::from_in(s, self.allocator)), - location: Ident::from_in(location, self.allocator), + source: input.map(|s| Ident::from_in(s, &self.allocator)), + location: Ident::from_in(location, &self.allocator), absolute_offset, } } @@ -472,7 +472,7 @@ impl<'a> Parser<'a> { mut self, template_key: TemplateBindingIdentifier<'a>, ) -> TemplateBindingParseResult<'a> { - let mut bindings = Vec::new_in(self.allocator); + let mut bindings = Vec::new_in(&self.allocator); let mut errors = std::vec::Vec::new(); let warnings = std::vec::Vec::new(); @@ -512,8 +512,8 @@ impl<'a> Parser<'a> { } else { Some(ASTWithSource { ast: value, - source: Some(Ident::from_in(value_source, self.allocator)), - location: Ident::from_in("", self.allocator), + source: Some(Ident::from_in(value_source, &self.allocator)), + location: Ident::from_in("", &self.allocator), absolute_offset: self.absolute_offset + start, }) }; @@ -597,7 +597,7 @@ impl<'a> Parser<'a> { end: u32, ) -> TemplateBindingIdentifier<'a> { TemplateBindingIdentifier { - source: Ident::from_in(source, self.allocator), + source: Ident::from_in(source, &self.allocator), span: AbsoluteSourceSpan::new(start, end), } } @@ -747,8 +747,8 @@ impl<'a> Parser<'a> { let value_source = &self.source[expr_start as usize..value_end as usize]; let ast_with_source = ASTWithSource { ast: value, - source: Some(Ident::from_in(value_source, self.allocator)), - location: Ident::from_in("", self.allocator), + source: Some(Ident::from_in(value_source, &self.allocator)), + location: Ident::from_in("", &self.allocator), absolute_offset: self.absolute_offset + expr_start, }; @@ -822,7 +822,7 @@ impl<'a> Parser<'a> { self.advance(); // Parse pipe arguments (stop at `;`, `,`, or `as`) - let mut args = Vec::new_in(self.allocator); + let mut args = Vec::new_in(&self.allocator); while self.optional_character(':') { // Check for terminators if self @@ -856,7 +856,7 @@ impl<'a> Parser<'a> { args, pipe_type: BindingPipeType::ReferencedByName, }; - result = AngularExpression::BindingPipe(Box::new_in(pipe, self.allocator)); + result = AngularExpression::BindingPipe(Box::new_in(pipe, &self.allocator)); } else { self.error("expected identifier or keyword"); break; @@ -979,8 +979,8 @@ impl<'a> Parser<'a> { let start_len = start_delimiter.len(); let end_len = end_delimiter.len(); - let mut strings = Vec::new_in(self.allocator); - let mut expressions = Vec::new_in(self.allocator); + let mut strings = Vec::new_in(&self.allocator); + let mut expressions = Vec::new_in(&self.allocator); let mut current_pos = 0; @@ -996,13 +996,13 @@ impl<'a> Parser<'a> { { // Add text before the interpolation let text = &self.source[current_pos..abs_start]; - strings.push(Ident::from_in(text, self.allocator)); + strings.push(Ident::from_in(text, &self.allocator)); let expr_text = &self.source[expr_start..expr_start + end_idx]; // Parse the expression let expr_parser = Parser::with_offset( - self.allocator, + &self.allocator, expr_text, self.absolute_offset + expr_start as u32, ); @@ -1016,13 +1016,13 @@ impl<'a> Parser<'a> { // Treat the {{ and everything after as literal text // by adding all remaining text to strings and exiting let text = &self.source[current_pos..]; - strings.push(Ident::from_in(text, self.allocator)); + strings.push(Ident::from_in(text, &self.allocator)); break; } } else { // No more interpolations - add remaining text and exit let text = &self.source[current_pos..]; - strings.push(Ident::from_in(text, self.allocator)); + strings.push(Ident::from_in(text, &self.allocator)); break; } } @@ -1031,7 +1031,7 @@ impl<'a> Parser<'a> { // all input including the last "}}"), we still need to add the trailing string. // This ensures strings.len() == expressions.len() + 1 for proper interleaving. if !expressions.is_empty() && strings.len() == expressions.len() { - strings.push(Ident::from_in("", self.allocator)); + strings.push(Ident::from_in("", &self.allocator)); } if expressions.is_empty() { @@ -1041,7 +1041,7 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(0, self.source.len() as u32); let source_span = span.to_absolute(self.absolute_offset); let interpolation = Interpolation { span, source_span, strings, expressions }; - let ast = AngularExpression::Interpolation(Box::new_in(interpolation, self.allocator)); + let ast = AngularExpression::Interpolation(Box::new_in(interpolation, &self.allocator)); Some(ParseResult { ast, errors: self.errors }) } @@ -1334,7 +1334,7 @@ impl<'a> Parser<'a> { /// Parses a chain of expressions. fn parse_chain(&mut self) -> AngularExpression<'a> { - let mut expressions = Vec::new_in(self.allocator); + let mut expressions = Vec::new_in(&self.allocator); let start = self.peek().map(|t| t.index).unwrap_or(0); loop { @@ -1381,7 +1381,7 @@ impl<'a> Parser<'a> { let source_span = span.to_absolute(self.absolute_offset); return AngularExpression::Empty(Box::new_in( EmptyExpr { span, source_span }, - self.allocator, + &self.allocator, )); } @@ -1389,7 +1389,7 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(start, end); let source_span = span.to_absolute(self.absolute_offset); let chain = Chain { span, source_span, expressions }; - AngularExpression::Chain(Box::new_in(chain, self.allocator)) + AngularExpression::Chain(Box::new_in(chain, &self.allocator)) } /// Parses an expression. @@ -1414,14 +1414,14 @@ impl<'a> Parser<'a> { let empty_source_span = empty_span.to_absolute(self.absolute_offset); let true_exp = AngularExpression::Empty(Box::new_in( EmptyExpr { span: empty_span, source_span: empty_source_span }, - self.allocator, + &self.allocator, )); let false_exp = AngularExpression::Empty(Box::new_in( EmptyExpr { span: empty_span, source_span: empty_source_span }, - self.allocator, + &self.allocator, )); let cond = Conditional { span, source_span, condition, true_exp, false_exp }; - return AngularExpression::Conditional(Box::new_in(cond, self.allocator)); + return AngularExpression::Conditional(Box::new_in(cond, &self.allocator)); } let true_exp = self.parse_pipe(); @@ -1438,7 +1438,7 @@ impl<'a> Parser<'a> { let empty_source_span = empty_span.to_absolute(self.absolute_offset); AngularExpression::Empty(Box::new_in( EmptyExpr { span: empty_span, source_span: empty_source_span }, - self.allocator, + &self.allocator, )) }; @@ -1446,7 +1446,7 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(start, end); let source_span = span.to_absolute(self.absolute_offset); let cond = Conditional { span, source_span, condition, true_exp, false_exp }; - return AngularExpression::Conditional(Box::new_in(cond, self.allocator)); + return AngularExpression::Conditional(Box::new_in(cond, &self.allocator)); } condition @@ -1469,7 +1469,7 @@ impl<'a> Parser<'a> { left, right, }; - left = AngularExpression::Binary(Box::new_in(binary, self.allocator)); + left = AngularExpression::Binary(Box::new_in(binary, &self.allocator)); } left @@ -1486,7 +1486,7 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(start, end); let source_span = span.to_absolute(self.absolute_offset); let binary = Binary { span, source_span, operation: BinaryOperator::Or, left, right }; - left = AngularExpression::Binary(Box::new_in(binary, self.allocator)); + left = AngularExpression::Binary(Box::new_in(binary, &self.allocator)); } left @@ -1503,7 +1503,7 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(start, end); let source_span = span.to_absolute(self.absolute_offset); let binary = Binary { span, source_span, operation: BinaryOperator::And, left, right }; - left = AngularExpression::Binary(Box::new_in(binary, self.allocator)); + left = AngularExpression::Binary(Box::new_in(binary, &self.allocator)); } left @@ -1533,7 +1533,7 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(start, end); let source_span = span.to_absolute(self.absolute_offset); let binary = Binary { span, source_span, operation, left, right }; - left = AngularExpression::Binary(Box::new_in(binary, self.allocator)); + left = AngularExpression::Binary(Box::new_in(binary, &self.allocator)); } else { break; } @@ -1570,7 +1570,7 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(start, end); let source_span = span.to_absolute(self.absolute_offset); let binary = Binary { span, source_span, operation, left, right }; - left = AngularExpression::Binary(Box::new_in(binary, self.allocator)); + left = AngularExpression::Binary(Box::new_in(binary, &self.allocator)); } else { break; } @@ -1618,7 +1618,7 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(start, end); let source_span = span.to_absolute(self.absolute_offset); let binary = Binary { span, source_span, operation, left, right }; - left = AngularExpression::Binary(Box::new_in(binary, self.allocator)); + left = AngularExpression::Binary(Box::new_in(binary, &self.allocator)); } else { break; } @@ -1649,7 +1649,7 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(start, end); let source_span = span.to_absolute(self.absolute_offset); let binary = Binary { span, source_span, operation, left, right }; - left = AngularExpression::Binary(Box::new_in(binary, self.allocator)); + left = AngularExpression::Binary(Box::new_in(binary, &self.allocator)); } else { break; } @@ -1690,7 +1690,7 @@ impl<'a> Parser<'a> { let source_span = span.to_absolute(self.absolute_offset); let binary = Binary { span, source_span, operation: BinaryOperator::Power, left: result, right }; - result = AngularExpression::Binary(Box::new_in(binary, self.allocator)); + result = AngularExpression::Binary(Box::new_in(binary, &self.allocator)); } result @@ -1706,7 +1706,7 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(start, end); let source_span = span.to_absolute(self.absolute_offset); let unary = Unary { span, source_span, operator: UnaryOperator::Plus, expr }; - return AngularExpression::Unary(Box::new_in(unary, self.allocator)); + return AngularExpression::Unary(Box::new_in(unary, &self.allocator)); } if self.optional_operator("-") { @@ -1715,7 +1715,7 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(start, end); let source_span = span.to_absolute(self.absolute_offset); let unary = Unary { span, source_span, operator: UnaryOperator::Minus, expr }; - return AngularExpression::Unary(Box::new_in(unary, self.allocator)); + return AngularExpression::Unary(Box::new_in(unary, &self.allocator)); } if self.optional_operator("!") { @@ -1724,7 +1724,7 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(start, end); let source_span = span.to_absolute(self.absolute_offset); let prefix_not = PrefixNot { span, source_span, expression }; - return AngularExpression::PrefixNot(Box::new_in(prefix_not, self.allocator)); + return AngularExpression::PrefixNot(Box::new_in(prefix_not, &self.allocator)); } // Handle typeof keyword @@ -1734,7 +1734,7 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(start, end); let source_span = span.to_absolute(self.absolute_offset); let typeof_expr = TypeofExpression { span, source_span, expression }; - return AngularExpression::TypeofExpression(Box::new_in(typeof_expr, self.allocator)); + return AngularExpression::TypeofExpression(Box::new_in(typeof_expr, &self.allocator)); } // Handle void keyword @@ -1744,7 +1744,7 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(start, end); let source_span = span.to_absolute(self.absolute_offset); let void_expr = VoidExpression { span, source_span, expression }; - return AngularExpression::VoidExpression(Box::new_in(void_expr, self.allocator)); + return AngularExpression::VoidExpression(Box::new_in(void_expr, &self.allocator)); } self.parse_call_chain() @@ -1779,7 +1779,7 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(start, end); let source_span = span.to_absolute(self.absolute_offset); let assert = NonNullAssert { span, source_span, expression: result }; - result = AngularExpression::NonNullAssert(Box::new_in(assert, self.allocator)); + result = AngularExpression::NonNullAssert(Box::new_in(assert, &self.allocator)); } else if let Some(token) = self.peek() { // Handle tagged template literals: tag`template` // Only NoSubstitutionTemplate and TemplateHead can start a tagged template @@ -1837,7 +1837,7 @@ impl<'a> Parser<'a> { left: result, right, }; - return AngularExpression::Binary(Box::new_in(binary, self.allocator)); + return AngularExpression::Binary(Box::new_in(binary, &self.allocator)); } } } @@ -1865,7 +1865,7 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(start, end); let source_span = span.to_absolute(self.absolute_offset); let name_span = source_span; - let empty_name = Ident::from_in("", self.allocator); + let empty_name = Ident::from_in("", &self.allocator); if safe { let read = SafePropertyRead { span, @@ -1874,11 +1874,11 @@ impl<'a> Parser<'a> { receiver, name: empty_name, }; - return AngularExpression::SafePropertyRead(Box::new_in(read, self.allocator)); + return AngularExpression::SafePropertyRead(Box::new_in(read, &self.allocator)); } let read = PropertyRead { span, source_span, name_span, receiver, name: empty_name }; - return AngularExpression::PropertyRead(Box::new_in(read, self.allocator)); + return AngularExpression::PropertyRead(Box::new_in(read, &self.allocator)); } if token.is_identifier() || token.is_keyword() { @@ -1910,12 +1910,12 @@ impl<'a> Parser<'a> { self.error("The '?.' operator cannot be used in the assignment"); return AngularExpression::Empty(Box::new_in( EmptyExpr { span, source_span }, - self.allocator, + &self.allocator, )); } } let read = SafePropertyRead { span, source_span, name_span, receiver, name }; - return AngularExpression::SafePropertyRead(Box::new_in(read, self.allocator)); + return AngularExpression::SafePropertyRead(Box::new_in(read, &self.allocator)); } // Check for assignment operator (in action mode only) @@ -1935,7 +1935,7 @@ impl<'a> Parser<'a> { PropertyRead { span, source_span, name_span, receiver, name }; let left = AngularExpression::PropertyRead(Box::new_in( property_read, - self.allocator, + &self.allocator, )); // Consume the assignment operator @@ -1961,11 +1961,11 @@ impl<'a> Parser<'a> { left, right, }; - return AngularExpression::Binary(Box::new_in(binary, self.allocator)); + return AngularExpression::Binary(Box::new_in(binary, &self.allocator)); } } let read = PropertyRead { span, source_span, name_span, receiver, name }; - return AngularExpression::PropertyRead(Box::new_in(read, self.allocator)); + return AngularExpression::PropertyRead(Box::new_in(read, &self.allocator)); } } @@ -1994,12 +1994,12 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(start, end); let source_span = span.to_absolute(self.absolute_offset); let name_span = source_span; // Empty name span at end - let empty_name = Ident::from_in("", self.allocator); + let empty_name = Ident::from_in("", &self.allocator); if safe { let read = SafePropertyRead { span, source_span, name_span, receiver, name: empty_name }; - return AngularExpression::SafePropertyRead(Box::new_in(read, self.allocator)); + return AngularExpression::SafePropertyRead(Box::new_in(read, &self.allocator)); } // Check for assignment operator (in action mode only) - error recovery @@ -2011,7 +2011,7 @@ impl<'a> Parser<'a> { let property_read = PropertyRead { span, source_span, name_span, receiver, name: empty_name }; let left = - AngularExpression::PropertyRead(Box::new_in(property_read, self.allocator)); + AngularExpression::PropertyRead(Box::new_in(property_read, &self.allocator)); // Consume the assignment operator self.advance(); @@ -2031,12 +2031,12 @@ impl<'a> Parser<'a> { left, right, }; - return AngularExpression::Binary(Box::new_in(binary, self.allocator)); + return AngularExpression::Binary(Box::new_in(binary, &self.allocator)); } } let read = PropertyRead { span, source_span, name_span, receiver, name: empty_name }; - AngularExpression::PropertyRead(Box::new_in(read, self.allocator)) + AngularExpression::PropertyRead(Box::new_in(read, &self.allocator)) } /// Parses keyed read with an explicit start position for span calculation. @@ -2081,7 +2081,7 @@ impl<'a> Parser<'a> { self.error("The '?.' operator cannot be used in the assignment"); return AngularExpression::Empty(Box::new_in( EmptyExpr { span, source_span }, - self.allocator, + &self.allocator, )); } @@ -2094,7 +2094,7 @@ impl<'a> Parser<'a> { // Create KeyedRead as the assignment target let keyed_read = KeyedRead { span, source_span, receiver, key }; - let left = AngularExpression::KeyedRead(Box::new_in(keyed_read, self.allocator)); + let left = AngularExpression::KeyedRead(Box::new_in(keyed_read, &self.allocator)); // Consume the assignment operator self.advance(); @@ -2119,16 +2119,16 @@ impl<'a> Parser<'a> { left, right, }; - return AngularExpression::Binary(Box::new_in(binary, self.allocator)); + return AngularExpression::Binary(Box::new_in(binary, &self.allocator)); } } if safe { let read = SafeKeyedRead { span, source_span, receiver, key }; - AngularExpression::SafeKeyedRead(Box::new_in(read, self.allocator)) + AngularExpression::SafeKeyedRead(Box::new_in(read, &self.allocator)) } else { let read = KeyedRead { span, source_span, receiver, key }; - AngularExpression::KeyedRead(Box::new_in(read, self.allocator)) + AngularExpression::KeyedRead(Box::new_in(read, &self.allocator)) } } @@ -2152,10 +2152,10 @@ impl<'a> Parser<'a> { if safe { let call = SafeCall { span, source_span, receiver, args, argument_span }; - AngularExpression::SafeCall(Box::new_in(call, self.allocator)) + AngularExpression::SafeCall(Box::new_in(call, &self.allocator)) } else { let call = Call { span, source_span, receiver, args, argument_span }; - AngularExpression::Call(Box::new_in(call, self.allocator)) + AngularExpression::Call(Box::new_in(call, &self.allocator)) } } @@ -2180,10 +2180,10 @@ impl<'a> Parser<'a> { let method = if safe { let read = SafePropertyRead { span, source_span, name_span, receiver, name }; - AngularExpression::SafePropertyRead(Box::new_in(read, self.allocator)) + AngularExpression::SafePropertyRead(Box::new_in(read, &self.allocator)) } else { let read = PropertyRead { span, source_span, name_span, receiver, name }; - AngularExpression::PropertyRead(Box::new_in(read, self.allocator)) + AngularExpression::PropertyRead(Box::new_in(read, &self.allocator)) }; // Then parse the call, using the receiver's start for the call's span @@ -2194,7 +2194,7 @@ impl<'a> Parser<'a> { /// Note: The opening `(` was already consumed before calling this. fn parse_call_arguments(&mut self) -> (Vec<'a, AngularExpression<'a>>, u32) { self.rparens_expected += 1; - let mut args = Vec::new_in(self.allocator); + let mut args = Vec::new_in(&self.allocator); if !self.peek().map(|t| t.is_character(')')).unwrap_or(true) { loop { @@ -2270,11 +2270,11 @@ impl<'a> Parser<'a> { let token = self.peek().cloned(); self.advance(); if let Some(token) = token { - let mut vec = Vec::new_in(self.allocator); + let mut vec = Vec::new_in(&self.allocator); vec.push(self.get_arrow_function_identifier_arg(&token)); params = vec; } else { - params = Vec::new_in(self.allocator); + params = Vec::new_in(&self.allocator); } } else if self.peek().is_some_and(|t| t.is_character('(')) { // Parenthesized parameters: `() => ...` or `(a, b) => ...` @@ -2284,7 +2284,7 @@ impl<'a> Parser<'a> { self.rparens_expected -= 1; } else { // Error case - params = Vec::new_in(self.allocator); + params = Vec::new_in(&self.allocator); let token_str = self.peek().map(|t| t.str_value.to_string()).unwrap_or_else(|| "EOF".to_string()); self.error(&format!("Unexpected token {token_str}")); @@ -2300,7 +2300,7 @@ impl<'a> Parser<'a> { let source_span = span.to_absolute(self.absolute_offset); body = AngularExpression::Empty(Box::new_in( EmptyExpr { span, source_span }, - self.allocator, + &self.allocator, )); } else { // Arrow function can contain assignments even in a binding context @@ -2314,13 +2314,13 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(start, end); let source_span = span.to_absolute(self.absolute_offset); let arrow_fn = ArrowFunction { span, source_span, parameters: params, body }; - AngularExpression::ArrowFunction(Box::new_in(arrow_fn, self.allocator)) + AngularExpression::ArrowFunction(Box::new_in(arrow_fn, &self.allocator)) } /// Parses arrow function parameters inside parentheses. /// Note: The opening `(` was already consumed. fn parse_arrow_function_parameters(&mut self) -> Vec<'a, ArrowFunctionParameter<'a>> { - let mut params = Vec::new_in(self.allocator); + let mut params = Vec::new_in(&self.allocator); if !self.optional_character(')') { loop { @@ -2382,7 +2382,7 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(start, end); let source_span = span.to_absolute(self.absolute_offset); let paren = ParenthesizedExpression { span, source_span, expression }; - return AngularExpression::ParenthesizedExpression(Box::new_in(paren, self.allocator)); + return AngularExpression::ParenthesizedExpression(Box::new_in(paren, &self.allocator)); } // Array literal @@ -2407,7 +2407,7 @@ impl<'a> Parser<'a> { source_span, value: LiteralValue::Number(token.num_value), }; - return AngularExpression::LiteralPrimitive(Box::new_in(lit, self.allocator)); + return AngularExpression::LiteralPrimitive(Box::new_in(lit, &self.allocator)); } // String literal @@ -2420,7 +2420,7 @@ impl<'a> Parser<'a> { source_span, value: LiteralValue::String(token.str_value.clone()), }; - return AngularExpression::LiteralPrimitive(Box::new_in(lit, self.allocator)); + return AngularExpression::LiteralPrimitive(Box::new_in(lit, &self.allocator)); } // Template literal (no substitutions) @@ -2428,7 +2428,7 @@ impl<'a> Parser<'a> { self.advance(); let span = ParseSpan::new(token.index, token.end); let source_span = span.to_absolute(self.absolute_offset); - let mut elements = Vec::new_in(self.allocator); + let mut elements = Vec::new_in(&self.allocator); elements.push(TemplateLiteralElement { span, source_span, @@ -2438,9 +2438,9 @@ impl<'a> Parser<'a> { span, source_span, elements, - expressions: Vec::new_in(self.allocator), + expressions: Vec::new_in(&self.allocator), }; - return AngularExpression::TemplateLiteral(Box::new_in(tpl, self.allocator)); + return AngularExpression::TemplateLiteral(Box::new_in(tpl, &self.allocator)); } // Template literal (with substitutions) @@ -2468,7 +2468,7 @@ impl<'a> Parser<'a> { }; return AngularExpression::LiteralPrimitive(Box::new_in( lit, - self.allocator, + &self.allocator, )); } "false" => { @@ -2479,14 +2479,14 @@ impl<'a> Parser<'a> { }; return AngularExpression::LiteralPrimitive(Box::new_in( lit, - self.allocator, + &self.allocator, )); } "null" => { let lit = LiteralPrimitive { span, source_span, value: LiteralValue::Null }; return AngularExpression::LiteralPrimitive(Box::new_in( lit, - self.allocator, + &self.allocator, )); } "undefined" => { @@ -2494,14 +2494,14 @@ impl<'a> Parser<'a> { LiteralPrimitive { span, source_span, value: LiteralValue::Undefined }; return AngularExpression::LiteralPrimitive(Box::new_in( lit, - self.allocator, + &self.allocator, )); } "this" => { let receiver = ThisReceiver { span, source_span }; return AngularExpression::ThisReceiver(Box::new_in( receiver, - self.allocator, + &self.allocator, )); } _ => { @@ -2511,7 +2511,7 @@ impl<'a> Parser<'a> { // keyword reports "Unexpected token ". self.error(&format!("Unexpected token {}", token.str_value)); let empty = EmptyExpr { span, source_span }; - return AngularExpression::Empty(Box::new_in(empty, self.allocator)); + return AngularExpression::Empty(Box::new_in(empty, &self.allocator)); } } } @@ -2526,7 +2526,7 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(token.index, token.end); let source_span = span.to_absolute(self.absolute_offset); let empty = EmptyExpr { span, source_span }; - return AngularExpression::Empty(Box::new_in(empty, self.allocator)); + return AngularExpression::Empty(Box::new_in(empty, &self.allocator)); } // Identifier @@ -2542,7 +2542,7 @@ impl<'a> Parser<'a> { let implicit = ImplicitReceiver { span: implicit_span, source_span: implicit_source_span }; let receiver = - AngularExpression::ImplicitReceiver(Box::new_in(implicit, self.allocator)); + AngularExpression::ImplicitReceiver(Box::new_in(implicit, &self.allocator)); let name_span = source_span; let read = PropertyRead { span, @@ -2551,7 +2551,7 @@ impl<'a> Parser<'a> { receiver, name: token.str_value.clone(), }; - return AngularExpression::PropertyRead(Box::new_in(read, self.allocator)); + return AngularExpression::PropertyRead(Box::new_in(read, &self.allocator)); } } @@ -2568,14 +2568,14 @@ impl<'a> Parser<'a> { let span = self.make_span(start, self.current_end_index()); let source_span = span.to_absolute(self.absolute_offset); let empty = EmptyExpr { span, source_span }; - AngularExpression::Empty(Box::new_in(empty, self.allocator)) + AngularExpression::Empty(Box::new_in(empty, &self.allocator)) } /// Parses an array literal. /// Note: The opening `[` was already consumed before calling this. fn parse_array_literal(&mut self, start: u32) -> AngularExpression<'a> { self.rbrackets_expected += 1; - let mut expressions = Vec::new_in(self.allocator); + let mut expressions = Vec::new_in(&self.allocator); loop { if self.peek().map(|t| t.is_operator("...")).unwrap_or(false) { @@ -2597,15 +2597,15 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(start, end); let source_span = span.to_absolute(self.absolute_offset); let arr = LiteralArray { span, source_span, expressions }; - AngularExpression::LiteralArray(Box::new_in(arr, self.allocator)) + AngularExpression::LiteralArray(Box::new_in(arr, &self.allocator)) } /// Parses a template literal with substitutions. fn parse_template_literal(&mut self, start: u32, head: Token<'a>) -> AngularExpression<'a> { self.advance(); // Consume the TemplateHead token - let mut elements = Vec::new_in(self.allocator); - let mut expressions = Vec::new_in(self.allocator); + let mut elements = Vec::new_in(&self.allocator); + let mut expressions = Vec::new_in(&self.allocator); // Add the first element from TemplateHead let head_span = ParseSpan::new(head.index, head.end); @@ -2680,7 +2680,7 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(start, end); let source_span = span.to_absolute(self.absolute_offset); let tpl = TemplateLiteral { span, source_span, elements, expressions }; - AngularExpression::TemplateLiteral(Box::new_in(tpl, self.allocator)) + AngularExpression::TemplateLiteral(Box::new_in(tpl, &self.allocator)) } /// Parses a tagged template literal with an explicit start position for span calculation. @@ -2698,22 +2698,22 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(token.index, token.end); let source_span = span.to_absolute(self.absolute_offset); - let mut elements = Vec::new_in(self.allocator); + let mut elements = Vec::new_in(&self.allocator); elements.push(TemplateLiteralElement { span, source_span, text: token.str_value.clone(), }); - let expressions = Vec::new_in(self.allocator); + let expressions = Vec::new_in(&self.allocator); TemplateLiteral { span, source_span, elements, expressions } } else if token.is_template_head() { // Template with interpolations - reuse the same logic as parse_template_literal // but extract the TemplateLiteral directly self.advance(); - let mut elements = Vec::new_in(self.allocator); - let mut expressions = Vec::new_in(self.allocator); + let mut elements = Vec::new_in(&self.allocator); + let mut expressions = Vec::new_in(&self.allocator); // Add the first element from TemplateHead let head_span = ParseSpan::new(token.index, token.end); @@ -2784,7 +2784,7 @@ impl<'a> Parser<'a> { let source_span = span.to_absolute(self.absolute_offset); let tagged = TaggedTemplateLiteral { span, source_span, tag, template: template_expr }; - return AngularExpression::TaggedTemplateLiteral(Box::new_in(tagged, self.allocator)); + return AngularExpression::TaggedTemplateLiteral(Box::new_in(tagged, &self.allocator)); } // No template token found, just return the tag @@ -2813,15 +2813,15 @@ impl<'a> Parser<'a> { let source_span = span.to_absolute(self.absolute_offset); let regex = RegularExpressionLiteral { span, source_span, body, flags }; - AngularExpression::RegularExpressionLiteral(Box::new_in(regex, self.allocator)) + AngularExpression::RegularExpressionLiteral(Box::new_in(regex, &self.allocator)) } /// Parses an object literal. /// Note: The opening `{` was already consumed before calling this. fn parse_object_literal(&mut self, start: u32) -> AngularExpression<'a> { self.rbraces_expected += 1; - let mut keys = Vec::new_in(self.allocator); - let mut values = Vec::new_in(self.allocator); + let mut keys = Vec::new_in(&self.allocator); + let mut values = Vec::new_in(&self.allocator); if !self.peek().map(|t| t.is_character('}')).unwrap_or(true) { loop { @@ -2844,7 +2844,7 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(start, end); let source_span = span.to_absolute(self.absolute_offset); let obj = LiteralMap { span, source_span, keys, values }; - AngularExpression::LiteralMap(Box::new_in(obj, self.allocator)) + AngularExpression::LiteralMap(Box::new_in(obj, &self.allocator)) } /// Parses an object property. @@ -2885,14 +2885,14 @@ impl<'a> Parser<'a> { )); self.advance(); let key = LiteralMapKey::Property(LiteralMapPropertyKey { - key: Ident::from_in("", self.allocator), + key: Ident::from_in("", &self.allocator), quoted: false, is_shorthand_initialized: false, }); let span = ParseSpan::new(token_index, token_end); let source_span = span.to_absolute(self.absolute_offset); let empty = EmptyExpr { span, source_span }; - return (key, AngularExpression::Empty(Box::new_in(empty, self.allocator))); + return (key, AngularExpression::Empty(Box::new_in(empty, &self.allocator))); } // Identifier key @@ -2919,11 +2919,11 @@ impl<'a> Parser<'a> { let implicit = ImplicitReceiver { span: implicit_span, source_span: implicit_source_span }; let receiver = - AngularExpression::ImplicitReceiver(Box::new_in(implicit, self.allocator)); + AngularExpression::ImplicitReceiver(Box::new_in(implicit, &self.allocator)); let name_span = source_span; let read = PropertyRead { span, source_span, name_span, receiver, name: key_name }; - let value = AngularExpression::PropertyRead(Box::new_in(read, self.allocator)); + let value = AngularExpression::PropertyRead(Box::new_in(read, &self.allocator)); return (key, value); } @@ -2940,14 +2940,14 @@ impl<'a> Parser<'a> { self.error("Missing expected identifier, keyword, or string"); let key = LiteralMapKey::Property(LiteralMapPropertyKey { - key: Ident::from_in("", self.allocator), + key: Ident::from_in("", &self.allocator), quoted: false, is_shorthand_initialized: false, }); let span = ParseSpan::new(0, 0); let source_span = span.to_absolute(self.absolute_offset); let empty = EmptyExpr { span, source_span }; - (key, AngularExpression::Empty(Box::new_in(empty, self.allocator))) + (key, AngularExpression::Empty(Box::new_in(empty, &self.allocator))) } /// Parses a spread element: `...expr`. @@ -2963,7 +2963,7 @@ impl<'a> Parser<'a> { let span = ParseSpan::new(spread_start, end); let source_span = span.to_absolute(self.absolute_offset); let spread = SpreadElement { span, source_span, expression }; - AngularExpression::SpreadElement(Box::new_in(spread, self.allocator)) + AngularExpression::SpreadElement(Box::new_in(spread, &self.allocator)) } /// Parses a pipe expression. @@ -3010,17 +3010,17 @@ impl<'a> Parser<'a> { // The fullSpanEnd tracks whitespace after the pipe character let full_span_end = self.peek().map(|t| t.index).unwrap_or(self.source.len() as u32); - (Ident::from_in("", self.allocator), full_span_end, Some(full_span_end)) + (Ident::from_in("", &self.allocator), full_span_end, Some(full_span_end)) } } else { // End of input - create empty pipe name self.error("Unexpected end of input, expected identifier or keyword"); let end_pos = self.source.len() as u32; - (Ident::from_in("", self.allocator), end_pos, Some(end_pos)) + (Ident::from_in("", &self.allocator), end_pos, Some(end_pos)) }; // Parse pipe arguments - let mut args = Vec::new_in(self.allocator); + let mut args = Vec::new_in(&self.allocator); while self.optional_character(':') { let arg = self.parse_expression(); // Check for empty argument followed by | or EOF @@ -3055,7 +3055,7 @@ impl<'a> Parser<'a> { args, pipe_type: BindingPipeType::ReferencedByName, }; - result = AngularExpression::BindingPipe(Box::new_in(pipe, self.allocator)); + result = AngularExpression::BindingPipe(Box::new_in(pipe, &self.allocator)); // Continue if there's another pipe if !self.optional_operator("|") { diff --git a/crates/oxc_angular_compiler/src/parser/html/parser.rs b/crates/oxc_angular_compiler/src/parser/html/parser.rs index 27508c52e..161c12742 100644 --- a/crates/oxc_angular_compiler/src/parser/html/parser.rs +++ b/crates/oxc_angular_compiler/src/parser/html/parser.rs @@ -86,7 +86,7 @@ impl<'a> HtmlParser<'a> { leading_trivia_chars: std::vec::Vec, ) -> Self { Self::new_internal( - allocator, + &allocator, source, url, false, @@ -109,7 +109,7 @@ impl<'a> HtmlParser<'a> { options: &super::super::ParseTemplateOptions, ) -> Self { Self::new_internal( - allocator, + &allocator, source, url, options.enable_selectorless, @@ -204,15 +204,15 @@ impl<'a> HtmlParser<'a> { HtmlBlock { block_type: BlockType::If, name: Ident::from(""), - parameters: Vec::new_in(self.allocator), - children: Vec::new_in(self.allocator), + parameters: Vec::new_in(&self.allocator), + children: Vec::new_in(&self.allocator), span: Span::new(0, 0), name_span: Span::new(0, 0), start_span: Span::new(0, 0), end_span: None, }, ); - let node = HtmlNode::Block(Box::new_in(block, self.allocator)); + let node = HtmlNode::Block(Box::new_in(block, &self.allocator)); self.add_to_parent(node); } ContainerIndex::Element(idx) => { @@ -227,9 +227,9 @@ impl<'a> HtmlParser<'a> { name: Ident::from(""), component_prefix: None, component_tag_name: None, - attrs: Vec::new_in(self.allocator), - directives: Vec::new_in(self.allocator), - children: Vec::new_in(self.allocator), + attrs: Vec::new_in(&self.allocator), + directives: Vec::new_in(&self.allocator), + children: Vec::new_in(&self.allocator), span: Span::new(0, 0), start_span: Span::new(0, 0), end_span: None, @@ -237,14 +237,14 @@ impl<'a> HtmlParser<'a> { is_void: false, }, ); - let node = HtmlNode::Element(Box::new_in(element, self.allocator)); + let node = HtmlNode::Element(Box::new_in(element, &self.allocator)); self.add_to_parent(node); } } } // Convert root_nodes to arena-allocated Vec - let mut nodes = Vec::new_in(self.allocator); + let mut nodes = Vec::new_in(&self.allocator); for node in self.root_nodes { nodes.push(node); } @@ -301,8 +301,8 @@ impl<'a> HtmlParser<'a> { HtmlBlock { block_type: BlockType::If, name: Ident::from(""), - parameters: Vec::new_in(self.allocator), - children: Vec::new_in(self.allocator), + parameters: Vec::new_in(&self.allocator), + children: Vec::new_in(&self.allocator), span: Span::new(0, 0), name_span: Span::new(0, 0), start_span: Span::new(0, 0), @@ -313,7 +313,7 @@ impl<'a> HtmlParser<'a> { block.end_span = Some(es); block.span = Span::new(block.span.start, es.end); } - return Some(HtmlNode::Block(Box::new_in(block, self.allocator))); + return Some(HtmlNode::Block(Box::new_in(block, &self.allocator))); } } None @@ -376,9 +376,9 @@ impl<'a> HtmlParser<'a> { name: Ident::from(""), component_prefix: None, component_tag_name: None, - attrs: Vec::new_in(self.allocator), - directives: Vec::new_in(self.allocator), - children: Vec::new_in(self.allocator), + attrs: Vec::new_in(&self.allocator), + directives: Vec::new_in(&self.allocator), + children: Vec::new_in(&self.allocator), span: Span::new(0, 0), start_span: Span::new(0, 0), end_span: None, @@ -387,7 +387,7 @@ impl<'a> HtmlParser<'a> { }, ); // Add to the next parent on the stack (which is now the matching element) - self.add_to_parent(HtmlNode::Element(Box::new_in(element, self.allocator))); + self.add_to_parent(HtmlNode::Element(Box::new_in(element, &self.allocator))); } ContainerIndex::Block(idx) => { // Blocks are never implicitly closed by a parent end tag. @@ -398,15 +398,15 @@ impl<'a> HtmlParser<'a> { HtmlBlock { block_type: BlockType::If, name: Ident::from(""), - parameters: Vec::new_in(self.allocator), - children: Vec::new_in(self.allocator), + parameters: Vec::new_in(&self.allocator), + children: Vec::new_in(&self.allocator), span: Span::new(0, 0), name_span: Span::new(0, 0), start_span: Span::new(0, 0), end_span: None, }, ); - self.add_to_parent(HtmlNode::Block(Box::new_in(block, self.allocator))); + self.add_to_parent(HtmlNode::Block(Box::new_in(block, &self.allocator))); } } } @@ -421,9 +421,9 @@ impl<'a> HtmlParser<'a> { name: Ident::from(""), component_prefix: None, component_tag_name: None, - attrs: Vec::new_in(self.allocator), - directives: Vec::new_in(self.allocator), - children: Vec::new_in(self.allocator), + attrs: Vec::new_in(&self.allocator), + directives: Vec::new_in(&self.allocator), + children: Vec::new_in(&self.allocator), span: Span::new(0, 0), start_span: Span::new(0, 0), end_span: None, @@ -435,7 +435,7 @@ impl<'a> HtmlParser<'a> { element.end_span = Some(es); element.span = Span::new(element.span.start, es.end); } - (Some(HtmlNode::Element(Box::new_in(element, self.allocator))), unexpected_close_detected) + (Some(HtmlNode::Element(Box::new_in(element, &self.allocator))), unexpected_close_detected) } /// Auto-closes elements that have optional end tags based on HTML5 rules. @@ -653,12 +653,12 @@ impl<'a> HtmlParser<'a> { let is_void = is_void_element(&tag_name); let element = HtmlElement { - name: Ident::from_in(tag_name.clone(), self.allocator), - component_prefix: component_prefix.map(|p| Ident::from_in(p, self.allocator)), - component_tag_name: component_tag_name.map(|t| Ident::from_in(t, self.allocator)), + name: Ident::from_in(tag_name.clone(), &self.allocator), + component_prefix: component_prefix.map(|p| Ident::from_in(p, &self.allocator)), + component_tag_name: component_tag_name.map(|t| Ident::from_in(t, &self.allocator)), attrs, directives, - children: Vec::new_in(self.allocator), + children: Vec::new_in(&self.allocator), span, start_span, end_span, @@ -668,7 +668,7 @@ impl<'a> HtmlParser<'a> { if is_self_closing || is_void { // Self-closing elements are complete immediately - self.add_to_parent(HtmlNode::Element(Box::new_in(element, self.allocator))); + self.add_to_parent(HtmlNode::Element(Box::new_in(element, &self.allocator))); } else { // Push onto container stack for child parsing self.push_element_container(element); @@ -740,8 +740,8 @@ impl<'a> HtmlParser<'a> { fn parse_attributes_and_directives( &mut self, ) -> (Vec<'a, HtmlAttribute<'a>>, Vec<'a, HtmlDirective<'a>>) { - let mut attrs = Vec::new_in(self.allocator); - let mut directives = Vec::new_in(self.allocator); + let mut attrs = Vec::new_in(&self.allocator); + let mut directives = Vec::new_in(&self.allocator); while let Some(token) = self.peek() { // Handle directive tokens (selectorless mode) @@ -915,11 +915,11 @@ impl<'a> HtmlParser<'a> { // Convert tokens to arena-allocated format let arena_value_tokens = value_tokens.map(|tokens| { - let mut arena_tokens = Vec::new_in(self.allocator); + let mut arena_tokens = Vec::new_in(&self.allocator); for (token_type, parts, tok_span) in tokens { - let mut arena_parts = Vec::new_in(self.allocator); + let mut arena_parts = Vec::new_in(&self.allocator); for part in parts { - arena_parts.push(Ident::from_in(part, self.allocator)); + arena_parts.push(Ident::from_in(part, &self.allocator)); } arena_tokens.push(InterpolatedToken { token_type, @@ -931,8 +931,8 @@ impl<'a> HtmlParser<'a> { }); let attr = HtmlAttribute { - name: Ident::from_in(name, self.allocator), - value: Ident::from_in(value, self.allocator), + name: Ident::from_in(name, &self.allocator), + value: Ident::from_in(value, &self.allocator), span, name_span, value_span, @@ -1098,23 +1098,23 @@ impl<'a> HtmlParser<'a> { } // Convert to arena-allocated tokens - let mut arena_tokens = Vec::new_in(self.allocator); + let mut arena_tokens = Vec::new_in(&self.allocator); for (token_type, parts, span) in tokens { - let mut arena_parts = Vec::new_in(self.allocator); + let mut arena_parts = Vec::new_in(&self.allocator); for part in parts { - arena_parts.push(Ident::from_in(part, self.allocator)); + arena_parts.push(Ident::from_in(part, &self.allocator)); } arena_tokens.push(InterpolatedToken { token_type, parts: arena_parts, span }); } let span = self.make_span(start, end); let text_node = HtmlText { - value: Ident::from_in(text, self.allocator), + value: Ident::from_in(text, &self.allocator), span, full_start, tokens: arena_tokens, }; - Some(HtmlNode::Text(Box::new_in(text_node, self.allocator))) + Some(HtmlNode::Text(Box::new_in(text_node, &self.allocator))) } /// Parses an incomplete tag (error recovery). @@ -1145,19 +1145,19 @@ impl<'a> HtmlParser<'a> { // Create element with no end span (incomplete) // Note: is_self_closing is false because this is an incomplete tag, not explicitly self-closing let element = HtmlElement { - name: Ident::from_in(tag_name.clone(), self.allocator), + name: Ident::from_in(tag_name.clone(), &self.allocator), component_prefix: None, component_tag_name: None, - attrs: Vec::new_in(self.allocator), - directives: Vec::new_in(self.allocator), - children: Vec::new_in(self.allocator), + attrs: Vec::new_in(&self.allocator), + directives: Vec::new_in(&self.allocator), + children: Vec::new_in(&self.allocator), span, start_span, end_span: None, is_self_closing: false, is_void: is_void_element(&tag_name), }; - Some(HtmlNode::Element(Box::new_in(element, self.allocator))) + Some(HtmlNode::Element(Box::new_in(element, &self.allocator))) } /// Parses a comment. @@ -1193,8 +1193,8 @@ impl<'a> HtmlParser<'a> { }; let span = self.make_span(start, end); - let comment = HtmlComment { value: Ident::from_in(value, self.allocator), span }; - Some(HtmlNode::Comment(Box::new_in(comment, self.allocator))) + let comment = HtmlComment { value: Ident::from_in(value, &self.allocator), span }; + Some(HtmlNode::Comment(Box::new_in(comment, &self.allocator))) } /// Parses a CDATA section and converts it to a text node. @@ -1231,18 +1231,18 @@ impl<'a> HtmlParser<'a> { let span = self.make_span(start, end); // CDATA content becomes a text node with a single text token - let mut tokens = Vec::new_in(self.allocator); - let mut parts = Vec::new_in(self.allocator); - parts.push(Ident::from_in(value.clone(), self.allocator)); + let mut tokens = Vec::new_in(&self.allocator); + let mut parts = Vec::new_in(&self.allocator); + parts.push(Ident::from_in(value.clone(), &self.allocator)); tokens.push(InterpolatedToken { token_type: InterpolatedTokenType::Text, parts, span }); // CDATA tokens don't have leading trivia stripped let text = HtmlText { - value: Ident::from_in(value, self.allocator), + value: Ident::from_in(value, &self.allocator), span, full_start: None, tokens, }; - Some(HtmlNode::Text(Box::new_in(text, self.allocator))) + Some(HtmlNode::Text(Box::new_in(text, &self.allocator))) } /// Parses a @let declaration. @@ -1302,14 +1302,14 @@ impl<'a> HtmlParser<'a> { let parse_result = expr_parser.parse_binding(value_str, value_span); let let_decl = HtmlLetDeclaration { - name: Ident::from_in(name, self.allocator), + name: Ident::from_in(name, &self.allocator), value: parse_result.ast, span, name_span, value_span, }; - Some(HtmlNode::LetDeclaration(Box::new_in(let_decl, self.allocator))) + Some(HtmlNode::LetDeclaration(Box::new_in(let_decl, &self.allocator))) } /// Parses an ICU expansion form. @@ -1345,7 +1345,7 @@ impl<'a> HtmlParser<'a> { }; // Parse cases - let mut cases = Vec::new_in(self.allocator); + let mut cases = Vec::new_in(&self.allocator); while let Some(tok) = self.peek() { if tok.token_type == HtmlTokenType::ExpansionFormEnd { break; @@ -1377,15 +1377,15 @@ impl<'a> HtmlParser<'a> { let span = self.make_span(start, end); let expansion = HtmlExpansion { - switch_value: Ident::from_in(switch_value, self.allocator), - expansion_type: Ident::from_in(expansion_type, self.allocator), + switch_value: Ident::from_in(switch_value, &self.allocator), + expansion_type: Ident::from_in(expansion_type, &self.allocator), cases, span, switch_value_span, in_i18n_block: false, // Set by i18n processing when inside i18n blocks }; - Some(HtmlNode::Expansion(Box::new_in(expansion, self.allocator))) + Some(HtmlNode::Expansion(Box::new_in(expansion, &self.allocator))) } /// Parses a single expansion case. @@ -1461,9 +1461,9 @@ impl<'a> HtmlParser<'a> { name: Ident::from(""), component_prefix: None, component_tag_name: None, - attrs: Vec::new_in(self.allocator), - directives: Vec::new_in(self.allocator), - children: Vec::new_in(self.allocator), + attrs: Vec::new_in(&self.allocator), + directives: Vec::new_in(&self.allocator), + children: Vec::new_in(&self.allocator), span: Span::new(0, 0), start_span: Span::new(0, 0), end_span: None, @@ -1471,7 +1471,7 @@ impl<'a> HtmlParser<'a> { is_void: false, }, ); - self.add_to_parent(HtmlNode::Element(Box::new_in(element, self.allocator))); + self.add_to_parent(HtmlNode::Element(Box::new_in(element, &self.allocator))); } ContainerIndex::Block(idx) => { let block = std::mem::replace( @@ -1479,15 +1479,15 @@ impl<'a> HtmlParser<'a> { HtmlBlock { block_type: BlockType::If, name: Ident::from(""), - parameters: Vec::new_in(self.allocator), - children: Vec::new_in(self.allocator), + parameters: Vec::new_in(&self.allocator), + children: Vec::new_in(&self.allocator), span: Span::new(0, 0), name_span: Span::new(0, 0), start_span: Span::new(0, 0), end_span: None, }, ); - self.add_to_parent(HtmlNode::Block(Box::new_in(block, self.allocator))); + self.add_to_parent(HtmlNode::Block(Box::new_in(block, &self.allocator))); } } } @@ -1499,7 +1499,7 @@ impl<'a> HtmlParser<'a> { self.blocks = saved_blocks; // Convert to allocator vec - let mut expansion = Vec::new_in(self.allocator); + let mut expansion = Vec::new_in(&self.allocator); for node in expansion_nodes { expansion.push(node); } @@ -1521,7 +1521,7 @@ impl<'a> HtmlParser<'a> { let expansion_span = self.make_span(exp_start, exp_end); Some(HtmlExpansionCase { - value: Ident::from_in(value, self.allocator), + value: Ident::from_in(value, &self.allocator), expansion, span, value_span, @@ -1559,7 +1559,7 @@ impl<'a> HtmlParser<'a> { }; // Collect block parameters - let mut parameters = Vec::new_in(self.allocator); + let mut parameters = Vec::new_in(&self.allocator); while let Some(tok) = self.peek() { if tok.token_type == HtmlTokenType::BlockParameter { let Some(param_token) = self.advance() else { @@ -1571,7 +1571,7 @@ impl<'a> HtmlParser<'a> { let param_end = param_token.end; let param_span = self.make_span(param_start, param_end); parameters.push(HtmlBlockParameter { - expression: Ident::from_in(¶m_text, self.allocator), + expression: Ident::from_in(¶m_text, &self.allocator), span: param_span, }); } else { @@ -1593,9 +1593,9 @@ impl<'a> HtmlParser<'a> { let block = HtmlBlock { block_type, - name: Ident::from_in(name, self.allocator), + name: Ident::from_in(name, &self.allocator), parameters, - children: Vec::new_in(self.allocator), + children: Vec::new_in(&self.allocator), span, name_span, start_span, @@ -1616,7 +1616,7 @@ impl<'a> HtmlParser<'a> { let name_end = name_token.end; let name_span = self.make_span(directive_start, name_end); - let mut attrs = Vec::new_in(self.allocator); + let mut attrs = Vec::new_in(&self.allocator); let mut start_paren_span = None; let mut end_paren_span = None; let mut directive_end = name_end; @@ -1700,8 +1700,8 @@ impl<'a> HtmlParser<'a> { let attr_name_span = self.make_span(attr_name_start, attr_name_end); attrs.push(HtmlAttribute { - name: Ident::from_in(attr_name, self.allocator), - value: Ident::from_in(attr_value, self.allocator), + name: Ident::from_in(attr_name, &self.allocator), + value: Ident::from_in(attr_value, &self.allocator), span: attr_span, name_span: attr_name_span, value_span, @@ -1726,7 +1726,7 @@ impl<'a> HtmlParser<'a> { let span = self.make_span(directive_start, directive_end); Some(HtmlDirective { - name: Ident::from_in(name, self.allocator), + name: Ident::from_in(name, &self.allocator), attrs, span, name_span, diff --git a/crates/oxc_angular_compiler/src/parser/html/whitespace.rs b/crates/oxc_angular_compiler/src/parser/html/whitespace.rs index 3be7958e6..bcb4025d7 100644 --- a/crates/oxc_angular_compiler/src/parser/html/whitespace.rs +++ b/crates/oxc_angular_compiler/src/parser/html/whitespace.rs @@ -139,7 +139,7 @@ impl<'a> WhitespaceVisitor<'a> { /// Visit and transform a list of nodes, providing sibling context. pub fn visit_all(&mut self, nodes: &[HtmlNode<'a>]) -> Vec<'a, HtmlNode<'a>> { - let mut result = Vec::with_capacity_in(nodes.len(), self.allocator); + let mut result = Vec::with_capacity_in(nodes.len(), &self.allocator); for (i, node) in nodes.iter().enumerate() { let context = SiblingContext { @@ -170,7 +170,7 @@ impl<'a> WhitespaceVisitor<'a> { HtmlNode::ExpansionCase(case) => self.visit_expansion_case(case), HtmlNode::Comment(comment) => Some(HtmlNode::Comment(Box::new_in( HtmlComment { value: comment.value.clone(), span: comment.span }, - self.allocator, + &self.allocator, ))), HtmlNode::Attribute(attr) => { // Filter out ngPreserveWhitespaces attribute @@ -179,17 +179,17 @@ impl<'a> WhitespaceVisitor<'a> { } else { Some(HtmlNode::Attribute(Box::new_in( self.clone_attribute(attr), - self.allocator, + &self.allocator, ))) } } HtmlNode::BlockParameter(param) => Some(HtmlNode::BlockParameter(Box::new_in( self.clone_block_parameter(param), - self.allocator, + &self.allocator, ))), HtmlNode::LetDeclaration(decl) => Some(HtmlNode::LetDeclaration(Box::new_in( self.clone_let_declaration(decl), - self.allocator, + &self.allocator, ))), } } @@ -211,9 +211,9 @@ impl<'a> WhitespaceVisitor<'a> { &self, tokens: &Vec<'a, InterpolatedToken<'a>>, ) -> Vec<'a, InterpolatedToken<'a>> { - let mut result = Vec::with_capacity_in(tokens.len(), self.allocator); + let mut result = Vec::with_capacity_in(tokens.len(), &self.allocator); for token in tokens.iter() { - let mut parts = Vec::with_capacity_in(token.parts.len(), self.allocator); + let mut parts = Vec::with_capacity_in(token.parts.len(), &self.allocator); for part in token.parts.iter() { parts.push(part.clone()); } @@ -247,7 +247,7 @@ impl<'a> WhitespaceVisitor<'a> { span: ParseSpan { start: 0, end: 0 }, source_span: AbsoluteSourceSpan { start: 0, end: 0 }, }, - self.allocator, + &self.allocator, )); HtmlLetDeclaration { @@ -264,7 +264,7 @@ impl<'a> WhitespaceVisitor<'a> { &self, directives: &Vec<'a, HtmlDirective<'a>>, ) -> Vec<'a, HtmlDirective<'a>> { - let mut result = Vec::with_capacity_in(directives.len(), self.allocator); + let mut result = Vec::with_capacity_in(directives.len(), &self.allocator); for dir in directives.iter() { result.push(self.clone_directive(dir)); } @@ -273,7 +273,7 @@ impl<'a> WhitespaceVisitor<'a> { /// Clone a directive into the allocator. fn clone_directive(&self, dir: &HtmlDirective<'a>) -> HtmlDirective<'a> { - let mut attrs = Vec::with_capacity_in(dir.attrs.len(), self.allocator); + let mut attrs = Vec::with_capacity_in(dir.attrs.len(), &self.allocator); for attr in dir.attrs.iter() { attrs.push(self.clone_attribute(attr)); } @@ -292,7 +292,7 @@ impl<'a> WhitespaceVisitor<'a> { &self, params: &Vec<'a, HtmlBlockParameter<'a>>, ) -> Vec<'a, HtmlBlockParameter<'a>> { - let mut result = Vec::with_capacity_in(params.len(), self.allocator); + let mut result = Vec::with_capacity_in(params.len(), &self.allocator); for param in params.iter() { result.push(self.clone_block_parameter(param)); } @@ -301,7 +301,7 @@ impl<'a> WhitespaceVisitor<'a> { /// Clone attributes into the allocator. fn clone_attributes(&self, attrs: &Vec<'a, HtmlAttribute<'a>>) -> Vec<'a, HtmlAttribute<'a>> { - let mut result = Vec::with_capacity_in(attrs.len(), self.allocator); + let mut result = Vec::with_capacity_in(attrs.len(), &self.allocator); for attr in attrs.iter() { result.push(self.clone_attribute(attr)); } @@ -310,7 +310,7 @@ impl<'a> WhitespaceVisitor<'a> { /// Clone children (nodes) into the allocator without transformation. fn clone_children(&self, children: &Vec<'a, HtmlNode<'a>>) -> Vec<'a, HtmlNode<'a>> { - let mut result = Vec::with_capacity_in(children.len(), self.allocator); + let mut result = Vec::with_capacity_in(children.len(), &self.allocator); for child in children.iter() { result.push(self.clone_node(child)); } @@ -327,38 +327,39 @@ impl<'a> WhitespaceVisitor<'a> { full_start: text.full_start, tokens: self.clone_tokens(&text.tokens), }, - self.allocator, + &self.allocator, )), HtmlNode::Element(el) => { - HtmlNode::Element(Box::new_in(self.clone_element_shallow(el), self.allocator)) - } - HtmlNode::Component(comp) => { - HtmlNode::Component(Box::new_in(self.clone_component_shallow(comp), self.allocator)) + HtmlNode::Element(Box::new_in(self.clone_element_shallow(el), &self.allocator)) } + HtmlNode::Component(comp) => HtmlNode::Component(Box::new_in( + self.clone_component_shallow(comp), + &self.allocator, + )), HtmlNode::Comment(c) => HtmlNode::Comment(Box::new_in( HtmlComment { value: c.value.clone(), span: c.span }, - self.allocator, + &self.allocator, )), HtmlNode::Attribute(attr) => { - HtmlNode::Attribute(Box::new_in(self.clone_attribute(attr), self.allocator)) + HtmlNode::Attribute(Box::new_in(self.clone_attribute(attr), &self.allocator)) } HtmlNode::Block(block) => { - HtmlNode::Block(Box::new_in(self.clone_block_shallow(block), self.allocator)) + HtmlNode::Block(Box::new_in(self.clone_block_shallow(block), &self.allocator)) } HtmlNode::BlockParameter(param) => HtmlNode::BlockParameter(Box::new_in( self.clone_block_parameter(param), - self.allocator, + &self.allocator, )), HtmlNode::LetDeclaration(decl) => HtmlNode::LetDeclaration(Box::new_in( self.clone_let_declaration(decl), - self.allocator, + &self.allocator, )), HtmlNode::Expansion(exp) => { - HtmlNode::Expansion(Box::new_in(self.clone_expansion_shallow(exp), self.allocator)) + HtmlNode::Expansion(Box::new_in(self.clone_expansion_shallow(exp), &self.allocator)) } HtmlNode::ExpansionCase(case) => HtmlNode::ExpansionCase(Box::new_in( self.clone_expansion_case_shallow(case), - self.allocator, + &self.allocator, )), } } @@ -412,7 +413,7 @@ impl<'a> WhitespaceVisitor<'a> { /// Clone an expansion (including cases). fn clone_expansion_shallow(&self, exp: &HtmlExpansion<'a>) -> HtmlExpansion<'a> { - let mut cases = Vec::with_capacity_in(exp.cases.len(), self.allocator); + let mut cases = Vec::with_capacity_in(exp.cases.len(), &self.allocator); for case in exp.cases.iter() { cases.push(self.clone_expansion_case_shallow(case)); } @@ -457,7 +458,7 @@ impl<'a> WhitespaceVisitor<'a> { full_start: text.full_start, tokens: self.clone_tokens(&text.tokens), }, - self.allocator, + &self.allocator, ))); } @@ -473,7 +474,7 @@ impl<'a> WhitespaceVisitor<'a> { // Process tokens let tokens = self.process_tokens(&text.tokens, context); - let value_atom = Ident::from_in(value.as_str(), self.allocator); + let value_atom = Ident::from_in(value.as_str(), &self.allocator); Some(HtmlNode::Text(Box::new_in( HtmlText { value: value_atom, @@ -481,7 +482,7 @@ impl<'a> WhitespaceVisitor<'a> { full_start: text.full_start, tokens, }, - self.allocator, + &self.allocator, ))) } else { // Remove whitespace-only text node @@ -495,7 +496,7 @@ impl<'a> WhitespaceVisitor<'a> { tokens: &Vec<'a, InterpolatedToken<'a>>, context: &SiblingContext<'a, '_>, ) -> Vec<'a, InterpolatedToken<'a>> { - let mut result = Vec::with_capacity_in(tokens.len(), self.allocator); + let mut result = Vec::with_capacity_in(tokens.len(), &self.allocator); let token_count = tokens.len(); for (i, token) in tokens.iter().enumerate() { @@ -513,8 +514,8 @@ impl<'a> WhitespaceVisitor<'a> { } } - let mut parts = Vec::with_capacity_in(1, self.allocator); - parts.push(Ident::from_in(processed.as_str(), self.allocator)); + let mut parts = Vec::with_capacity_in(1, &self.allocator); + parts.push(Ident::from_in(processed.as_str(), &self.allocator)); result.push(InterpolatedToken { token_type: token.token_type, @@ -523,7 +524,7 @@ impl<'a> WhitespaceVisitor<'a> { }); } else { // Clone non-text tokens - let mut parts = Vec::with_capacity_in(token.parts.len(), self.allocator); + let mut parts = Vec::with_capacity_in(token.parts.len(), &self.allocator); for part in token.parts.iter() { parts.push(part.clone()); } @@ -571,7 +572,7 @@ impl<'a> WhitespaceVisitor<'a> { is_self_closing: element.is_self_closing, is_void: element.is_void, }, - self.allocator, + &self.allocator, ))); } @@ -592,7 +593,7 @@ impl<'a> WhitespaceVisitor<'a> { is_self_closing: element.is_self_closing, is_void: element.is_void, }, - self.allocator, + &self.allocator, ))) } @@ -615,7 +616,7 @@ impl<'a> WhitespaceVisitor<'a> { start_span: component.start_span, end_span: component.end_span, }, - self.allocator, + &self.allocator, ))); } @@ -635,7 +636,7 @@ impl<'a> WhitespaceVisitor<'a> { start_span: component.start_span, end_span: component.end_span, }, - self.allocator, + &self.allocator, ))) } @@ -644,7 +645,7 @@ impl<'a> WhitespaceVisitor<'a> { &self, attrs: &Vec<'a, HtmlAttribute<'a>>, ) -> Vec<'a, HtmlAttribute<'a>> { - let mut result = Vec::with_capacity_in(attrs.len(), self.allocator); + let mut result = Vec::with_capacity_in(attrs.len(), &self.allocator); for attr in attrs.iter() { if attr.name.as_str() != PRESERVE_WS_ATTR_NAME { result.push(self.clone_attribute(attr)); @@ -668,7 +669,7 @@ impl<'a> WhitespaceVisitor<'a> { start_span: block.start_span, end_span: block.end_span, }, - self.allocator, + &self.allocator, ))) } @@ -677,7 +678,7 @@ impl<'a> WhitespaceVisitor<'a> { self.icu_expansion_depth += 1; // Visit cases (process whitespace in expansion content) - let mut cases = Vec::with_capacity_in(expansion.cases.len(), self.allocator); + let mut cases = Vec::with_capacity_in(expansion.cases.len(), &self.allocator); for case in expansion.cases.iter() { // Visit the expansion nodes within this case let visited_expansion = self.visit_all(&case.expansion); @@ -701,7 +702,7 @@ impl<'a> WhitespaceVisitor<'a> { switch_value_span: expansion.switch_value_span, in_i18n_block: expansion.in_i18n_block, }, - self.allocator, + &self.allocator, ))) } @@ -717,7 +718,7 @@ impl<'a> WhitespaceVisitor<'a> { value_span: case.value_span, expansion_span: case.expansion_span, }, - self.allocator, + &self.allocator, ))) } } diff --git a/crates/oxc_angular_compiler/src/partial/class_metadata.rs b/crates/oxc_angular_compiler/src/partial/class_metadata.rs index 1138a4df5..0ebdb57fa 100644 --- a/crates/oxc_angular_compiler/src/partial/class_metadata.rs +++ b/crates/oxc_angular_compiler/src/partial/class_metadata.rs @@ -47,7 +47,7 @@ pub fn compile_declare_class_metadata<'a>( allocator: &'a Allocator, meta: &R3ClassMetadata<'a>, ) -> OutputExpression<'a> { - let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(allocator); + let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(&allocator); entries.push(string_entry(allocator, "minVersion", MIN_VERSION_CLASS_METADATA)); entries.push(string_entry(allocator, "version", PLACEHOLDER_VERSION)); @@ -75,23 +75,23 @@ pub fn compile_declare_class_metadata<'a>( let map_expr = OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )); - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(map_expr); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { fn_expr: Box::new_in( namespaced_prop(allocator, "i0", Identifiers::DECLARE_CLASS_METADATA), - allocator, + &allocator, ), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -132,7 +132,7 @@ pub fn compile_declare_class_metadata_async<'a>( dependencies: &[R3DeferPerComponentDependency<'a>], ) -> OutputExpression<'a> { // resolveMetadata callback body: { decorators, ctorParameters, propDecorators } - let mut callback_entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(allocator); + let mut callback_entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(&allocator); callback_entries.push(LiteralMapEntry::new( Ident::from("decorators"), meta.decorators.clone_in(allocator), @@ -156,30 +156,30 @@ pub fn compile_declare_class_metadata_async<'a>( )); let callback_body = OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries: callback_entries, source_span: None }, - allocator, + &allocator, )); // resolveMetadata callback params: one per deferred dep, using the // local param_name (which shadows the static import so bundlers can // tree-shake the eager binding). - let mut params = Vec::new_in(allocator); + let mut params = Vec::new_in(&allocator); for dep in dependencies { params.push(FnParam { name: dep.param_name.clone() }); } let resolve_metadata = OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { params, - body: ArrowFunctionBody::Expression(Box::new_in(callback_body, allocator)), + body: ArrowFunctionBody::Expression(Box::new_in(callback_body, &allocator)), source_span: None, }, - allocator, + &allocator, )); // resolveDeferredDeps arrow — reused from the full-mode emitter; same // shape in both modes. let resolve_deferred_deps = compile_component_metadata_async_resolver(allocator, dependencies); - let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(allocator); + let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(&allocator); entries.push(string_entry(allocator, "minVersion", MIN_VERSION_CLASS_METADATA_ASYNC)); entries.push(string_entry(allocator, "version", PLACEHOLDER_VERSION)); entries.push(LiteralMapEntry::new(Ident::from("ngImport"), read_var(allocator, "i0"), false)); @@ -193,23 +193,23 @@ pub fn compile_declare_class_metadata_async<'a>( let map_expr = OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )); - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(map_expr); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { fn_expr: Box::new_in( namespaced_prop(allocator, "i0", Identifiers::DECLARE_CLASS_METADATA_ASYNC), - allocator, + &allocator, ), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -233,7 +233,7 @@ pub fn compile_component_declare_class_metadata<'a>( fn read_var<'a>(allocator: &'a Allocator, name: &'static str) -> OutputExpression<'a> { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(name), source_span: None }, - allocator, + &allocator, )) } @@ -244,19 +244,19 @@ fn namespaced_prop<'a>( ) -> OutputExpression<'a> { OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(read_var(allocator, receiver), allocator), + receiver: Box::new_in(read_var(allocator, receiver), &allocator), name: Ident::from(prop), optional: false, source_span: None, }, - allocator, + &allocator, )) } fn string_literal<'a>(allocator: &'a Allocator, value: &'static str) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(Ident::from(value)), source_span: None }, - allocator, + &allocator, )) } @@ -271,6 +271,6 @@ fn string_entry<'a>( fn null_lit<'a>(allocator: &'a Allocator) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )) } diff --git a/crates/oxc_angular_compiler/src/partial/component.rs b/crates/oxc_angular_compiler/src/partial/component.rs index 41d281acb..f697562b0 100644 --- a/crates/oxc_angular_compiler/src/partial/component.rs +++ b/crates/oxc_angular_compiler/src/partial/component.rs @@ -71,7 +71,7 @@ pub fn compile_declare_component_from_metadata<'a>( meta: &ComponentMetadata<'a>, inputs: &PartialComponentInputs<'a>, ) -> OutputExpression<'a> { - let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(allocator); + let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(&allocator); let min_version = compute_min_version(meta, inputs.template); entries.push(string_entry(allocator, "minVersion", min_version)); @@ -79,7 +79,7 @@ pub fn compile_declare_component_from_metadata<'a>( let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: meta.class_name.clone(), source_span: None }, - allocator, + &allocator, )); entries.push(LiteralMapEntry::new(Ident::from("type"), type_expr, false)); @@ -143,7 +143,7 @@ pub fn compile_declare_component_from_metadata<'a>( if !meta.export_as.is_empty() { let mut elements: Vec<'a, OutputExpression<'a>> = - Vec::with_capacity_in(meta.export_as.len(), allocator); + Vec::with_capacity_in(meta.export_as.len(), &allocator); for name in &meta.export_as { elements.push(string_literal_owned(allocator, name.clone())); } @@ -151,7 +151,7 @@ pub fn compile_declare_component_from_metadata<'a>( Ident::from("exportAs"), OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: elements, source_span: None }, - allocator, + &allocator, )), false, )); @@ -203,7 +203,7 @@ pub fn compile_declare_component_from_metadata<'a>( if !meta.styles.is_empty() { let mut elements: Vec<'a, OutputExpression<'a>> = - Vec::with_capacity_in(meta.styles.len(), allocator); + Vec::with_capacity_in(meta.styles.len(), &allocator); for s in &meta.styles { elements.push(string_literal_owned(allocator, s.clone())); } @@ -211,7 +211,7 @@ pub fn compile_declare_component_from_metadata<'a>( Ident::from("styles"), OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: elements, source_span: None }, - allocator, + &allocator, )), false, )); @@ -244,7 +244,7 @@ pub fn compile_declare_component_from_metadata<'a>( entries.push(LiteralMapEntry::new( Ident::from("dependencies"), create_dependencies_array_from_slice( - allocator, + &allocator, declarations_to_emit, meta.declaration_list_emit_mode, ), @@ -335,7 +335,7 @@ pub fn compile_declare_factory_for_component<'a>( ) -> OutputExpression<'a> { let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: meta.class_name.clone(), source_span: None }, - allocator, + &allocator, )); let factory_meta = R3FactoryMetadata::Constructor(R3ConstructorFactoryMetadata { @@ -403,9 +403,9 @@ fn create_inputs_partial_metadata<'a>( allocator: &'a Allocator, inputs: &Vec<'a, R3InputMetadata<'a>>, ) -> OutputExpression<'a> { - let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::with_capacity_in(inputs.len(), allocator); + let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::with_capacity_in(inputs.len(), &allocator); for input in inputs { - let mut input_map: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(allocator); + let mut input_map: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(&allocator); input_map.push(LiteralMapEntry::new( Ident::from("classPropertyName"), string_literal_owned(allocator, input.class_property_name.clone()), @@ -438,14 +438,14 @@ fn create_inputs_partial_metadata<'a>( key, OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries: input_map, source_span: None }, - allocator, + &allocator, )), quoted, )); } OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )) } @@ -453,12 +453,12 @@ fn legacy_inputs_partial_metadata<'a>( allocator: &'a Allocator, inputs: &Vec<'a, R3InputMetadata<'a>>, ) -> OutputExpression<'a> { - let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::with_capacity_in(inputs.len(), allocator); + let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::with_capacity_in(inputs.len(), &allocator); for input in inputs { let declared = &input.class_property_name; let public = &input.binding_property_name; let value = if declared.as_str() != public.as_str() || input.transform_function.is_some() { - let mut tuple: Vec<'a, OutputExpression<'a>> = Vec::new_in(allocator); + let mut tuple: Vec<'a, OutputExpression<'a>> = Vec::new_in(&allocator); tuple.push(string_literal_owned(allocator, public.clone())); tuple.push(string_literal_owned(allocator, declared.clone())); if let Some(transform) = &input.transform_function { @@ -466,7 +466,7 @@ fn legacy_inputs_partial_metadata<'a>( } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: tuple, source_span: None }, - allocator, + &allocator, )) } else { string_literal_owned(allocator, public.clone()) @@ -476,7 +476,7 @@ fn legacy_inputs_partial_metadata<'a>( } OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )) } @@ -484,7 +484,8 @@ fn create_outputs_map<'a>( allocator: &'a Allocator, outputs: &Vec<'a, (Ident<'a>, Ident<'a>)>, ) -> OutputExpression<'a> { - let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::with_capacity_in(outputs.len(), allocator); + let mut entries: Vec<'a, LiteralMapEntry<'a>> = + Vec::with_capacity_in(outputs.len(), &allocator); for (class_name, binding_name) in outputs { let quoted = is_unsafe_object_key(class_name.as_str()); entries.push(LiteralMapEntry::new( @@ -495,7 +496,7 @@ fn create_outputs_map<'a>( } OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )) } @@ -517,7 +518,7 @@ fn compile_host_metadata<'a>( return None; } - let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(allocator); + let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(&allocator); if !host.attributes.is_empty() { entries.push(LiteralMapEntry::new( @@ -557,7 +558,7 @@ fn compile_host_metadata<'a>( Some(OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, ))) } @@ -565,7 +566,7 @@ fn ident_pairs_to_string_map<'a>( allocator: &'a Allocator, pairs: &Vec<'a, (Ident<'a>, Ident<'a>)>, ) -> OutputExpression<'a> { - let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::with_capacity_in(pairs.len(), allocator); + let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::with_capacity_in(pairs.len(), &allocator); for (key, value) in pairs { let quoted = is_unsafe_object_key(key.as_str()); entries.push(LiteralMapEntry::new( @@ -576,7 +577,7 @@ fn ident_pairs_to_string_map<'a>( } OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )) } @@ -587,12 +588,12 @@ fn create_host_directives_array<'a>( host_directives: &Vec<'a, HostDirectiveMetadata<'a>>, ) -> OutputExpression<'a> { let mut entries: Vec<'a, OutputExpression<'a>> = - Vec::with_capacity_in(host_directives.len(), allocator); + Vec::with_capacity_in(host_directives.len(), &allocator); for hd in host_directives { - let mut hd_entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(allocator); + let mut hd_entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(&allocator); let directive_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: hd.directive.clone(), source_span: None }, - allocator, + &allocator, )); let directive_expr = if hd.is_forward_reference { wrap_forward_ref(allocator, directive_expr) @@ -617,12 +618,12 @@ fn create_host_directives_array<'a>( } entries.push(OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries: hd_entries, source_span: None }, - allocator, + &allocator, ))); } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: None }, - allocator, + &allocator, )) } @@ -631,14 +632,14 @@ fn host_directives_mapping_array<'a>( pairs: &Vec<'a, (Ident<'a>, Ident<'a>)>, ) -> OutputExpression<'a> { let mut elements: Vec<'a, OutputExpression<'a>> = - Vec::with_capacity_in(pairs.len() * 2, allocator); + Vec::with_capacity_in(pairs.len() * 2, &allocator); for (public_name, alias) in pairs { elements.push(string_literal_owned(allocator, public_name.clone())); elements.push(string_literal_owned(allocator, alias.clone())); } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: elements, source_span: None }, - allocator, + &allocator, )) } @@ -657,10 +658,10 @@ fn lower_imports_to_declarations<'a>( allocator: &'a Allocator, imports: &Vec<'a, Ident<'a>>, ) -> Vec<'a, TemplateDependency<'a>> { - let mut out = Vec::with_capacity_in(imports.len(), allocator); + let mut out = Vec::with_capacity_in(imports.len(), &allocator); for name in imports { out.push(TemplateDependency::directive( - allocator, + &allocator, name.clone(), Ident::from("*"), false, // is_component — unknown at this point @@ -679,9 +680,9 @@ fn create_dependencies_array_from_slice<'a>( DeclarationListEmitMode::Closure | DeclarationListEmitMode::ClosureResolved ); - let mut entries: Vec<'a, OutputExpression<'a>> = Vec::with_capacity_in(deps.len(), allocator); + let mut entries: Vec<'a, OutputExpression<'a>> = Vec::with_capacity_in(deps.len(), &allocator); for dep in deps { - let mut dep_map: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(allocator); + let mut dep_map: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(&allocator); let kind = match dep.kind { TemplateDependencyKind::Directive => { if dep.is_component { @@ -701,7 +702,7 @@ fn create_dependencies_array_from_slice<'a>( let mut type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: dep.type_name.clone(), source_span: None }, - allocator, + &allocator, )); if wrap_in_forward_ref || dep.is_forward_reference { type_expr = wrap_forward_ref(allocator, type_expr); @@ -752,13 +753,13 @@ fn create_dependencies_array_from_slice<'a>( entries.push(OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries: dep_map, source_span: None }, - allocator, + &allocator, ))); } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: None }, - allocator, + &allocator, )) } @@ -766,13 +767,14 @@ fn ident_array_string_literals<'a>( allocator: &'a Allocator, names: &Vec<'a, Ident<'a>>, ) -> OutputExpression<'a> { - let mut elements: Vec<'a, OutputExpression<'a>> = Vec::with_capacity_in(names.len(), allocator); + let mut elements: Vec<'a, OutputExpression<'a>> = + Vec::with_capacity_in(names.len(), &allocator); for name in names { elements.push(string_literal_owned(allocator, name.clone())); } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: elements, source_span: None }, - allocator, + &allocator, )) } @@ -789,18 +791,18 @@ fn clone_factory_deps<'a>( ) -> R3FactoryDeps<'a> { match deps { Some(deps) => { - let mut out = Vec::with_capacity_in(deps.len(), allocator); + let mut out = Vec::with_capacity_in(deps.len(), &allocator); for dep in deps { let token_expr = dep.token.as_ref().map(|t| { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: t.clone(), source_span: None }, - allocator, + &allocator, )) }); let attr_expr = dep.attribute_name.as_ref().map(|a| { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(a.clone()), source_span: None }, - allocator, + &allocator, )) }); out.push(R3DependencyMetadata { @@ -819,7 +821,7 @@ fn clone_factory_deps<'a>( if uses_inheritance { R3FactoryDeps::None } else { - R3FactoryDeps::Valid(Vec::new_in(allocator)) + R3FactoryDeps::Valid(Vec::new_in(&allocator)) } } } @@ -838,26 +840,26 @@ fn invoke_declare<'a>( ) -> OutputExpression<'a> { let map_expr = OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )); - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(map_expr); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(namespaced_prop(allocator, "i0", name), allocator), + fn_expr: Box::new_in(namespaced_prop(allocator, "i0", name), &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } fn read_var<'a>(allocator: &'a Allocator, name: &'static str) -> OutputExpression<'a> { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(name), source_span: None }, - allocator, + &allocator, )) } @@ -868,12 +870,12 @@ fn namespaced_prop<'a>( ) -> OutputExpression<'a> { OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(read_var(allocator, receiver), allocator), + receiver: Box::new_in(read_var(allocator, receiver), &allocator), name: Ident::from(prop), optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -887,12 +889,12 @@ fn namespaced_enum_member<'a>( let enum_ref = namespaced_prop(allocator, "i0", enum_name); OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(enum_ref, allocator), + receiver: Box::new_in(enum_ref, &allocator), name: Ident::from(variant), optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -902,14 +904,14 @@ fn string_literal_static<'a>( ) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(Ident::from(value)), source_span: None }, - allocator, + &allocator, )) } fn string_literal_owned<'a>(allocator: &'a Allocator, value: Ident<'a>) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(value), source_span: None }, - allocator, + &allocator, )) } @@ -917,7 +919,7 @@ fn string_literal_str<'a>(allocator: &'a Allocator, value: &str) -> OutputExpres let owned = allocator.alloc_str(value); OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(Ident::from(owned)), source_span: None }, - allocator, + &allocator, )) } @@ -932,13 +934,13 @@ fn string_entry<'a>( fn bool_lit<'a>(allocator: &'a Allocator, value: bool) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(value), source_span: None }, - allocator, + &allocator, )) } fn null_lit<'a>(allocator: &'a Allocator) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )) } diff --git a/crates/oxc_angular_compiler/src/partial/directive.rs b/crates/oxc_angular_compiler/src/partial/directive.rs index 4090cf615..94275ad2a 100644 --- a/crates/oxc_angular_compiler/src/partial/directive.rs +++ b/crates/oxc_angular_compiler/src/partial/directive.rs @@ -74,7 +74,7 @@ pub(crate) fn create_directive_definition_map<'a>( allocator: &'a Allocator, meta: &R3DirectiveMetadata<'a>, ) -> Vec<'a, LiteralMapEntry<'a>> { - let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(allocator); + let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(&allocator); let min_version = compute_min_version(meta); entries.push(string_entry(allocator, "minVersion", min_version)); @@ -153,7 +153,7 @@ pub(crate) fn create_directive_definition_map<'a>( if !meta.export_as.is_empty() { let mut elements: Vec<'a, OutputExpression<'a>> = - Vec::with_capacity_in(meta.export_as.len(), allocator); + Vec::with_capacity_in(meta.export_as.len(), &allocator); for name in &meta.export_as { elements.push(string_literal_owned(allocator, name.clone())); } @@ -161,7 +161,7 @@ pub(crate) fn create_directive_definition_map<'a>( Ident::from("exportAs"), OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: elements, source_span: None }, - allocator, + &allocator, )), false, )); @@ -243,9 +243,9 @@ fn create_inputs_partial_metadata<'a>( allocator: &'a Allocator, inputs: &Vec<'a, R3InputMetadata<'a>>, ) -> OutputExpression<'a> { - let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::with_capacity_in(inputs.len(), allocator); + let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::with_capacity_in(inputs.len(), &allocator); for input in inputs { - let mut input_map: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(allocator); + let mut input_map: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(&allocator); input_map.push(LiteralMapEntry::new( Ident::from("classPropertyName"), string_literal_owned(allocator, input.class_property_name.clone()), @@ -272,7 +272,7 @@ fn create_inputs_partial_metadata<'a>( Some(expr) => expr.clone_in(allocator), None => OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), }; input_map.push(LiteralMapEntry::new(Ident::from("transformFunction"), transform, false)); @@ -283,14 +283,14 @@ fn create_inputs_partial_metadata<'a>( input.class_property_name.clone(), OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries: input_map, source_span: None }, - allocator, + &allocator, )), quoted, )); } OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )) } @@ -301,12 +301,12 @@ fn legacy_inputs_partial_metadata<'a>( allocator: &'a Allocator, inputs: &Vec<'a, R3InputMetadata<'a>>, ) -> OutputExpression<'a> { - let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::with_capacity_in(inputs.len(), allocator); + let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::with_capacity_in(inputs.len(), &allocator); for input in inputs { let declared = &input.class_property_name; let public = &input.binding_property_name; let value = if declared.as_str() != public.as_str() || input.transform_function.is_some() { - let mut tuple: Vec<'a, OutputExpression<'a>> = Vec::new_in(allocator); + let mut tuple: Vec<'a, OutputExpression<'a>> = Vec::new_in(&allocator); tuple.push(string_literal_owned(allocator, public.clone())); tuple.push(string_literal_owned(allocator, declared.clone())); if let Some(transform) = &input.transform_function { @@ -314,7 +314,7 @@ fn legacy_inputs_partial_metadata<'a>( } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: tuple, source_span: None }, - allocator, + &allocator, )) } else { string_literal_owned(allocator, public.clone()) @@ -326,7 +326,7 @@ fn legacy_inputs_partial_metadata<'a>( } OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )) } @@ -336,7 +336,8 @@ fn create_outputs_map<'a>( allocator: &'a Allocator, outputs: &Vec<'a, (Ident<'a>, Ident<'a>)>, ) -> OutputExpression<'a> { - let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::with_capacity_in(outputs.len(), allocator); + let mut entries: Vec<'a, LiteralMapEntry<'a>> = + Vec::with_capacity_in(outputs.len(), &allocator); for (class_name, binding_name) in outputs { let quoted = is_unsafe_object_key(class_name.as_str()); entries.push(LiteralMapEntry::new( @@ -347,7 +348,7 @@ fn create_outputs_map<'a>( } OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )) } @@ -360,12 +361,12 @@ fn compile_host_metadata<'a>( if !host.has_bindings() { return None; } - let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(allocator); + let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(&allocator); // Order matches upstream directive.ts:212-224: attributes, listeners, // properties, styleAttribute, classAttribute. if !host.attributes.is_empty() { - let mut attr_entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(allocator); + let mut attr_entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(&allocator); for (key, value) in &host.attributes { let quoted = is_unsafe_object_key(key.as_str()); attr_entries.push(LiteralMapEntry::new(key.clone(), value.clone_in(allocator), quoted)); @@ -374,7 +375,7 @@ fn compile_host_metadata<'a>( Ident::from("attributes"), OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries: attr_entries, source_span: None }, - allocator, + &allocator, )), false, )); @@ -410,7 +411,7 @@ fn compile_host_metadata<'a>( Some(OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, ))) } @@ -418,7 +419,7 @@ fn ident_pairs_to_string_map<'a>( allocator: &'a Allocator, pairs: &Vec<'a, (Ident<'a>, Ident<'a>)>, ) -> OutputExpression<'a> { - let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::with_capacity_in(pairs.len(), allocator); + let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::with_capacity_in(pairs.len(), &allocator); for (key, value) in pairs { let quoted = is_unsafe_object_key(key.as_str()); entries.push(LiteralMapEntry::new( @@ -429,7 +430,7 @@ fn ident_pairs_to_string_map<'a>( } OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )) } @@ -440,18 +441,18 @@ fn compile_queries_array<'a>( queries: &Vec<'a, R3QueryMetadata<'a>>, ) -> OutputExpression<'a> { let mut entries: Vec<'a, OutputExpression<'a>> = - Vec::with_capacity_in(queries.len(), allocator); + Vec::with_capacity_in(queries.len(), &allocator); for q in queries { entries.push(compile_query(allocator, q)); } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: None }, - allocator, + &allocator, )) } fn compile_query<'a>(allocator: &'a Allocator, q: &R3QueryMetadata<'a>) -> OutputExpression<'a> { - let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(allocator); + let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(&allocator); entries.push(LiteralMapEntry::new( Ident::from("propertyName"), @@ -469,13 +470,13 @@ fn compile_query<'a>(allocator: &'a Allocator, q: &R3QueryMetadata<'a>) -> Outpu QueryPredicate::Type(expr) => expr.clone_in(allocator), QueryPredicate::Selectors(selectors) => { let mut elements: Vec<'a, OutputExpression<'a>> = - Vec::with_capacity_in(selectors.len(), allocator); + Vec::with_capacity_in(selectors.len(), &allocator); for s in selectors { elements.push(string_literal_owned(allocator, s.clone())); } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: elements, source_span: None }, - allocator, + &allocator, )) } }; @@ -511,7 +512,7 @@ fn compile_query<'a>(allocator: &'a Allocator, q: &R3QueryMetadata<'a>) -> Outpu OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )) } @@ -522,9 +523,9 @@ fn create_host_directives_array<'a>( host_directives: &Vec<'a, R3HostDirectiveMetadata<'a>>, ) -> OutputExpression<'a> { let mut entries: Vec<'a, OutputExpression<'a>> = - Vec::with_capacity_in(host_directives.len(), allocator); + Vec::with_capacity_in(host_directives.len(), &allocator); for hd in host_directives { - let mut hd_entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(allocator); + let mut hd_entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(&allocator); let directive_expr = if hd.is_forward_reference { wrap_forward_ref(allocator, hd.directive.clone_in(allocator)) } else { @@ -548,12 +549,12 @@ fn create_host_directives_array<'a>( } entries.push(OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries: hd_entries, source_span: None }, - allocator, + &allocator, ))); } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: None }, - allocator, + &allocator, )) } @@ -564,14 +565,14 @@ fn host_directives_mapping_array<'a>( pairs: &Vec<'a, (Ident<'a>, Ident<'a>)>, ) -> OutputExpression<'a> { let mut elements: Vec<'a, OutputExpression<'a>> = - Vec::with_capacity_in(pairs.len() * 2, allocator); + Vec::with_capacity_in(pairs.len() * 2, &allocator); for (public_name, alias) in pairs { elements.push(string_literal_owned(allocator, public_name.clone())); elements.push(string_literal_owned(allocator, alias.clone())); } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: elements, source_span: None }, - allocator, + &allocator, )) } @@ -584,7 +585,7 @@ fn clone_factory_deps<'a>( ) -> R3FactoryDeps<'a> { match deps { Some(deps) => { - let mut out = Vec::with_capacity_in(deps.len(), allocator); + let mut out = Vec::with_capacity_in(deps.len(), &allocator); for dep in deps { out.push(R3DependencyMetadata { token: dep.token.as_ref().map(|t| t.clone_in(allocator)), @@ -608,7 +609,7 @@ fn clone_factory_deps<'a>( if uses_inheritance { R3FactoryDeps::None } else { - R3FactoryDeps::Valid(Vec::new_in(allocator)) + R3FactoryDeps::Valid(Vec::new_in(&allocator)) } } } @@ -627,26 +628,26 @@ fn invoke_declare<'a>( ) -> OutputExpression<'a> { let map_expr = OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )); - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(map_expr); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(namespaced_prop(allocator, "i0", name), allocator), + fn_expr: Box::new_in(namespaced_prop(allocator, "i0", name), &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } fn read_var<'a>(allocator: &'a Allocator, name: &'static str) -> OutputExpression<'a> { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(name), source_span: None }, - allocator, + &allocator, )) } @@ -657,19 +658,19 @@ fn namespaced_prop<'a>( ) -> OutputExpression<'a> { OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(read_var(allocator, receiver), allocator), + receiver: Box::new_in(read_var(allocator, receiver), &allocator), name: Ident::from(prop), optional: false, source_span: None, }, - allocator, + &allocator, )) } fn string_literal_owned<'a>(allocator: &'a Allocator, value: Ident<'a>) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(value), source_span: None }, - allocator, + &allocator, )) } @@ -682,7 +683,7 @@ fn string_entry<'a>( Ident::from(key), OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(Ident::from(value)), source_span: None }, - allocator, + &allocator, )), false, ) @@ -691,6 +692,6 @@ fn string_entry<'a>( fn bool_lit<'a>(allocator: &'a Allocator, value: bool) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(value), source_span: None }, - allocator, + &allocator, )) } diff --git a/crates/oxc_angular_compiler/src/partial/factory.rs b/crates/oxc_angular_compiler/src/partial/factory.rs index 817b2184a..c7a54db39 100644 --- a/crates/oxc_angular_compiler/src/partial/factory.rs +++ b/crates/oxc_angular_compiler/src/partial/factory.rs @@ -34,7 +34,7 @@ pub fn compile_declare_factory_function<'a>( ) -> OutputExpression<'a> { let base = meta.base(); - let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(allocator); + let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(&allocator); entries.push(string_entry(allocator, "minVersion", MIN_VERSION_FACTORY)); entries.push(string_entry(allocator, "version", PLACEHOLDER_VERSION)); @@ -57,17 +57,17 @@ pub fn compile_declare_factory_function<'a>( let map_expr = OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )); - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(map_expr); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { fn_expr: Box::new_in( namespaced_prop(allocator, "i0", Identifiers::DECLARE_FACTORY), - allocator, + &allocator, ), args, // ngDeclare* calls are not @__PURE__ — upstream emits them as @@ -76,7 +76,7 @@ pub fn compile_declare_factory_function<'a>( optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -101,19 +101,19 @@ fn compile_dependencies<'a>( R3FactoryDeps::Invalid => string_literal(allocator, "invalid"), R3FactoryDeps::None => OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), R3FactoryDeps::Valid(deps) if deps.iter().any(|d| d.type_only_invalid) => { string_literal(allocator, "invalid") } R3FactoryDeps::Valid(deps) => { - let mut entries = Vec::with_capacity_in(deps.len(), allocator); + let mut entries = Vec::with_capacity_in(deps.len(), &allocator); for dep in deps { entries.push(compile_dependency(allocator, dep)); } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: None }, - allocator, + &allocator, )) } } @@ -132,13 +132,13 @@ fn compile_dependency<'a>( allocator: &'a Allocator, dep: &crate::factory::R3DependencyMetadata<'a>, ) -> OutputExpression<'a> { - let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(allocator); + let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(&allocator); let token_expr = match &dep.token { Some(token) => token.clone_in(allocator), None => OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), }; entries.push(LiteralMapEntry::new(Ident::from("token"), token_expr, false)); @@ -161,7 +161,7 @@ fn compile_dependency<'a>( OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )) } @@ -180,22 +180,22 @@ fn factory_target_expr<'a>( let factory_target_ref = OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(read_var(allocator, "i0"), allocator), + receiver: Box::new_in(read_var(allocator, "i0"), &allocator), name: Ident::from(Identifiers::FACTORY_TARGET), optional: false, source_span: None, }, - allocator, + &allocator, )); OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(factory_target_ref, allocator), + receiver: Box::new_in(factory_target_ref, &allocator), name: Ident::from(variant), optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -204,7 +204,7 @@ fn factory_target_expr<'a>( fn read_var<'a>(allocator: &'a Allocator, name: &'static str) -> OutputExpression<'a> { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(name), source_span: None }, - allocator, + &allocator, )) } @@ -215,19 +215,19 @@ fn namespaced_prop<'a>( ) -> OutputExpression<'a> { OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(read_var(allocator, receiver), allocator), + receiver: Box::new_in(read_var(allocator, receiver), &allocator), name: Ident::from(prop), optional: false, source_span: None, }, - allocator, + &allocator, )) } fn string_literal<'a>(allocator: &'a Allocator, value: &'static str) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(Ident::from(value)), source_span: None }, - allocator, + &allocator, )) } @@ -244,7 +244,7 @@ fn bool_entry<'a>(allocator: &'a Allocator, key: &'static str) -> LiteralMapEntr Ident::from(key), OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(true), source_span: None }, - allocator, + &allocator, )), false, ) diff --git a/crates/oxc_angular_compiler/src/partial/injectable.rs b/crates/oxc_angular_compiler/src/partial/injectable.rs index afb4cd6ec..9d81e2328 100644 --- a/crates/oxc_angular_compiler/src/partial/injectable.rs +++ b/crates/oxc_angular_compiler/src/partial/injectable.rs @@ -48,7 +48,7 @@ pub fn compile_declare_injectable_from_metadata<'a>( allocator: &'a Allocator, meta: &R3InjectableMetadata<'a>, ) -> OutputExpression<'a> { - let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(allocator); + let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(&allocator); entries.push(string_entry(allocator, "minVersion", MIN_VERSION_INJECTABLE)); entries.push(string_entry(allocator, "version", PLACEHOLDER_VERSION)); @@ -109,24 +109,24 @@ pub fn compile_declare_injectable_from_metadata<'a>( let map_expr = OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )); - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(map_expr); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { fn_expr: Box::new_in( namespaced_prop(allocator, "i0", Identifiers::DECLARE_INJECTABLE), - allocator, + &allocator, ), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -179,9 +179,9 @@ fn clone_constructor_deps<'a>( // safe-and-correct empty form. Inheriting services still get a // working factory (plain `new`), just without the // inherited-factory optimization. - None => R3FactoryDeps::Valid(Vec::new_in(allocator)), + None => R3FactoryDeps::Valid(Vec::new_in(&allocator)), Some(deps) => { - let mut out = Vec::with_capacity_in(deps.len(), allocator); + let mut out = Vec::with_capacity_in(deps.len(), &allocator); for dep in deps { out.push(R3DependencyMetadata { token: dep.token.as_ref().map(|t| t.clone_in(allocator)), @@ -226,13 +226,13 @@ fn compile_dependencies_array<'a>( allocator: &'a Allocator, deps: &[R3DependencyMetadata<'a>], ) -> OutputExpression<'a> { - let mut entries = Vec::with_capacity_in(deps.len(), allocator); + let mut entries = Vec::with_capacity_in(deps.len(), &allocator); for dep in deps { entries.push(compile_one_dependency(allocator, dep)); } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: None }, - allocator, + &allocator, )) } @@ -243,13 +243,13 @@ fn compile_one_dependency<'a>( allocator: &'a Allocator, dep: &R3DependencyMetadata<'a>, ) -> OutputExpression<'a> { - let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(allocator); + let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(&allocator); let token_expr = match &dep.token { Some(token) => token.clone_in(allocator), None => OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), }; entries.push(LiteralMapEntry::new(Ident::from("token"), token_expr, false)); @@ -272,14 +272,14 @@ fn compile_one_dependency<'a>( OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )) } fn read_var<'a>(allocator: &'a Allocator, name: &'static str) -> OutputExpression<'a> { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(name), source_span: None }, - allocator, + &allocator, )) } @@ -290,19 +290,19 @@ fn namespaced_prop<'a>( ) -> OutputExpression<'a> { OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(read_var(allocator, receiver), allocator), + receiver: Box::new_in(read_var(allocator, receiver), &allocator), name: Ident::from(prop), optional: false, source_span: None, }, - allocator, + &allocator, )) } fn string_literal<'a>(allocator: &'a Allocator, value: &'static str) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(Ident::from(value)), source_span: None }, - allocator, + &allocator, )) } @@ -319,7 +319,7 @@ fn bool_entry<'a>(allocator: &'a Allocator, key: &'static str) -> LiteralMapEntr Ident::from(key), OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(true), source_span: None }, - allocator, + &allocator, )), false, ) diff --git a/crates/oxc_angular_compiler/src/partial/injector.rs b/crates/oxc_angular_compiler/src/partial/injector.rs index 5d5f0d1ab..6687c2038 100644 --- a/crates/oxc_angular_compiler/src/partial/injector.rs +++ b/crates/oxc_angular_compiler/src/partial/injector.rs @@ -31,7 +31,7 @@ pub fn compile_declare_injector_from_metadata<'a>( allocator: &'a Allocator, meta: &R3InjectorMetadata<'a>, ) -> OutputExpression<'a> { - let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(allocator); + let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(&allocator); entries.push(string_entry(allocator, "minVersion", MIN_VERSION_INJECTOR)); entries.push(string_entry(allocator, "version", PLACEHOLDER_VERSION)); @@ -60,7 +60,7 @@ pub fn compile_declare_injector_from_metadata<'a>( entries.push(LiteralMapEntry::new(Ident::from("imports"), raw.clone_in(allocator), false)); } else if !meta.imports.is_empty() { let mut elements: Vec<'a, OutputExpression<'a>> = - Vec::with_capacity_in(meta.imports.len(), allocator); + Vec::with_capacity_in(meta.imports.len(), &allocator); for imp in &meta.imports { elements.push(imp.clone_in(allocator)); } @@ -68,7 +68,7 @@ pub fn compile_declare_injector_from_metadata<'a>( Ident::from("imports"), OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: elements, source_span: None }, - allocator, + &allocator, )), false, )); @@ -86,26 +86,26 @@ fn invoke_declare<'a>( ) -> OutputExpression<'a> { let map_expr = OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )); - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(map_expr); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(namespaced_prop(allocator, "i0", name), allocator), + fn_expr: Box::new_in(namespaced_prop(allocator, "i0", name), &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } fn read_var<'a>(allocator: &'a Allocator, name: &'static str) -> OutputExpression<'a> { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(name), source_span: None }, - allocator, + &allocator, )) } @@ -116,19 +116,19 @@ fn namespaced_prop<'a>( ) -> OutputExpression<'a> { OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(read_var(allocator, receiver), allocator), + receiver: Box::new_in(read_var(allocator, receiver), &allocator), name: Ident::from(prop), optional: false, source_span: None, }, - allocator, + &allocator, )) } fn string_literal<'a>(allocator: &'a Allocator, value: &'static str) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(Ident::from(value)), source_span: None }, - allocator, + &allocator, )) } diff --git a/crates/oxc_angular_compiler/src/partial/mod.rs b/crates/oxc_angular_compiler/src/partial/mod.rs index ee134e333..f92f1fb7d 100644 --- a/crates/oxc_angular_compiler/src/partial/mod.rs +++ b/crates/oxc_angular_compiler/src/partial/mod.rs @@ -76,48 +76,48 @@ pub(crate) fn wrap_forward_ref<'a>( allocator: &'a Allocator, expr: OutputExpression<'a>, ) -> OutputExpression<'a> { - let mut body: Vec<'a, OutputStatement<'a>> = Vec::new_in(allocator); + let mut body: Vec<'a, OutputStatement<'a>> = Vec::new_in(&allocator); body.push(OutputStatement::Return(Box::new_in( ReturnStatement { value: expr, source_span: None }, - allocator, + &allocator, ))); let inner_fn = OutputExpression::Function(Box::new_in( FunctionExpr { name: None, - params: Vec::new_in(allocator), + params: Vec::new_in(&allocator), statements: body, source_span: None, }, - allocator, + &allocator, )); let i0 = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )); let forward_ref_fn = OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(i0, allocator), + receiver: Box::new_in(i0, &allocator), name: Ident::from(Identifiers::FORWARD_REF), optional: false, source_span: None, }, - allocator, + &allocator, )); - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(inner_fn); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(forward_ref_fn, allocator), + fn_expr: Box::new_in(forward_ref_fn, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } diff --git a/crates/oxc_angular_compiler/src/partial/ng_module.rs b/crates/oxc_angular_compiler/src/partial/ng_module.rs index d246a255b..98ac25762 100644 --- a/crates/oxc_angular_compiler/src/partial/ng_module.rs +++ b/crates/oxc_angular_compiler/src/partial/ng_module.rs @@ -46,7 +46,7 @@ pub fn compile_declare_ng_module_from_metadata<'a>( allocator: &'a Allocator, meta: &R3NgModuleMetadata<'a>, ) -> OutputExpression<'a> { - let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(allocator); + let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(&allocator); entries.push(string_entry(allocator, "minVersion", MIN_VERSION_NG_MODULE)); entries.push(string_entry(allocator, "version", PLACEHOLDER_VERSION)); @@ -98,7 +98,7 @@ pub fn compile_declare_factory_for_ng_module<'a>( type_expr: meta.r#type.value.clone_in(allocator), type_decl: meta.r#type.value.clone_in(allocator), type_argument_count: 0, - deps: R3FactoryDeps::Valid(Vec::new_in(allocator)), + deps: R3FactoryDeps::Valid(Vec::new_in(&allocator)), target: FactoryTarget::NgModule, }); compile_declare_factory_function(allocator, &factory_meta) @@ -134,13 +134,13 @@ fn refs_to_array<'a>( refs: &Vec<'a, R3Reference<'a>>, contains_forward_decls: bool, ) -> OutputExpression<'a> { - let mut elements: Vec<'a, OutputExpression<'a>> = Vec::with_capacity_in(refs.len(), allocator); + let mut elements: Vec<'a, OutputExpression<'a>> = Vec::with_capacity_in(refs.len(), &allocator); for r in refs { elements.push(r.value.clone_in(allocator)); } let array_expr = OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: elements, source_span: None }, - allocator, + &allocator, )); if !contains_forward_decls { @@ -149,11 +149,11 @@ fn refs_to_array<'a>( OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { - params: Vec::new_in(allocator), - body: ArrowFunctionBody::Expression(Box::new_in(array_expr, allocator)), + params: Vec::new_in(&allocator), + body: ArrowFunctionBody::Expression(Box::new_in(array_expr, &allocator)), source_span: None, }, - allocator, + &allocator, )) } @@ -166,26 +166,26 @@ fn invoke_declare<'a>( ) -> OutputExpression<'a> { let map_expr = OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )); - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(map_expr); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(namespaced_prop(allocator, "i0", name), allocator), + fn_expr: Box::new_in(namespaced_prop(allocator, "i0", name), &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } fn read_var<'a>(allocator: &'a Allocator, name: &'static str) -> OutputExpression<'a> { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(name), source_span: None }, - allocator, + &allocator, )) } @@ -196,19 +196,19 @@ fn namespaced_prop<'a>( ) -> OutputExpression<'a> { OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(read_var(allocator, receiver), allocator), + receiver: Box::new_in(read_var(allocator, receiver), &allocator), name: Ident::from(prop), optional: false, source_span: None, }, - allocator, + &allocator, )) } fn string_literal<'a>(allocator: &'a Allocator, value: &'static str) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(Ident::from(value)), source_span: None }, - allocator, + &allocator, )) } diff --git a/crates/oxc_angular_compiler/src/partial/pipe.rs b/crates/oxc_angular_compiler/src/partial/pipe.rs index 68ca23095..525468706 100644 --- a/crates/oxc_angular_compiler/src/partial/pipe.rs +++ b/crates/oxc_angular_compiler/src/partial/pipe.rs @@ -42,7 +42,7 @@ pub fn compile_declare_pipe_from_metadata<'a>( allocator: &'a Allocator, meta: &R3PipeMetadata<'a>, ) -> OutputExpression<'a> { - let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(allocator); + let mut entries: Vec<'a, LiteralMapEntry<'a>> = Vec::new_in(&allocator); entries.push(string_entry(allocator, "minVersion", MIN_VERSION_PIPE)); entries.push(string_entry(allocator, "version", PLACEHOLDER_VERSION)); @@ -68,7 +68,7 @@ pub fn compile_declare_pipe_from_metadata<'a>( Ident::from("name"), OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(pipe_name.clone()), source_span: None }, - allocator, + &allocator, )), false, )); @@ -84,24 +84,24 @@ pub fn compile_declare_pipe_from_metadata<'a>( let map_expr = OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )); - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(map_expr); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { fn_expr: Box::new_in( namespaced_prop(allocator, "i0", Identifiers::DECLARE_PIPE), - allocator, + &allocator, ), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -143,9 +143,9 @@ fn clone_constructor_deps<'a>( // inheritance today, so we default to the safe-and-correct empty // form. An inheriting pipe still gets a working factory (plain // `new`), just without the inherited-factory optimization. - None => R3FactoryDeps::Valid(Vec::new_in(allocator)), + None => R3FactoryDeps::Valid(Vec::new_in(&allocator)), Some(deps) => { - let mut out = Vec::with_capacity_in(deps.len(), allocator); + let mut out = Vec::with_capacity_in(deps.len(), &allocator); for dep in deps { // pipe::R3DependencyMetadata and factory::R3DependencyMetadata // are structurally similar but distinct types. Convert. @@ -173,7 +173,7 @@ fn clone_constructor_deps<'a>( fn read_var<'a>(allocator: &'a Allocator, name: &'static str) -> OutputExpression<'a> { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(name), source_span: None }, - allocator, + &allocator, )) } @@ -184,19 +184,19 @@ fn namespaced_prop<'a>( ) -> OutputExpression<'a> { OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(read_var(allocator, receiver), allocator), + receiver: Box::new_in(read_var(allocator, receiver), &allocator), name: Ident::from(prop), optional: false, source_span: None, }, - allocator, + &allocator, )) } fn string_literal<'a>(allocator: &'a Allocator, value: &'static str) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(Ident::from(value)), source_span: None }, - allocator, + &allocator, )) } @@ -211,6 +211,6 @@ fn string_entry<'a>( fn bool_literal<'a>(allocator: &'a Allocator, value: bool) -> OutputExpression<'a> { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(value), source_span: None }, - allocator, + &allocator, )) } diff --git a/crates/oxc_angular_compiler/src/pipe/compiler.rs b/crates/oxc_angular_compiler/src/pipe/compiler.rs index f6df09aaf..a40d200d7 100644 --- a/crates/oxc_angular_compiler/src/pipe/compiler.rs +++ b/crates/oxc_angular_compiler/src/pipe/compiler.rs @@ -52,7 +52,7 @@ pub fn compile_pipe_from_metadata<'a>( // Create the expression: ɵɵdefinePipe(definitionMap) let expression = create_define_pipe_call(allocator, definition_map); - PipeCompileResult { expression, statements: Vec::new_in(allocator) } + PipeCompileResult { expression, statements: Vec::new_in(&allocator) } } /// Builds the definition map for the pipe. @@ -60,7 +60,7 @@ fn build_definition_map<'a>( allocator: &'a Allocator, metadata: &R3PipeMetadata<'a>, ) -> Vec<'a, LiteralMapEntry<'a>> { - let mut entries = Vec::new_in(allocator); + let mut entries = Vec::new_in(&allocator); // name: literal(metadata.pipeName ?? metadata.name) let pipe_name = metadata.pipe_name.clone().unwrap_or_else(|| metadata.name.clone()); @@ -68,7 +68,7 @@ fn build_definition_map<'a>( Ident::from("name"), OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(pipe_name), source_span: None }, - allocator, + &allocator, )), false, )); @@ -85,7 +85,7 @@ fn build_definition_map<'a>( Ident::from("pure"), OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(metadata.pure), source_span: None }, - allocator, + &allocator, )), false, )); @@ -96,7 +96,7 @@ fn build_definition_map<'a>( Ident::from("standalone"), OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(false), source_span: None }, - allocator, + &allocator, )), false, )); @@ -116,36 +116,36 @@ fn create_define_pipe_call<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(Identifiers::DEFINE_PIPE), optional: false, source_span: None, }, - allocator, + &allocator, )); // Create the literal map expression let map_expr = OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries: definition_map, source_span: None }, - allocator, + &allocator, )); // Create the function call - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(map_expr); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(define_pipe_fn, allocator), + fn_expr: Box::new_in(define_pipe_fn, &allocator), args, pure: true, // definePipe is a pure function optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -160,7 +160,7 @@ mod tests { let name = Ident::from("TestPipe"); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("TestPipe"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3PipeMetadata { @@ -190,7 +190,7 @@ mod tests { let name = Ident::from("ImpurePipe"); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("ImpurePipe"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3PipeMetadata { @@ -217,7 +217,7 @@ mod tests { let name = Ident::from("StandalonePipe"); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("StandalonePipe"), source_span: None }, - &allocator, + &&allocator, )); // Standalone = true means DON'T include standalone in output (it's the default) @@ -245,7 +245,7 @@ mod tests { let name = Ident::from("NonStandalonePipe"); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("NonStandalonePipe"), source_span: None }, - &allocator, + &&allocator, )); // Non-standalone pipes should include standalone: false diff --git a/crates/oxc_angular_compiler/src/pipe/decorator.rs b/crates/oxc_angular_compiler/src/pipe/decorator.rs index 884dc2691..3f37ae7f0 100644 --- a/crates/oxc_angular_compiler/src/pipe/decorator.rs +++ b/crates/oxc_angular_compiler/src/pipe/decorator.rs @@ -69,7 +69,7 @@ impl<'a> PipeMetadata<'a> { // Create type expression: reference to the pipe class let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: self.class_name.clone(), source_span: None }, - allocator, + &allocator, )); Some(R3PipeMetadata { @@ -252,7 +252,7 @@ fn extract_constructor_deps<'a>( // Get the constructor's parameters let params = &constructor.value.params; - let mut deps = Vec::with_capacity_in(params.items.len(), allocator); + let mut deps = Vec::with_capacity_in(params.items.len(), &allocator); for param in ¶ms.items { let dep = extract_param_dependency(allocator, param); @@ -316,7 +316,7 @@ fn extract_param_dependency<'a>( value: crate::output::ast::LiteralValue::String(attr_name), source_span: None, }, - allocator, + &allocator, ))), attribute_name_type: token, // The type annotation host, @@ -380,7 +380,7 @@ fn extract_param_token<'a>( // Return a reference to the type return Some(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: type_name, source_span: None }, - allocator, + &allocator, ))); } diff --git a/crates/oxc_angular_compiler/src/pipe/definition.rs b/crates/oxc_angular_compiler/src/pipe/definition.rs index 4e8f3c580..7d748837c 100644 --- a/crates/oxc_angular_compiler/src/pipe/definition.rs +++ b/crates/oxc_angular_compiler/src/pipe/definition.rs @@ -174,14 +174,14 @@ fn generate_pipe_fac<'a>( let type_expr = OutputExpression::ReadVar(oxc_allocator::Box::new_in( ReadVarExpr { name: metadata.class_name.clone(), source_span: None }, - allocator, + &allocator, )); // Convert deps from PipeMetadata format to R3FactoryDeps let factory_deps = match &metadata.deps { Some(deps) => { let mut factory_deps: OxcVec<'a, R3DependencyMetadata<'a>> = - OxcVec::with_capacity_in(deps.len(), allocator); + OxcVec::with_capacity_in(deps.len(), &allocator); for dep in deps { factory_deps.push(R3DependencyMetadata { token: dep.token.as_ref().map(|t| t.clone_in(allocator)), @@ -228,7 +228,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("MyPipe"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3PipeMetadataBuilder::new(Ident::from("MyPipe"), type_expr) @@ -261,7 +261,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("ImpurePipe"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3PipeMetadataBuilder::new(Ident::from("ImpurePipe"), type_expr) @@ -285,7 +285,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("LegacyPipe"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3PipeMetadataBuilder::new(Ident::from("LegacyPipe"), type_expr) @@ -311,7 +311,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("TreeShakablePipe"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3PipeMetadataBuilder::new(Ident::from("TreeShakablePipe"), type_expr) diff --git a/crates/oxc_angular_compiler/src/pipe/metadata.rs b/crates/oxc_angular_compiler/src/pipe/metadata.rs index a97d0f898..4c57fd32c 100644 --- a/crates/oxc_angular_compiler/src/pipe/metadata.rs +++ b/crates/oxc_angular_compiler/src/pipe/metadata.rs @@ -170,7 +170,7 @@ mod tests { let name = Ident::from("TestPipe"); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("TestPipe"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3PipeMetadataBuilder::new(name.clone(), type_expr) @@ -194,9 +194,9 @@ mod tests { value: LiteralValue::String(Ident::from("MyService")), source_span: None, }, - &allocator, + &&allocator, )), - &allocator, + &&allocator, ); let dep = R3DependencyMetadata::new(token); diff --git a/crates/oxc_angular_compiler/src/pipeline/compilation.rs b/crates/oxc_angular_compiler/src/pipeline/compilation.rs index 12e0c625e..4f11478fb 100644 --- a/crates/oxc_angular_compiler/src/pipeline/compilation.rs +++ b/crates/oxc_angular_compiler/src/pipeline/compilation.rs @@ -232,8 +232,8 @@ impl<'a> ComponentCompilationJob<'a> { expressions: ExpressionStore::new(allocator), root, views: IndexMap::with_hasher(FxBuildHasher), - consts: Vec::new_in(allocator), - consts_initializers: Vec::new_in(allocator), + consts: Vec::new_in(&allocator), + consts_initializers: Vec::new_in(&allocator), next_xref_id: 1, // 0 is reserved for root compatibility_mode: CompatibilityMode::TemplateDefinitionBuilder, mode: TemplateCompilationMode::default(), @@ -241,7 +241,7 @@ impl<'a> ComponentCompilationJob<'a> { i18n_message_metadata: FxHashMap::default(), i18n_use_external_ids: true, // Default matches Angular's JIT behavior relative_context_file_path: None, - relocation_entries: Vec::new_in(allocator), + relocation_entries: Vec::new_in(&allocator), enable_debug_locations: false, relative_template_path: None, template_source: None, @@ -332,7 +332,7 @@ impl<'a> ComponentCompilationJob<'a> { pub fn allocate_view(&mut self, parent: Option) -> XrefId { let xref = self.allocate_xref_id(); let view = ViewCompilationUnit::new(self.allocator, xref, parent); - let boxed = Box::new_in(view, self.allocator); + let boxed = Box::new_in(view, &self.allocator); self.views.insert(xref, boxed); xref } @@ -463,15 +463,15 @@ impl<'a> ViewCompilationUnit<'a> { parent, create: CreateOpList::new(allocator), update: UpdateOpList::new(allocator), - create_statements: Vec::new_in(allocator), - update_statements: Vec::new_in(allocator), + create_statements: Vec::new_in(&allocator), + update_statements: Vec::new_in(&allocator), vars: None, fn_name: None, decl_count: None, first_child: None, - context_variables: Vec::new_in(allocator), - aliases: Vec::new_in(allocator), - functions: Vec::new_in(allocator), + context_variables: Vec::new_in(&allocator), + aliases: Vec::new_in(&allocator), + functions: Vec::new_in(&allocator), } } } @@ -781,8 +781,8 @@ impl<'a> HostBindingCompilationUnit<'a> { xref, create: CreateOpList::new(allocator), update: UpdateOpList::new(allocator), - create_statements: Vec::new_in(allocator), - update_statements: Vec::new_in(allocator), + create_statements: Vec::new_in(&allocator), + update_statements: Vec::new_in(&allocator), attributes: None, vars: None, fn_name: None, diff --git a/crates/oxc_angular_compiler/src/pipeline/constant_pool.rs b/crates/oxc_angular_compiler/src/pipeline/constant_pool.rs index 37d9ad4b3..ab833892f 100644 --- a/crates/oxc_angular_compiler/src/pipeline/constant_pool.rs +++ b/crates/oxc_angular_compiler/src/pipeline/constant_pool.rs @@ -48,11 +48,11 @@ impl<'a> ConstantPool<'a> { allocator, strings: FxHashMap::default(), arrays: FxHashMap::default(), - values: Vec::new_in(allocator), + values: Vec::new_in(&allocator), next_name_index: 0, unique_name_offset: 0, claimed_names: FxHashMap::default(), - statements: Vec::new_in(allocator), + statements: Vec::new_in(&allocator), } } @@ -75,11 +75,11 @@ impl<'a> ConstantPool<'a> { allocator, strings: FxHashMap::default(), arrays: FxHashMap::default(), - values: Vec::new_in(allocator), + values: Vec::new_in(&allocator), next_name_index: starting_index, unique_name_offset: starting_index, claimed_names: FxHashMap::default(), - statements: Vec::new_in(allocator), + statements: Vec::new_in(&allocator), } } @@ -245,7 +245,7 @@ impl<'a> ConstantPool<'a> { let name = self.generate_name("_c"); // Generate parameter names: a0, a1, a2, ... - let mut params = Vec::with_capacity_in(num_args as usize, self.allocator); + let mut params = Vec::with_capacity_in(num_args as usize, &self.allocator); for i in 0..num_args { params.push(Ident::from(self.allocator.alloc_str(&format!("a{}", i)))); } @@ -256,7 +256,7 @@ impl<'a> ConstantPool<'a> { value: PooledValue { index }, kind: PooledConstantKind::PureFunction(Box::new_in( PureFunctionDef { params, body: body_expr }, - self.allocator, + &self.allocator, )), }); @@ -307,7 +307,7 @@ impl<'a> ConstantPool<'a> { // Return a reference to the existing function return OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: decl.name.clone(), source_span: None }, - self.allocator, + &self.allocator, )); } } @@ -320,7 +320,7 @@ impl<'a> ConstantPool<'a> { // Return a reference to the existing function return OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: decl.name.clone(), source_span: None }, - self.allocator, + &self.allocator, )); } } @@ -345,7 +345,7 @@ impl<'a> ConstantPool<'a> { leading_comment: None, source_span: None, }, - self.allocator, + &self.allocator, ))); } OutputExpression::Function(func) => { @@ -361,7 +361,7 @@ impl<'a> ConstantPool<'a> { modifiers: StmtModifier::FINAL, source_span: inner.source_span, }, - self.allocator, + &self.allocator, ))); } _ => { @@ -374,7 +374,7 @@ impl<'a> ConstantPool<'a> { leading_comment: None, source_span: None, }, - self.allocator, + &self.allocator, ))); } } @@ -382,7 +382,7 @@ impl<'a> ConstantPool<'a> { // Return a ReadVar expression that references this shared function OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: fn_name, source_span: None }, - self.allocator, + &self.allocator, )) } @@ -455,7 +455,7 @@ impl<'a> ConstantPool<'a> { let constant = &self.values[pooled.index as usize]; return OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: constant.name.clone(), source_span: None }, - self.allocator, + &self.allocator, )); } @@ -466,7 +466,7 @@ impl<'a> ConstantPool<'a> { self.values.push(PooledConstant { name: name.clone(), value: PooledValue { index }, - kind: PooledConstantKind::Literal(Box::new_in(literal, self.allocator)), + kind: PooledConstantKind::Literal(Box::new_in(literal, &self.allocator)), }); self.strings.insert(key, PooledValue { index }); @@ -474,7 +474,7 @@ impl<'a> ConstantPool<'a> { // Return a ReadVar expression referencing the constant OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name, source_span: None }, - self.allocator, + &self.allocator, )) } } diff --git a/crates/oxc_angular_compiler/src/pipeline/conversion.rs b/crates/oxc_angular_compiler/src/pipeline/conversion.rs index 2a99c8ad0..947e5d117 100644 --- a/crates/oxc_angular_compiler/src/pipeline/conversion.rs +++ b/crates/oxc_angular_compiler/src/pipeline/conversion.rs @@ -112,7 +112,7 @@ impl<'a> ConvertedExpression<'a> { // For now, we'll create a placeholder. OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Undefined, source_span: None }, - allocator, + &allocator, )) } } @@ -125,7 +125,7 @@ impl<'a> ConvertedExpression<'a> { match self { Self::Ir(expr) => expr, Self::Output(output_expr) => { - IrExpression::OutputExpr(Box::new_in(output_expr, allocator)) + IrExpression::OutputExpr(Box::new_in(output_expr, &allocator)) } } } @@ -283,7 +283,7 @@ pub fn convert_ast<'a>( // Empty expression AngularExpression::Empty(e) => ConvertedExpression::ir(IrExpression::Empty(Box::new_in( IrEmptyExpr { source_span: convert_source_span(e.source_span) }, - allocator, + &allocator, ))), // Implicit receiver - converted to lexical read or context @@ -292,7 +292,7 @@ pub fn convert_ast<'a>( // the receiver of a PropertyRead. Return empty as placeholder. ConvertedExpression::ir(IrExpression::Empty(Box::new_in( IrEmptyExpr { source_span: None }, - allocator, + &allocator, ))) } @@ -300,7 +300,7 @@ pub fn convert_ast<'a>( AngularExpression::ThisReceiver(e) => { ConvertedExpression::ir(IrExpression::Context(Box::new_in( ContextExpr { view: root_xref, source_span: convert_source_span(e.source_span) }, - allocator, + &allocator, ))) } @@ -321,7 +321,7 @@ pub fn convert_ast<'a>( name: pr.name.clone(), source_span: convert_source_span(pr.source_span), }, - allocator, + &allocator, ))) } else if is_this_receiver { // Explicit `this` property read (e.g., `this.formGroup`) becomes a @@ -340,27 +340,27 @@ pub fn convert_ast<'a>( view: root_xref, source_span: convert_source_span(pr.source_span), }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: pr.name.clone(), optional: false, source_span: convert_source_span(pr.source_span), }, - allocator, + &allocator, ))) } else { // Explicit receiver property read becomes ReadPropExpr let receiver = convert_ast(allocator, &pr.receiver, root_xref, allocate_xref_id); ConvertedExpression::output(OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(receiver.to_output(allocator), allocator), + receiver: Box::new_in(receiver.to_output(allocator), &allocator), name: pr.name.clone(), optional: false, source_span: convert_source_span(pr.source_span), }, - allocator, + &allocator, ))) } } @@ -370,11 +370,11 @@ pub fn convert_ast<'a>( let receiver = convert_ast(allocator, &spr.receiver, root_xref, allocate_xref_id); ConvertedExpression::ir(IrExpression::SafePropertyRead(Box::new_in( SafePropertyReadExpr { - receiver: Box::new_in(receiver.to_ir(allocator), allocator), + receiver: Box::new_in(receiver.to_ir(allocator), &allocator), name: spr.name.clone(), source_span: convert_source_span(spr.source_span), }, - allocator, + &allocator, ))) } @@ -384,12 +384,12 @@ pub fn convert_ast<'a>( let key = convert_ast(allocator, &kr.key, root_xref, allocate_xref_id); ConvertedExpression::output(OutputExpression::ReadKey(Box::new_in( ReadKeyExpr { - receiver: Box::new_in(receiver.to_output(allocator), allocator), - index: Box::new_in(key.to_output(allocator), allocator), + receiver: Box::new_in(receiver.to_output(allocator), &allocator), + index: Box::new_in(key.to_output(allocator), &allocator), optional: false, source_span: convert_source_span(kr.source_span), }, - allocator, + &allocator, ))) } @@ -399,11 +399,11 @@ pub fn convert_ast<'a>( let key = convert_ast(allocator, &skr.key, root_xref, allocate_xref_id); ConvertedExpression::ir(IrExpression::SafeKeyedRead(Box::new_in( SafeKeyedReadExpr { - receiver: Box::new_in(receiver.to_ir(allocator), allocator), - index: Box::new_in(key.to_ir(allocator), allocator), + receiver: Box::new_in(receiver.to_ir(allocator), &allocator), + index: Box::new_in(key.to_ir(allocator), &allocator), source_span: convert_source_span(skr.source_span), }, - allocator, + &allocator, ))) } @@ -412,7 +412,7 @@ pub fn convert_ast<'a>( // Note: ImplicitReceiver in Call expression should be caught by parser. // If it reaches here, the receiver conversion will handle it gracefully. let receiver = convert_ast(allocator, &call.receiver, root_xref, allocate_xref_id); - let mut args = Vec::with_capacity_in(call.args.len(), allocator); + let mut args = Vec::with_capacity_in(call.args.len(), &allocator); for arg in call.args.iter() { let converted = convert_ast(allocator, arg, root_xref, allocate_xref_id); args.push(converted.to_output(allocator)); @@ -420,20 +420,20 @@ pub fn convert_ast<'a>( ConvertedExpression::output(OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(receiver.to_output(allocator), allocator), + fn_expr: Box::new_in(receiver.to_output(allocator), &allocator), args, pure: false, optional: false, source_span: convert_source_span(call.source_span), }, - allocator, + &allocator, ))) } // Safe function call - becomes IR SafeInvokeFunctionExpr AngularExpression::SafeCall(sc) => { let receiver = convert_ast(allocator, &sc.receiver, root_xref, allocate_xref_id); - let mut args = Vec::with_capacity_in(sc.args.len(), allocator); + let mut args = Vec::with_capacity_in(sc.args.len(), &allocator); for arg in sc.args.iter() { let converted = convert_ast(allocator, arg, root_xref, allocate_xref_id); args.push(converted.to_ir(allocator)); @@ -441,11 +441,11 @@ pub fn convert_ast<'a>( ConvertedExpression::ir(IrExpression::SafeInvokeFunction(Box::new_in( SafeInvokeFunctionExpr { - receiver: Box::new_in(receiver.to_ir(allocator), allocator), + receiver: Box::new_in(receiver.to_ir(allocator), &allocator), args, source_span: convert_source_span(sc.source_span), }, - allocator, + &allocator, ))) } @@ -454,7 +454,7 @@ pub fn convert_ast<'a>( let xref = allocate_xref_id(); let exp = convert_ast(allocator, &pipe.exp, root_xref, allocate_xref_id); - let mut args = Vec::with_capacity_in(pipe.args.len() + 1, allocator); + let mut args = Vec::with_capacity_in(pipe.args.len() + 1, &allocator); args.push(exp.to_ir(allocator)); for arg in pipe.args.iter() { let converted = convert_ast(allocator, arg, root_xref, allocate_xref_id); @@ -470,7 +470,7 @@ pub fn convert_ast<'a>( var_offset: None, source_span: convert_source_span(pipe.source_span), }, - allocator, + &allocator, ))) } @@ -485,26 +485,26 @@ pub fn convert_ast<'a>( }; ConvertedExpression::output(OutputExpression::Literal(Box::new_in( LiteralExpr { value, source_span: convert_source_span(lit.source_span) }, - allocator, + &allocator, ))) } // Literal array AngularExpression::LiteralArray(arr) => { - let mut entries = Vec::with_capacity_in(arr.expressions.len(), allocator); + let mut entries = Vec::with_capacity_in(arr.expressions.len(), &allocator); for expr in arr.expressions.iter() { let converted = convert_ast(allocator, expr, root_xref, allocate_xref_id); entries.push(converted.to_output(allocator)); } ConvertedExpression::output(OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: convert_source_span(arr.source_span) }, - allocator, + &allocator, ))) } // Literal map (object) AngularExpression::LiteralMap(map) => { - let mut entries = Vec::with_capacity_in(map.keys.len(), allocator); + let mut entries = Vec::with_capacity_in(map.keys.len(), &allocator); for (key, value) in map.keys.iter().zip(map.values.iter()) { let converted_value = convert_ast(allocator, value, root_xref, allocate_xref_id); match key { @@ -522,7 +522,7 @@ pub fn convert_ast<'a>( } ConvertedExpression::output(OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: convert_source_span(map.source_span) }, - allocator, + &allocator, ))) } @@ -534,12 +534,12 @@ pub fn convert_ast<'a>( ConvertedExpression::output(OutputExpression::Conditional(Box::new_in( ConditionalExpr { - condition: Box::new_in(condition.to_output(allocator), allocator), - true_case: Box::new_in(true_case.to_output(allocator), allocator), - false_case: Some(Box::new_in(false_case.to_output(allocator), allocator)), + condition: Box::new_in(condition.to_output(allocator), &allocator), + true_case: Box::new_in(true_case.to_output(allocator), &allocator), + false_case: Some(Box::new_in(false_case.to_output(allocator), &allocator)), source_span: convert_source_span(cond.source_span), }, - allocator, + &allocator, ))) } @@ -552,11 +552,11 @@ pub fn convert_ast<'a>( ConvertedExpression::output(OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator, - lhs: Box::new_in(left.to_output(allocator), allocator), - rhs: Box::new_in(right.to_output(allocator), allocator), + lhs: Box::new_in(left.to_output(allocator), &allocator), + rhs: Box::new_in(right.to_output(allocator), &allocator), source_span: convert_source_span(bin.source_span), }, - allocator, + &allocator, ))) } @@ -568,11 +568,11 @@ pub fn convert_ast<'a>( ConvertedExpression::output(OutputExpression::UnaryOperator(Box::new_in( UnaryOperatorExpr { operator, - expr: Box::new_in(expr.to_output(allocator), allocator), + expr: Box::new_in(expr.to_output(allocator), &allocator), parens: false, source_span: convert_source_span(unary.source_span), }, - allocator, + &allocator, ))) } @@ -581,10 +581,10 @@ pub fn convert_ast<'a>( let expr = convert_ast(allocator, ¬.expression, root_xref, allocate_xref_id); ConvertedExpression::output(OutputExpression::Not(Box::new_in( NotExpr { - condition: Box::new_in(expr.to_output(allocator), allocator), + condition: Box::new_in(expr.to_output(allocator), &allocator), source_span: convert_source_span(not.source_span), }, - allocator, + &allocator, ))) } @@ -593,10 +593,10 @@ pub fn convert_ast<'a>( let expr = convert_ast(allocator, &type_of.expression, root_xref, allocate_xref_id); ConvertedExpression::output(OutputExpression::Typeof(Box::new_in( TypeofExpr { - expr: Box::new_in(expr.to_output(allocator), allocator), + expr: Box::new_in(expr.to_output(allocator), &allocator), source_span: convert_source_span(type_of.source_span), }, - allocator, + &allocator, ))) } @@ -605,10 +605,10 @@ pub fn convert_ast<'a>( let expr = convert_ast(allocator, &void_expr.expression, root_xref, allocate_xref_id); ConvertedExpression::output(OutputExpression::Void(Box::new_in( VoidExpr { - expr: Box::new_in(expr.to_output(allocator), allocator), + expr: Box::new_in(expr.to_output(allocator), &allocator), source_span: convert_source_span(void_expr.source_span), }, - allocator, + &allocator, ))) } @@ -622,16 +622,16 @@ pub fn convert_ast<'a>( let expr = convert_ast(allocator, &paren.expression, root_xref, allocate_xref_id); ConvertedExpression::output(OutputExpression::Parenthesized(Box::new_in( ParenthesizedExpr { - expr: Box::new_in(expr.to_output(allocator), allocator), + expr: Box::new_in(expr.to_output(allocator), &allocator), source_span: convert_source_span(paren.source_span), }, - allocator, + &allocator, ))) } // Template literal AngularExpression::TemplateLiteral(tl) => { - let mut elements = Vec::with_capacity_in(tl.elements.len(), allocator); + let mut elements = Vec::with_capacity_in(tl.elements.len(), &allocator); for elem in tl.elements.iter() { elements.push(TemplateLiteralElement { text: elem.text.clone(), @@ -640,7 +640,7 @@ pub fn convert_ast<'a>( }); } - let mut expressions = Vec::with_capacity_in(tl.expressions.len(), allocator); + let mut expressions = Vec::with_capacity_in(tl.expressions.len(), &allocator); for expr in tl.expressions.iter() { let converted = convert_ast(allocator, expr, root_xref, allocate_xref_id); expressions.push(converted.to_output(allocator)); @@ -652,7 +652,7 @@ pub fn convert_ast<'a>( expressions, source_span: convert_source_span(tl.source_span), }, - allocator, + &allocator, ))) } @@ -660,7 +660,7 @@ pub fn convert_ast<'a>( AngularExpression::TaggedTemplateLiteral(ttl) => { let tag = convert_ast(allocator, &ttl.tag, root_xref, allocate_xref_id); - let mut elements = Vec::with_capacity_in(ttl.template.elements.len(), allocator); + let mut elements = Vec::with_capacity_in(ttl.template.elements.len(), &allocator); for elem in ttl.template.elements.iter() { elements.push(TemplateLiteralElement { text: elem.text.clone(), @@ -669,7 +669,7 @@ pub fn convert_ast<'a>( }); } - let mut expressions = Vec::with_capacity_in(ttl.template.expressions.len(), allocator); + let mut expressions = Vec::with_capacity_in(ttl.template.expressions.len(), &allocator); for expr in ttl.template.expressions.iter() { let converted = convert_ast(allocator, expr, root_xref, allocate_xref_id); expressions.push(converted.to_output(allocator)); @@ -677,18 +677,18 @@ pub fn convert_ast<'a>( ConvertedExpression::output(OutputExpression::TaggedTemplateLiteral(Box::new_in( TaggedTemplateLiteralExpr { - tag: Box::new_in(tag.to_output(allocator), allocator), + tag: Box::new_in(tag.to_output(allocator), &allocator), template: Box::new_in( TemplateLiteralExpr { elements, expressions, source_span: convert_source_span(ttl.template.source_span), }, - allocator, + &allocator, ), source_span: convert_source_span(ttl.source_span), }, - allocator, + &allocator, ))) } @@ -700,7 +700,7 @@ pub fn convert_ast<'a>( flags: re.flags.clone(), source_span: convert_source_span(re.source_span), }, - allocator, + &allocator, ))) } @@ -710,18 +710,18 @@ pub fn convert_ast<'a>( AngularExpression::Chain(chain) => { ConvertedExpression::ir(IrExpression::Empty(Box::new_in( IrEmptyExpr { source_span: convert_source_span(chain.source_span) }, - allocator, + &allocator, ))) } // Interpolation - converted to IR Interpolation AngularExpression::Interpolation(interp) => { - let mut strings = Vec::with_capacity_in(interp.strings.len(), allocator); + let mut strings = Vec::with_capacity_in(interp.strings.len(), &allocator); for s in interp.strings.iter() { strings.push(s.clone()); } - let mut expressions = Vec::with_capacity_in(interp.expressions.len(), allocator); + let mut expressions = Vec::with_capacity_in(interp.expressions.len(), &allocator); for expr in interp.expressions.iter() { let converted = convert_ast(allocator, expr, root_xref, allocate_xref_id); expressions.push(converted.to_ir(allocator)); @@ -731,10 +731,10 @@ pub fn convert_ast<'a>( crate::ir::expression::Interpolation { strings, expressions, - i18n_placeholders: Vec::new_in(allocator), + i18n_placeholders: Vec::new_in(&allocator), source_span: convert_source_span(interp.source_span), }, - allocator, + &allocator, ))) } @@ -750,19 +750,19 @@ pub fn convert_ast<'a>( // Arrow functions in Angular templates are used as callbacks // Convert the body expression and wrap in ArrowFunctionExpr let body = convert_ast(allocator, &arrow.body, root_xref, allocate_xref_id); - let mut params = Vec::with_capacity_in(arrow.parameters.len(), allocator); + let mut params = Vec::with_capacity_in(arrow.parameters.len(), &allocator); for p in arrow.parameters.iter() { params.push(crate::output::ast::FnParam { name: p.name.clone() }); } ConvertedExpression::ir(IrExpression::ArrowFunction(Box::new_in( crate::ir::expression::ArrowFunctionExpr { params, - body: Box::new_in(body.to_ir(allocator), allocator), - ops: Vec::new_in(allocator), + body: Box::new_in(body.to_ir(allocator), &allocator), + ops: Vec::new_in(&allocator), var_offset: None, source_span: convert_source_span(arrow.source_span), }, - allocator, + &allocator, ))) } } diff --git a/crates/oxc_angular_compiler/src/pipeline/emit.rs b/crates/oxc_angular_compiler/src/pipeline/emit.rs index 00c239803..777ac0e42 100644 --- a/crates/oxc_angular_compiler/src/pipeline/emit.rs +++ b/crates/oxc_angular_compiler/src/pipeline/emit.rs @@ -103,7 +103,7 @@ fn emit_child_views_recursive<'a>( modifiers: StmtModifier::NONE, source_span: None, }, - job.allocator, + &job.allocator, )); job.pool.statements.push(fn_stmt); } @@ -130,14 +130,14 @@ fn emit_view<'a>(allocator: &'a Allocator, view: &ViewCompilationUnit<'a>) -> Fu let update_block = maybe_generate_rf_block(allocator, 2, update_statements); // Combine into function body - let mut body: OxcVec<'a, OutputStatement<'a>> = OxcVec::new_in(allocator); + let mut body: OxcVec<'a, OutputStatement<'a>> = OxcVec::new_in(&allocator); body.extend(create_block); body.extend(update_block); // Create function parameters: (rf, ctx) // - rf: Render flags (1 = create, 2 = update) // - ctx: Component context (this) - let mut params: OxcVec<'a, FnParam<'a>> = OxcVec::new_in(allocator); + let mut params: OxcVec<'a, FnParam<'a>> = OxcVec::new_in(&allocator); params.push(FnParam { name: Ident::from("rf") }); params.push(FnParam { name: Ident::from("ctx") }); @@ -149,9 +149,9 @@ fn clone_statements<'a>( allocator: &'a Allocator, statements: &OxcVec<'a, OutputStatement<'a>>, ) -> OxcVec<'a, OutputStatement<'a>> { - let mut result = OxcVec::new_in(allocator); + let mut result = OxcVec::new_in(&allocator); for stmt in statements.iter() { - result.push(clone_output_statement(stmt, allocator)); + result.push(clone_output_statement(stmt, &allocator)); } result } @@ -161,7 +161,7 @@ fn clone_params<'a>( allocator: &'a Allocator, params: &OxcVec<'a, FnParam<'a>>, ) -> OxcVec<'a, FnParam<'a>> { - let mut result = OxcVec::new_in(allocator); + let mut result = OxcVec::new_in(&allocator); for param in params.iter() { result.push(FnParam { name: param.name.clone() }); } @@ -177,7 +177,7 @@ fn maybe_generate_rf_block<'a>( statements: OxcVec<'a, OutputStatement<'a>>, ) -> OxcVec<'a, OutputStatement<'a>> { if statements.is_empty() { - return OxcVec::new_in(allocator); + return OxcVec::new_in(&allocator); } // Create condition: rf & flag @@ -187,20 +187,20 @@ fn maybe_generate_rf_block<'a>( lhs: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("rf"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), rhs: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(flag as f64), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), source_span: None, }, - allocator, + &allocator, )); // Create if statement @@ -208,13 +208,13 @@ fn maybe_generate_rf_block<'a>( IfStmt { condition, true_case: statements, - false_case: OxcVec::new_in(allocator), + false_case: OxcVec::new_in(&allocator), source_span: None, }, - allocator, + &allocator, )); - let mut result: OxcVec<'a, OutputStatement<'a>> = OxcVec::new_in(allocator); + let mut result: OxcVec<'a, OutputStatement<'a>> = OxcVec::new_in(&allocator); result.push(if_stmt); result } @@ -244,12 +244,12 @@ pub fn emit_host_binding_function<'a>( let update_block = maybe_generate_rf_block(allocator, 2, update_statements); // Combine into function body - let mut body: OxcVec<'a, OutputStatement<'a>> = OxcVec::new_in(allocator); + let mut body: OxcVec<'a, OutputStatement<'a>> = OxcVec::new_in(&allocator); body.extend(create_block); body.extend(update_block); // Create function parameters: (rf, ctx) - let mut params: OxcVec<'a, FnParam<'a>> = OxcVec::new_in(allocator); + let mut params: OxcVec<'a, FnParam<'a>> = OxcVec::new_in(&allocator); params.push(FnParam { name: Ident::from("rf") }); params.push(FnParam { name: Ident::from("ctx") }); @@ -288,7 +288,7 @@ pub fn compile_template<'a>( let template_fn = emit_template_fn(job); // Collect declarations from job.pool constants and statements - let mut declarations = OxcVec::new_in(allocator); + let mut declarations = OxcVec::new_in(&allocator); // Generate const declarations from pooled constants // Use mutable access to allow taking ownership of expressions that can't be cloned @@ -303,13 +303,13 @@ pub fn compile_template<'a>( leading_comment: None, source_span: None, }, - allocator, + &allocator, ))); } // Add child view function declarations from job.pool for stmt in job.pool.statements.iter() { - declarations.push(clone_output_statement(stmt, allocator)); + declarations.push(clone_output_statement(stmt, &allocator)); } TemplateCompilationResult { template_fn, declarations } @@ -337,7 +337,7 @@ pub fn emit_additional_pool_constants<'a>( ) -> OxcVec<'a, OutputStatement<'a>> { use crate::output::ast::DeclareVarStmt; - let mut declarations = OxcVec::new_in(allocator); + let mut declarations = OxcVec::new_in(&allocator); // Only emit constants starting from start_index let constants = job.pool.constants_mut(); @@ -352,7 +352,7 @@ pub fn emit_additional_pool_constants<'a>( leading_comment: None, source_span: None, }, - allocator, + &allocator, ))); } @@ -385,7 +385,7 @@ fn convert_pure_function_body<'a>( }; OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: param_name, source_span: None }, - allocator, + &allocator, )) } @@ -395,7 +395,7 @@ fn convert_pure_function_body<'a>( // Direct reference to context parameter - emit as just `ctx` OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("ctx"), source_span: None }, - allocator, + &allocator, )) } else { // Property access on ctx - emit as `ctx.property` @@ -404,15 +404,15 @@ fn convert_pure_function_body<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("ctx"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: lexical.name.clone(), optional: false, source_span: None, }, - allocator, + &allocator, )) } } @@ -420,13 +420,13 @@ fn convert_pure_function_body<'a>( // Context reference becomes ctx IrExpression::Context(_) => OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("ctx"), source_span: None }, - allocator, + &allocator, )), // TrackContext reference becomes this (for track functions) IrExpression::TrackContext(_) => OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("this"), source_span: None }, - allocator, + &allocator, )), // Read variable with resolved name @@ -437,7 +437,7 @@ fn convert_pure_function_body<'a>( .unwrap_or_else(|| Ident::from(allocator.alloc_str(&format!("_v{}", var.xref.0)))); OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: var_name, source_span: None }, - allocator, + &allocator, )) } @@ -446,7 +446,7 @@ fn convert_pure_function_body<'a>( let var_name = tmp.name.clone().unwrap_or_else(|| Ident::from("_tmp")); OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: var_name, source_span: None }, - allocator, + &allocator, )) } @@ -460,21 +460,21 @@ fn convert_pure_function_body<'a>( lhs: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: var_name, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), - rhs: Box::new_in(value, allocator), + rhs: Box::new_in(value, &allocator), source_span: None, }, - allocator, + &allocator, )) } // Empty becomes undefined IrExpression::Empty(_) => OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Undefined, source_span: None }, - allocator, + &allocator, )), // Binary expression @@ -485,18 +485,18 @@ fn convert_pure_function_body<'a>( OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator, - lhs: Box::new_in(lhs, allocator), - rhs: Box::new_in(rhs, allocator), + lhs: Box::new_in(lhs, &allocator), + rhs: Box::new_in(rhs, &allocator), source_span: None, }, - allocator, + &allocator, )) } // Interpolation - emit as interpolate call IrExpression::Interpolation(interp) => { let expr_count = interp.expressions.len(); - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // Build args: [s0, v0, s1, v1, s2, ...] (strings and expressions interleaved) for (i, ir_expr) in interp.expressions.iter().enumerate() { @@ -506,7 +506,7 @@ fn convert_pure_function_body<'a>( value: LiteralValue::String(interp.strings[i].clone()), source_span: None, }, - allocator, + &allocator, ))); } args.push(convert_pure_function_body(allocator, ir_expr, params)); @@ -519,7 +519,7 @@ fn convert_pure_function_body<'a>( value: LiteralValue::String(trailing.clone()), source_span: None, }, - allocator, + &allocator, ))); } } @@ -538,16 +538,16 @@ fn convert_pure_function_body<'a>( }, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), args, pure: true, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -556,12 +556,12 @@ fn convert_pure_function_body<'a>( if let Some(slot) = slot_lit.slot.slot { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(slot.0 as f64), source_span: None }, - allocator, + &allocator, )) } else { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )) } } @@ -569,26 +569,26 @@ fn convert_pure_function_body<'a>( // Const reference - emit as number (index into const array) IrExpression::ConstReference(cr) => OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(cr.index as f64), source_span: None }, - allocator, + &allocator, )), // Pipe binding - convert recursively IrExpression::PipeBinding(pb) => { // ɵɵpipeBind{n}(slot, varOffset, pipeRef, ...args) - let mut call_args = OxcVec::new_in(allocator); + let mut call_args = OxcVec::new_in(&allocator); call_args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(pb.target_slot.slot.map_or(0.0, |s| s.0 as f64)), source_span: None, }, - allocator, + &allocator, ))); call_args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(pb.var_offset.map_or(0.0, |v| v as f64)), source_span: None, }, - allocator, + &allocator, ))); for arg in pb.args.iter() { call_args.push(convert_pure_function_body(allocator, arg, params)); @@ -605,35 +605,35 @@ fn convert_pure_function_body<'a>( }, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), args: call_args, pure: true, optional: false, source_span: None, }, - allocator, + &allocator, )) } // Variadic pipe binding IrExpression::PipeBindingVariadic(pb) => { - let mut call_args = OxcVec::new_in(allocator); + let mut call_args = OxcVec::new_in(&allocator); call_args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(pb.target_slot.slot.map_or(0.0, |s| s.0 as f64)), source_span: None, }, - allocator, + &allocator, ))); call_args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(pb.var_offset.map_or(0.0, |v| v as f64)), source_span: None, }, - allocator, + &allocator, ))); call_args.push(convert_pure_function_body(allocator, &pb.args, params)); @@ -648,16 +648,16 @@ fn convert_pure_function_body<'a>( }, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), args: call_args, pure: true, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -666,12 +666,12 @@ fn convert_pure_function_body<'a>( let receiver = convert_pure_function_body(allocator, &resolved.receiver, params); OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(receiver, allocator), + receiver: Box::new_in(receiver, &allocator), name: resolved.name.clone(), optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -714,30 +714,30 @@ fn convert_pure_function_body<'a>( OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator, - lhs: Box::new_in(left, allocator), - rhs: Box::new_in(right, allocator), + lhs: Box::new_in(left, &allocator), + rhs: Box::new_in(right, &allocator), source_span: None, }, - allocator, + &allocator, )) } // Resolved call expression IrExpression::ResolvedCall(resolved) => { let receiver = convert_pure_function_body(allocator, &resolved.receiver, params); - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); for arg in resolved.args.iter() { args.push(convert_pure_function_body(allocator, arg, params)); } OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(receiver, allocator), + fn_expr: Box::new_in(receiver, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -747,12 +747,12 @@ fn convert_pure_function_body<'a>( let key = convert_pure_function_body(allocator, &resolved.key, params); OutputExpression::ReadKey(Box::new_in( ReadKeyExpr { - receiver: Box::new_in(receiver, allocator), - index: Box::new_in(key, allocator), + receiver: Box::new_in(receiver, &allocator), + index: Box::new_in(key, &allocator), optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -766,45 +766,45 @@ fn convert_pure_function_body<'a>( OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Equals, - lhs: Box::new_in(receiver, allocator), + lhs: Box::new_in(receiver, &allocator), rhs: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), true_case: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), false_case: Some(Box::new_in( OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(receiver_clone, allocator), + receiver: Box::new_in(receiver_clone, &allocator), name: resolved.name.clone(), optional: false, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, )), source_span: None, }, - allocator, + &allocator, )) } @@ -818,45 +818,45 @@ fn convert_pure_function_body<'a>( OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Equals, - lhs: Box::new_in(receiver, allocator), + lhs: Box::new_in(receiver, &allocator), rhs: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), true_case: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Undefined, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), false_case: Some(Box::new_in( OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(receiver_clone, allocator), + receiver: Box::new_in(receiver_clone, &allocator), name: spr.name.clone(), optional: false, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, )), source_span: None, }, - allocator, + &allocator, )) } @@ -871,45 +871,45 @@ fn convert_pure_function_body<'a>( OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Equals, - lhs: Box::new_in(receiver, allocator), + lhs: Box::new_in(receiver, &allocator), rhs: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), true_case: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Undefined, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), false_case: Some(Box::new_in( OutputExpression::ReadKey(Box::new_in( ReadKeyExpr { - receiver: Box::new_in(receiver_clone, allocator), - index: Box::new_in(index, allocator), + receiver: Box::new_in(receiver_clone, &allocator), + index: Box::new_in(index, &allocator), optional: false, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, )), source_span: None, }, - allocator, + &allocator, )) } @@ -917,7 +917,7 @@ fn convert_pure_function_body<'a>( IrExpression::SafeInvokeFunction(sif) => { let receiver = convert_pure_function_body(allocator, &sif.receiver, params); let receiver_clone = convert_pure_function_body(allocator, &sif.receiver, params); - let mut args = OxcVec::with_capacity_in(sif.args.len(), allocator); + let mut args = OxcVec::with_capacity_in(sif.args.len(), &allocator); for arg in sif.args.iter() { args.push(convert_pure_function_body(allocator, arg, params)); } @@ -927,46 +927,46 @@ fn convert_pure_function_body<'a>( OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Equals, - lhs: Box::new_in(receiver, allocator), + lhs: Box::new_in(receiver, &allocator), rhs: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), true_case: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Undefined, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), false_case: Some(Box::new_in( OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(receiver_clone, allocator), + fn_expr: Box::new_in(receiver_clone, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, )), source_span: None, }, - allocator, + &allocator, )) } @@ -977,11 +977,11 @@ fn convert_pure_function_body<'a>( OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::And, - lhs: Box::new_in(guard, allocator), - rhs: Box::new_in(expr, allocator), + lhs: Box::new_in(guard, &allocator), + rhs: Box::new_in(expr, &allocator), source_span: None, }, - allocator, + &allocator, )) } @@ -996,7 +996,7 @@ fn convert_pure_function_body<'a>( let target = convert_pure_function_body(allocator, &tbs.target, params); let value = convert_pure_function_body(allocator, &tbs.value, params); // Create: i0.ɵɵtwoWayBindingSet(target, value) - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(target); args.push(value); OutputExpression::InvokeFunction(Box::new_in( @@ -1010,26 +1010,26 @@ fn convert_pure_function_body<'a>( }, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } // Context @let reference IrExpression::ContextLetReference(ctx_let) => { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); if let Some(slot) = ctx_let.target_slot.slot { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(slot.0 as f64), source_span: None }, - allocator, + &allocator, ))); } OutputExpression::InvokeFunction(Box::new_in( @@ -1043,22 +1043,22 @@ fn convert_pure_function_body<'a>( }, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), args, pure: true, optional: false, source_span: None, }, - allocator, + &allocator, )) } // Store @let value IrExpression::StoreLet(store) => { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(convert_pure_function_body(allocator, &store.value, params)); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { @@ -1071,16 +1071,16 @@ fn convert_pure_function_body<'a>( }, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -1091,7 +1091,7 @@ fn convert_pure_function_body<'a>( } else { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )) } } @@ -1105,7 +1105,7 @@ fn convert_pure_function_body<'a>( // Return undefined as a fallback to avoid runtime panic. OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Undefined, source_span: None }, - allocator, + &allocator, )) } @@ -1120,7 +1120,7 @@ fn convert_pure_function_body<'a>( // Return undefined as a fallback OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Undefined, source_span: None }, - allocator, + &allocator, )) } @@ -1131,27 +1131,27 @@ fn convert_pure_function_body<'a>( let false_case = convert_pure_function_body(allocator, &ternary.false_expr, params); OutputExpression::Conditional(Box::new_in( ConditionalExpr { - condition: Box::new_in(condition, allocator), - true_case: Box::new_in(true_case, allocator), - false_case: Some(Box::new_in(false_case, allocator)), + condition: Box::new_in(condition, &allocator), + true_case: Box::new_in(true_case, &allocator), + false_case: Some(Box::new_in(false_case, &allocator)), source_span: ternary.source_span, }, - allocator, + &allocator, )) } // DerivedLiteralArray: convert to a literal array with nested conversions IrExpression::DerivedLiteralArray(arr) => { - let mut entries = OxcVec::with_capacity_in(arr.entries.len(), allocator); + let mut entries = OxcVec::with_capacity_in(arr.entries.len(), &allocator); for (i, entry) in arr.entries.iter().enumerate() { let converted = convert_pure_function_body(allocator, entry, params); if arr.spreads.get(i).copied().unwrap_or(false) { entries.push(OutputExpression::SpreadElement(Box::new_in( SpreadElementExpr { - expr: Box::new_in(converted, allocator), + expr: Box::new_in(converted, &allocator), source_span: None, }, - allocator, + &allocator, ))); } else { entries.push(converted); @@ -1159,13 +1159,13 @@ fn convert_pure_function_body<'a>( } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: None }, - allocator, + &allocator, )) } // DerivedLiteralMap: convert to a literal map with nested conversions IrExpression::DerivedLiteralMap(map) => { - let mut entries = OxcVec::with_capacity_in(map.keys.len(), allocator); + let mut entries = OxcVec::with_capacity_in(map.keys.len(), &allocator); for i in 0..map.keys.len() { let key = map.keys[i].clone(); let value = convert_pure_function_body(allocator, &map.values[i], params); @@ -1175,22 +1175,22 @@ fn convert_pure_function_body<'a>( } OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )) } // LiteralArray: convert to a literal array with nested conversions IrExpression::LiteralArray(arr) => { - let mut entries = OxcVec::with_capacity_in(arr.elements.len(), allocator); + let mut entries = OxcVec::with_capacity_in(arr.elements.len(), &allocator); for (i, elem) in arr.elements.iter().enumerate() { let converted = convert_pure_function_body(allocator, elem, params); if arr.spreads.get(i).copied().unwrap_or(false) { entries.push(OutputExpression::SpreadElement(Box::new_in( SpreadElementExpr { - expr: Box::new_in(converted, allocator), + expr: Box::new_in(converted, &allocator), source_span: None, }, - allocator, + &allocator, ))); } else { entries.push(converted); @@ -1198,13 +1198,13 @@ fn convert_pure_function_body<'a>( } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: None }, - allocator, + &allocator, )) } // LiteralMap: convert to a literal map with nested conversions IrExpression::LiteralMap(map) => { - let mut entries = OxcVec::with_capacity_in(map.keys.len(), allocator); + let mut entries = OxcVec::with_capacity_in(map.keys.len(), &allocator); for i in 0..map.keys.len() { let key = map.keys[i].clone(); let value = convert_pure_function_body(allocator, &map.values[i], params); @@ -1214,7 +1214,7 @@ fn convert_pure_function_body<'a>( } OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )) } @@ -1223,10 +1223,10 @@ fn convert_pure_function_body<'a>( let inner = convert_pure_function_body(allocator, ¬_expr.expr, params); OutputExpression::Not(Box::new_in( crate::output::ast::NotExpr { - condition: Box::new_in(inner, allocator), + condition: Box::new_in(inner, &allocator), source_span: None, }, - allocator, + &allocator, )) } @@ -1240,11 +1240,11 @@ fn convert_pure_function_body<'a>( OutputExpression::UnaryOperator(Box::new_in( UnaryOperatorExpr { operator, - expr: Box::new_in(inner, allocator), + expr: Box::new_in(inner, &allocator), parens: false, source_span: None, }, - allocator, + &allocator, )) } @@ -1253,10 +1253,10 @@ fn convert_pure_function_body<'a>( let inner = convert_pure_function_body(allocator, &typeof_expr.expr, params); OutputExpression::Typeof(Box::new_in( crate::output::ast::TypeofExpr { - expr: Box::new_in(inner, allocator), + expr: Box::new_in(inner, &allocator), source_span: None, }, - allocator, + &allocator, )) } @@ -1265,17 +1265,17 @@ fn convert_pure_function_body<'a>( let inner = convert_pure_function_body(allocator, &void_expr.expr, params); OutputExpression::Void(Box::new_in( crate::output::ast::VoidExpr { - expr: Box::new_in(inner, allocator), + expr: Box::new_in(inner, &allocator), source_span: None, }, - allocator, + &allocator, )) } // ResolvedTemplateLiteral: convert to template literal with resolved expressions IrExpression::ResolvedTemplateLiteral(rtl) => { - let mut elements = OxcVec::new_in(allocator); - let mut expressions = OxcVec::new_in(allocator); + let mut elements = OxcVec::new_in(&allocator); + let mut expressions = OxcVec::new_in(&allocator); for elem in rtl.elements.iter() { elements.push(crate::output::ast::TemplateLiteralElement { @@ -1295,13 +1295,13 @@ fn convert_pure_function_body<'a>( expressions, source_span: rtl.source_span, }, - allocator, + &allocator, )) } // Arrow function - convert body and preserve parameters IrExpression::ArrowFunction(arrow_fn) => { - let mut params_vec = OxcVec::with_capacity_in(arrow_fn.params.len(), allocator); + let mut params_vec = OxcVec::with_capacity_in(arrow_fn.params.len(), &allocator); for param in arrow_fn.params.iter() { params_vec.push(crate::output::ast::FnParam { name: param.name.clone() }); } @@ -1313,11 +1313,11 @@ fn convert_pure_function_body<'a>( crate::output::ast::ArrowFunctionExpr { params: params_vec, body: crate::output::ast::ArrowFunctionBody::Expression(Box::new_in( - body_expr, allocator, + body_expr, &allocator, )), source_span: arrow_fn.source_span, }, - allocator, + &allocator, )) } // Parenthesized expression - convert inner and wrap @@ -1325,10 +1325,10 @@ fn convert_pure_function_body<'a>( let inner = convert_pure_function_body(allocator, &paren.expr, params); OutputExpression::Parenthesized(Box::new_in( crate::output::ast::ParenthesizedExpr { - expr: Box::new_in(inner, allocator), + expr: Box::new_in(inner, &allocator), source_span: paren.source_span, }, - allocator, + &allocator, )) } // The `$safeNavigationMigration` wrapper is removed by expandSafeReads long @@ -1362,21 +1362,21 @@ fn convert_ast_for_pure_function_body<'a>( }; OutputExpression::Literal(Box::new_in( LiteralExpr { value, source_span: None }, - allocator, + &allocator, )) } AngularExpression::LiteralArray(arr) => { - let mut entries = OxcVec::with_capacity_in(arr.expressions.len(), allocator); + let mut entries = OxcVec::with_capacity_in(arr.expressions.len(), &allocator); for entry in arr.expressions.iter() { if let AngularExpression::SpreadElement(spread) = entry { let inner = convert_ast_for_pure_function_body(allocator, &spread.expression, params); entries.push(OutputExpression::SpreadElement(Box::new_in( SpreadElementExpr { - expr: Box::new_in(inner, allocator), + expr: Box::new_in(inner, &allocator), source_span: None, }, - allocator, + &allocator, ))); } else { entries.push(convert_ast_for_pure_function_body(allocator, entry, params)); @@ -1384,18 +1384,18 @@ fn convert_ast_for_pure_function_body<'a>( } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: None }, - allocator, + &allocator, )) } AngularExpression::LiteralMap(map) => { - let mut entries = OxcVec::with_capacity_in(map.keys.len(), allocator); + let mut entries = OxcVec::with_capacity_in(map.keys.len(), &allocator); for (i, key) in map.keys.iter().enumerate() { let value = if i < map.values.len() { convert_ast_for_pure_function_body(allocator, &map.values[i], params) } else { OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Undefined, source_span: None }, - allocator, + &allocator, )) }; match key { @@ -1409,12 +1409,12 @@ fn convert_ast_for_pure_function_body<'a>( } OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, )) } AngularExpression::Empty(_) => OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Undefined, source_span: None }, - allocator, + &allocator, )), // For property reads on implicit receiver, convert to ctx.property AngularExpression::PropertyRead(prop) => { @@ -1427,28 +1427,28 @@ fn convert_ast_for_pure_function_body<'a>( name: Ident::from("ctx"), source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: prop.name.clone(), optional: false, source_span: None, }, - allocator, + &allocator, )) } else { // Fallback for non-implicit receivers - shouldn't happen for constants OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Undefined, source_span: None }, - allocator, + &allocator, )) } } // Other expressions shouldn't appear in constant pure function bodies _ => OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Undefined, source_span: None }, - allocator, + &allocator, )), } } @@ -1465,37 +1465,37 @@ fn emit_pooled_constant_value<'a>( match kind { PooledConstantKind::String(s) => OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(s.clone()), source_span: None }, - allocator, + &allocator, )), PooledConstantKind::Number(n) => OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(*n), source_span: None }, - allocator, + &allocator, )), PooledConstantKind::Boolean(b) => OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(*b), source_span: None }, - allocator, + &allocator, )), PooledConstantKind::Array(elements) => { // Recursively emit array elements - let mut entries = OxcVec::with_capacity_in(elements.len(), allocator); + let mut entries = OxcVec::with_capacity_in(elements.len(), &allocator); for elem in elements.iter_mut() { entries.push(emit_pooled_constant_value(allocator, elem)); } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: None }, - allocator, + &allocator, )) } PooledConstantKind::ArrayPlaceholder => { // Placeholder arrays emit as empty arrays OutputExpression::LiteralArray(Box::new_in( - LiteralArrayExpr { entries: OxcVec::new_in(allocator), source_span: None }, - allocator, + LiteralArrayExpr { entries: OxcVec::new_in(&allocator), source_span: None }, + &allocator, )) } PooledConstantKind::Object(entries) => { // Emit object literal - let mut map_entries = OxcVec::with_capacity_in(entries.len(), allocator); + let mut map_entries = OxcVec::with_capacity_in(entries.len(), &allocator); for (key, value) in entries.iter_mut() { map_entries.push(LiteralMapEntry::new( key.clone(), @@ -1505,7 +1505,7 @@ fn emit_pooled_constant_value<'a>( } OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries: map_entries, source_span: None }, - allocator, + &allocator, )) } PooledConstantKind::External(ext) => { @@ -1518,14 +1518,14 @@ fn emit_pooled_constant_value<'a>( }, source_span: None, }, - allocator, + &allocator, )) } PooledConstantKind::PureFunction(pf) => { // Pure functions are emitted as arrow functions with the actual body expression. // The body expression may contain PureFunctionParameterExpr nodes that need to be // transformed to variable references (a0, a1, etc.). - let mut params = OxcVec::with_capacity_in(pf.params.len(), allocator); + let mut params = OxcVec::with_capacity_in(pf.params.len(), &allocator); for param in pf.params.iter() { params.push(FnParam { name: param.clone() }); } @@ -1537,11 +1537,11 @@ fn emit_pooled_constant_value<'a>( crate::output::ast::ArrowFunctionExpr { params, body: crate::output::ast::ArrowFunctionBody::Expression(Box::new_in( - body_expr, allocator, + body_expr, &allocator, )), source_span: None, }, - allocator, + &allocator, )) } PooledConstantKind::RegularExpression(regex) => { @@ -1551,7 +1551,7 @@ fn emit_pooled_constant_value<'a>( flags: regex.flags.clone(), source_span: None, }, - allocator, + &allocator, )) } PooledConstantKind::Literal(literal_expr) => { @@ -1610,7 +1610,7 @@ pub fn compile_host_bindings<'a>( // Collect declarations from host binding pool constants. // In Angular TS, template and host binding share the same ConstantPool, // so host binding pure functions get emitted alongside template constants. - let mut declarations = OxcVec::new_in(allocator); + let mut declarations = OxcVec::new_in(&allocator); for constant in job.pool.constants_mut() { let value = emit_pooled_constant_value(allocator, &mut constant.kind); declarations.push(OutputStatement::DeclareVar(Box::new_in( @@ -1621,11 +1621,11 @@ pub fn compile_host_bindings<'a>( leading_comment: None, source_span: None, }, - allocator, + &allocator, ))); } for stmt in job.pool.statements.iter() { - declarations.push(clone_output_statement(stmt, allocator)); + declarations.push(clone_output_statement(stmt, &allocator)); } HostBindingCompilationResult { host_binding_fn, host_attrs, host_vars, declarations } diff --git a/crates/oxc_angular_compiler/src/pipeline/expression_store.rs b/crates/oxc_angular_compiler/src/pipeline/expression_store.rs index 1aabe931b..2f37869f4 100644 --- a/crates/oxc_angular_compiler/src/pipeline/expression_store.rs +++ b/crates/oxc_angular_compiler/src/pipeline/expression_store.rs @@ -40,7 +40,7 @@ pub struct ExpressionStore<'a> { impl<'a> ExpressionStore<'a> { /// Creates a new expression store. pub fn new(allocator: &'a Allocator) -> Self { - Self { expressions: Vec::new_in(allocator) } + Self { expressions: Vec::new_in(&allocator) } } /// Stores an expression and returns its ID. @@ -106,7 +106,7 @@ mod tests { // Store an expression let expr = AngularExpression::Empty(oxc_allocator::Box::new_in( EmptyExpr { span: ParseSpan::new(0, 0), source_span: AbsoluteSourceSpan::new(0, 0) }, - &allocator, + &&allocator, )); let id = store.store(expr); diff --git a/crates/oxc_angular_compiler/src/pipeline/ingest.rs b/crates/oxc_angular_compiler/src/pipeline/ingest.rs index 7a1cb19a4..22c9955af 100644 --- a/crates/oxc_angular_compiler/src/pipeline/ingest.rs +++ b/crates/oxc_angular_compiler/src/pipeline/ingest.rs @@ -158,7 +158,7 @@ fn store_and_ref_expr<'a>( expr: AngularExpression<'a>, ) -> Box<'a, IrExpression<'a>> { let id = job.store_expression(expr); - Box::new_in(IrExpression::ExpressionRef(id), job.allocator) + Box::new_in(IrExpression::ExpressionRef(id), &job.allocator) } /// Converts an Angular expression to an IR expression during ingestion. @@ -184,7 +184,7 @@ fn convert_ast_to_ir<'a>( let target = job.allocate_xref_id(); // Convert the pipe input and arguments to IR expressions - let mut args = Vec::with_capacity_in(1 + pipe.args.len(), allocator); + let mut args = Vec::with_capacity_in(1 + pipe.args.len(), &allocator); // First argument is the pipe input expression let input_expr = convert_ast_to_ir(job, pipe.exp); @@ -206,9 +206,9 @@ fn convert_ast_to_ir<'a>( var_offset: None, source_span: Some(pipe.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -230,9 +230,9 @@ fn convert_ast_to_ir<'a>( name: safe.name, source_span: Some(safe.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -248,9 +248,9 @@ fn convert_ast_to_ir<'a>( index, source_span: Some(safe.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -258,7 +258,7 @@ fn convert_ast_to_ir<'a>( AngularExpression::SafeCall(safe) => { let safe = safe.unbox(); let receiver = convert_ast_to_ir(job, safe.receiver); - let mut args = Vec::with_capacity_in(safe.args.len(), allocator); + let mut args = Vec::with_capacity_in(safe.args.len(), &allocator); for arg in safe.args { let arg_expr = convert_ast_to_ir(job, arg); args.push(arg_expr.unbox()); @@ -266,9 +266,9 @@ fn convert_ast_to_ir<'a>( Box::new_in( IrExpression::SafeInvokeFunction(Box::new_in( SafeInvokeFunctionExpr { receiver, args, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -276,8 +276,8 @@ fn convert_ast_to_ir<'a>( // Spread elements (e.g. [...base, item]) are preserved via the spreads parallel vec. AngularExpression::LiteralArray(arr) => { let arr = arr.unbox(); - let mut elements = Vec::with_capacity_in(arr.expressions.len(), allocator); - let mut spreads = Vec::with_capacity_in(arr.expressions.len(), allocator); + let mut elements = Vec::with_capacity_in(arr.expressions.len(), &allocator); + let mut spreads = Vec::with_capacity_in(arr.expressions.len(), &allocator); for elem in arr.expressions { let is_spread = matches!(elem, AngularExpression::SpreadElement(_)); let inner = if let AngularExpression::SpreadElement(s) = elem { @@ -295,9 +295,9 @@ fn convert_ast_to_ir<'a>( spreads, source_span: Some(arr.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -307,10 +307,10 @@ fn convert_ast_to_ir<'a>( AngularExpression::LiteralMap(map) => { use crate::ast::expression::LiteralMapKey; let map = map.unbox(); - let mut keys = Vec::with_capacity_in(map.keys.len(), allocator); - let mut values = Vec::with_capacity_in(map.values.len(), allocator); - let mut quoted = Vec::with_capacity_in(map.keys.len(), allocator); - let mut spreads = Vec::with_capacity_in(map.keys.len(), allocator); + let mut keys = Vec::with_capacity_in(map.keys.len(), &allocator); + let mut values = Vec::with_capacity_in(map.values.len(), &allocator); + let mut quoted = Vec::with_capacity_in(map.keys.len(), &allocator); + let mut spreads = Vec::with_capacity_in(map.keys.len(), &allocator); for (key, value) in map.keys.into_iter().zip(map.values.into_iter()) { match key { @@ -338,9 +338,9 @@ fn convert_ast_to_ir<'a>( spreads, source_span: Some(map.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -359,9 +359,9 @@ fn convert_ast_to_ir<'a>( rhs, source_span: Some(bin.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -373,9 +373,9 @@ fn convert_ast_to_ir<'a>( Box::new_in( IrExpression::Parenthesized(Box::new_in( crate::ir::expression::IrParenthesizedExpr { expr: inner, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -394,9 +394,9 @@ fn convert_ast_to_ir<'a>( false_expr: false_exp, source_span: Some(cond.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -417,9 +417,9 @@ fn convert_ast_to_ir<'a>( name: prop.name, source_span: Some(prop.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } else if matches!(prop.receiver, AngularExpression::ThisReceiver(_)) { // Explicit `this` property read (e.g., `this.formGroup`) becomes a @@ -435,17 +435,17 @@ fn convert_ast_to_ir<'a>( view: job.root.xref, source_span: Some(prop.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: prop.name, optional: false, source_span: Some(prop.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } else { // This is a nested property read like `(expr).name` @@ -459,9 +459,9 @@ fn convert_ast_to_ir<'a>( optional: false, source_span: Some(prop.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } } @@ -480,9 +480,9 @@ fn convert_ast_to_ir<'a>( optional: false, source_span: Some(keyed.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -491,7 +491,7 @@ fn convert_ast_to_ir<'a>( AngularExpression::Call(call) => { let call = call.unbox(); let receiver = convert_ast_to_ir(job, call.receiver); - let mut args = Vec::with_capacity_in(call.args.len(), allocator); + let mut args = Vec::with_capacity_in(call.args.len(), &allocator); for arg in call.args { let arg_expr = convert_ast_to_ir(job, arg); args.push(arg_expr.unbox()); @@ -504,9 +504,9 @@ fn convert_ast_to_ir<'a>( optional: false, source_span: Some(call.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -521,9 +521,9 @@ fn convert_ast_to_ir<'a>( expr, source_span: Some(not.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -547,9 +547,9 @@ fn convert_ast_to_ir<'a>( expr, source_span: Some(unary.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -563,9 +563,9 @@ fn convert_ast_to_ir<'a>( expr, source_span: Some(typeof_expr.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -579,9 +579,9 @@ fn convert_ast_to_ir<'a>( expr, source_span: Some(void_expr.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -593,9 +593,9 @@ fn convert_ast_to_ir<'a>( Box::new_in( IrExpression::Empty(Box::new_in( EmptyExpr { source_span: Some(empty.source_span.to_span()) }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -605,14 +605,14 @@ fn convert_ast_to_ir<'a>( // the pipe_creation phase and any @let variable reads inside are never resolved. AngularExpression::TemplateLiteral(tl) => { let tl = tl.unbox(); - let mut elements = Vec::with_capacity_in(tl.elements.len(), allocator); + let mut elements = Vec::with_capacity_in(tl.elements.len(), &allocator); for elem in tl.elements.iter() { elements.push(crate::ir::expression::IrTemplateLiteralElement { text: elem.text.clone(), source_span: Some(elem.source_span.to_span()), }); } - let mut expressions = Vec::with_capacity_in(tl.expressions.len(), allocator); + let mut expressions = Vec::with_capacity_in(tl.expressions.len(), &allocator); for expr in tl.expressions { let converted = convert_ast_to_ir(job, expr); expressions.push(converted.unbox()); @@ -624,9 +624,9 @@ fn convert_ast_to_ir<'a>( expressions, source_span: Some(tl.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -685,7 +685,7 @@ fn convert_interpolation_to_ir<'a>( expr: AngularExpression<'a>, ) -> Box<'a, IrExpression<'a>> { let allocator = job.allocator; - convert_interpolation_to_ir_with_i18n_placeholders(job, expr, Vec::new_in(allocator)) + convert_interpolation_to_ir_with_i18n_placeholders(job, expr, Vec::new_in(&allocator)) } /// Converts an Angular expression to IR, handling interpolations with i18n placeholders. @@ -707,7 +707,7 @@ fn convert_interpolation_to_ir_with_i18n_placeholders<'a>( // Unbox the interpolation to take ownership of its fields let interp = interp_box.unbox(); - let mut ir_expressions = Vec::new_in(allocator); + let mut ir_expressions = Vec::new_in(&allocator); for inner_expr in interp.expressions { // Convert each inner expression to IR (handles pipes, safe nav, etc.) let converted = convert_ast_to_ir(job, inner_expr); @@ -722,9 +722,9 @@ fn convert_interpolation_to_ir_with_i18n_placeholders<'a>( i18n_placeholders, source_span: Some(interp.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } else { // For non-interpolation expressions, convert to IR @@ -774,7 +774,7 @@ pub fn ingest_component_with_options<'a>( // This ensures that when compiling multiple components in the same file, // each component's constants have unique names. let mut job = ComponentCompilationJob::with_pool_starting_index( - allocator, + &allocator, component_name, options.pool_starting_index, ); @@ -927,7 +927,7 @@ fn ingest_bound_text<'a>( // Ported from Angular's ingestBoundText (ingest.ts lines 485-495) let i18n_placeholders: Vec<'_, Ident<'_>> = match &bound_text.i18n { Some(I18nMeta::Node(I18nNode::Container(container))) => { - let mut placeholders = Vec::new_in(allocator); + let mut placeholders = Vec::new_in(&allocator); for child in container.children.iter() { if let I18nNode::Placeholder(placeholder) = child { placeholders.push(placeholder.name.clone()); @@ -935,7 +935,7 @@ fn ingest_bound_text<'a>( } placeholders } - _ => Vec::new_in(allocator), + _ => Vec::new_in(&allocator), }; // Convert the interpolation expression to an IR interpolation. @@ -1222,7 +1222,7 @@ fn ingest_element<'a>( xref: i18n_attrs_xref, handle: I18nSlotHandle::Single(SlotId(0)), // Will be computed during slot allocation target: xref, - configs: Vec::new_in(allocator), + configs: Vec::new_in(&allocator), i18n_attributes_config: None, }); @@ -1242,7 +1242,7 @@ fn ingest_element<'a>( let instance_id = message.instance_id; // Store i18n message metadata keyed by instance_id - let mut legacy_ids = Vec::new_in(allocator); + let mut legacy_ids = Vec::new_in(&allocator); for id in message.legacy_ids.iter() { legacy_ids.push(id.clone()); } @@ -1373,16 +1373,16 @@ fn ingest_static_attributes_with_i18n<'a>( if name.as_str() == "ngNonBindable" || name.as_str().starts_with("animate.") { let literal_expr = OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(value), source_span: None }, - allocator, + &allocator, )); - let value_expr = IrExpression::OutputExpr(Box::new_in(literal_expr, allocator)); + let value_expr = IrExpression::OutputExpr(Box::new_in(literal_expr, &allocator)); let binding = BindingOp { base: UpdateOpBase::default(), target: element_xref, kind: BindingKind::Attribute, name, - expression: Box::new_in(value_expr, allocator), + expression: Box::new_in(value_expr, &allocator), unit: None, security_context: SecurityContext::None, i18n_message: None, @@ -1411,7 +1411,7 @@ fn ingest_static_attributes_with_i18n<'a>( // Store i18n message metadata for later phases (only if not already stored) if !job.i18n_message_metadata.contains_key(&instance_id) { - let mut legacy_ids = Vec::new_in(allocator); + let mut legacy_ids = Vec::new_in(&allocator); for id in message.legacy_ids.iter() { legacy_ids.push(id.clone()); } @@ -1451,9 +1451,9 @@ fn ingest_static_attributes_with_i18n<'a>( // All other static attributes go to the create list as ExtractedAttributeOp let literal_expr = OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(value), source_span: None }, - allocator, + &allocator, )); - let value_expr = IrExpression::OutputExpr(Box::new_in(literal_expr, allocator)); + let value_expr = IrExpression::OutputExpr(Box::new_in(literal_expr, &allocator)); // Use Template kind for structural template attributes, Attribute otherwise let binding_kind = if is_structural_template_attribute { @@ -1473,7 +1473,7 @@ fn ingest_static_attributes_with_i18n<'a>( binding_kind, namespace, name: local_name, - value: Some(Box::new_in(value_expr, allocator)), + value: Some(Box::new_in(value_expr, &allocator)), security_context: SecurityContext::None, truthy_expression: false, i18n_context: None, @@ -1516,9 +1516,9 @@ fn ingest_single_static_attribute<'a>( let literal_expr = OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(value), source_span: None }, - allocator, + &allocator, )); - let value_expr = IrExpression::OutputExpr(Box::new_in(literal_expr, allocator)); + let value_expr = IrExpression::OutputExpr(Box::new_in(literal_expr, &allocator)); if is_structural_template_attribute { // For structural template attributes, create a BindingOp that goes to the update list. @@ -1530,7 +1530,7 @@ fn ingest_single_static_attribute<'a>( target: element_xref, kind: BindingKind::Template, name, - expression: Box::new_in(value_expr, allocator), + expression: Box::new_in(value_expr, &allocator), unit: None, security_context: SecurityContext::None, i18n_message: None, @@ -1553,7 +1553,7 @@ fn ingest_single_static_attribute<'a>( binding_kind: BindingKind::Attribute, namespace, name: local_name, - value: Some(Box::new_in(value_expr, allocator)), + value: Some(Box::new_in(value_expr, &allocator)), security_context: SecurityContext::None, truthy_expression: false, i18n_context: None, @@ -1644,7 +1644,7 @@ fn ingest_binding_owned<'a>( // Store i18n message metadata for later phases (keyed by instance_id) if !job.i18n_message_metadata.contains_key(&instance_id) { - let mut legacy_ids = Vec::new_in(allocator); + let mut legacy_ids = Vec::new_in(&allocator); for id in message.legacy_ids.iter() { legacy_ids.push(id.clone()); } @@ -1742,9 +1742,9 @@ fn ingest_listener_owned<'a>( Box::new_in( IrExpression::Empty(Box::new_in( crate::ir::expression::EmptyExpr { source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ) } } else { @@ -1757,29 +1757,29 @@ fn ingest_listener_owned<'a>( Box::new_in( IrExpression::Empty(Box::new_in( crate::ir::expression::EmptyExpr { source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ) } }; - let mut handler_ops = Vec::new_in(allocator); + let mut handler_ops = Vec::new_in(&allocator); // Create $event reference let event_ref = IrExpression::LexicalRead(Box::new_in( LexicalReadExpr { name: Ident::from("$event"), source_span: None }, - allocator, + &allocator, )); // Create TwoWayBindingSetExpr(handlerExpr, $event) let two_way_set_expr = IrExpression::TwoWayBindingSet(Box::new_in( TwoWayBindingSetExpr { target: handler_expr, - value: Box::new_in(event_ref.clone_in(allocator), allocator), + value: Box::new_in(event_ref.clone_in(allocator), &allocator), source_span: Some(output.source_span), }, - allocator, + &allocator, )); // Wrap in output expression statement: ExpressionStatement(TwoWayBindingSetExpr) @@ -1787,14 +1787,14 @@ fn ingest_listener_owned<'a>( crate::output::ast::ExpressionStatement { expr: OutputExpression::WrappedIrNode(Box::new_in( crate::output::ast::WrappedIrExpr { - node: Box::new_in(two_way_set_expr, allocator), + node: Box::new_in(two_way_set_expr, &allocator), source_span: Some(output.source_span), }, - allocator, + &allocator, )), source_span: Some(output.source_span), }, - allocator, + &allocator, )); handler_ops.push(UpdateOp::Statement(StatementOp { base: UpdateOpBase::default(), @@ -1806,14 +1806,14 @@ fn ingest_listener_owned<'a>( crate::output::ast::ReturnStatement { value: OutputExpression::WrappedIrNode(Box::new_in( crate::output::ast::WrappedIrExpr { - node: Box::new_in(event_ref, allocator), + node: Box::new_in(event_ref, &allocator), source_span: None, }, - allocator, + &allocator, )), source_span: None, }, - allocator, + &allocator, )); handler_ops.push(UpdateOp::Statement(StatementOp { base: UpdateOpBase::default(), @@ -1834,7 +1834,7 @@ fn ingest_listener_owned<'a>( // Ported from Angular's makeListenerHandlerOps in ingest.ts: // - All expressions except the last become ExpressionStatement ops in handler_ops // - The last expression becomes the handler_expression (wrapped in return) - let mut handler_ops = Vec::new_in(allocator); + let mut handler_ops = Vec::new_in(&allocator); let mut handler_expr: Option>> = None; let exprs_count = handler_exprs.len(); @@ -1853,11 +1853,11 @@ fn ingest_listener_owned<'a>( node: ir_expr, source_span: Some(output.source_span), }, - allocator, + &allocator, )), source_span: Some(output.source_span), }, - allocator, + &allocator, )); handler_ops.push(UpdateOp::Statement(StatementOp { base: UpdateOpBase::default(), @@ -1953,7 +1953,7 @@ fn ingest_template<'a>( if let Some(I18nMeta::Message(ref message)) = template.i18n { let instance_id = message.instance_id; // Clone legacy_ids using the allocator - let mut legacy_ids = Vec::new_in(allocator); + let mut legacy_ids = Vec::new_in(&allocator); for id in message.legacy_ids.iter() { legacy_ids.push(id.clone()); } @@ -2243,7 +2243,7 @@ fn ingest_template<'a>( xref: i18n_attrs_xref, handle: I18nSlotHandle::Single(SlotId(0)), // Will be computed during slot allocation target: xref, - configs: Vec::new_in(allocator), + configs: Vec::new_in(&allocator), i18n_attributes_config: None, }); @@ -2400,7 +2400,7 @@ fn ingest_content<'a>( target: xref, kind: BindingKind::Attribute, name: attr.name, - expression: Box::new_in(value_expr, allocator), + expression: Box::new_in(value_expr, &allocator), unit: None, security_context: SecurityContext::None, i18n_message: None, @@ -2432,7 +2432,7 @@ fn ingest_if_block<'a>( let allocator = job.allocator; let mut first_xref: Option = None; - let mut conditions: Vec<'a, ConditionalCaseExpr<'a>> = Vec::new_in(allocator); + let mut conditions: Vec<'a, ConditionalCaseExpr<'a>> = Vec::new_in(&allocator); let mut create_ops: std::vec::Vec> = std::vec::Vec::new(); for (i, branch) in if_block.branches.into_iter().enumerate() { @@ -2491,7 +2491,7 @@ fn ingest_if_block<'a>( tag: tag.clone(), decls: None, vars: None, - local_refs: Vec::new_in(allocator), + local_refs: Vec::new_in(&allocator), local_refs_index: None, // Set by local_refs phase i18n_placeholder, attributes: None, @@ -2509,7 +2509,7 @@ fn ingest_if_block<'a>( tag: tag.clone(), decls: None, vars: None, - local_refs: Vec::new_in(allocator), + local_refs: Vec::new_in(&allocator), local_refs_index: None, // Set by local_refs phase i18n_placeholder, attributes: None, @@ -2602,8 +2602,8 @@ fn ingest_for_block<'a>( }; // Collect context variables and aliases for the body view - let mut context_variables: Vec<'a, ContextVariable<'a>> = Vec::new_in(allocator); - let mut aliases: Vec<'a, AliasVariable<'a>> = Vec::new_in(allocator); + let mut context_variables: Vec<'a, ContextVariable<'a>> = Vec::new_in(&allocator); + let mut aliases: Vec<'a, AliasVariable<'a>> = Vec::new_in(&allocator); // Add the item variable (maps to $implicit in the context) context_variables.push(ContextVariable { @@ -2617,7 +2617,7 @@ fn ingest_for_block<'a>( let mut var_names = RepeaterVarNames { item: Some(for_block.item.name.clone()), count: None, - index: oxc_allocator::Vec::new_in(allocator), + index: oxc_allocator::Vec::new_in(&allocator), first: None, last: None, even: None, @@ -2678,7 +2678,7 @@ fn ingest_for_block<'a>( // Angular throws for unknown variables; we return early to avoid // emitting broken IR. let expression = match get_computed_for_loop_variable_expression( - allocator, + &allocator, var.value.as_str(), &index_name, &count_name, @@ -2821,20 +2821,20 @@ fn get_computed_for_loop_variable_expression<'a>( // Return LexicalRead of the index variable Ok(IrExpression::LexicalRead(Box::new_in( LexicalReadExpr { name: index_name.clone(), source_span: None }, - allocator, + &allocator, ))) } "$count" => { // Return LexicalRead of the count variable Ok(IrExpression::LexicalRead(Box::new_in( LexicalReadExpr { name: count_name.clone(), source_span: None }, - allocator, + &allocator, ))) } "$first" => { // $index === 0 Ok(create_binary_identical( - allocator, + &allocator, create_lexical_read(allocator, index_name), create_number_literal(allocator, 0.0), )) @@ -2842,10 +2842,10 @@ fn get_computed_for_loop_variable_expression<'a>( "$last" => { // $index === $count - 1 Ok(create_binary_identical( - allocator, + &allocator, create_lexical_read(allocator, index_name), create_binary_minus( - allocator, + &allocator, create_lexical_read(allocator, count_name), create_number_literal(allocator, 1.0), ), @@ -2854,9 +2854,9 @@ fn get_computed_for_loop_variable_expression<'a>( "$even" => { // $index % 2 === 0 Ok(create_binary_identical( - allocator, + &allocator, create_binary_modulo( - allocator, + &allocator, create_lexical_read(allocator, index_name), create_number_literal(allocator, 2.0), ), @@ -2866,9 +2866,9 @@ fn get_computed_for_loop_variable_expression<'a>( "$odd" => { // $index % 2 !== 0 Ok(create_binary_not_identical( - allocator, + &allocator, create_binary_modulo( - allocator, + &allocator, create_lexical_read(allocator, index_name), create_number_literal(allocator, 2.0), ), @@ -2892,7 +2892,7 @@ fn get_computed_for_loop_variable_expression<'a>( fn create_lexical_read<'a>(allocator: &'a Allocator, name: &Ident<'a>) -> IrExpression<'a> { IrExpression::LexicalRead(Box::new_in( LexicalReadExpr { name: name.clone(), source_span: None }, - allocator, + &allocator, )) } @@ -2907,9 +2907,9 @@ fn create_number_literal<'a>(allocator: &'a Allocator, value: f64) -> IrExpressi span: ParseSpan::new(0, 0), source_span: AbsoluteSourceSpan::new(0, 0), }, - allocator, + &allocator, )), - allocator, + &allocator, )) } @@ -2924,9 +2924,9 @@ fn create_string_literal_atom<'a>(allocator: &'a Allocator, value: Ident<'a>) -> span: ParseSpan::new(0, 0), source_span: AbsoluteSourceSpan::new(0, 0), }, - allocator, + &allocator, )), - allocator, + &allocator, )) } @@ -2939,11 +2939,11 @@ fn create_binary_identical<'a>( IrExpression::Binary(Box::new_in( BinaryExpr { operator: IrBinaryOperator::Identical, - lhs: Box::new_in(lhs, allocator), - rhs: Box::new_in(rhs, allocator), + lhs: Box::new_in(lhs, &allocator), + rhs: Box::new_in(rhs, &allocator), source_span: None, }, - allocator, + &allocator, )) } @@ -2956,11 +2956,11 @@ fn create_binary_not_identical<'a>( IrExpression::Binary(Box::new_in( BinaryExpr { operator: IrBinaryOperator::NotIdentical, - lhs: Box::new_in(lhs, allocator), - rhs: Box::new_in(rhs, allocator), + lhs: Box::new_in(lhs, &allocator), + rhs: Box::new_in(rhs, &allocator), source_span: None, }, - allocator, + &allocator, )) } @@ -2973,11 +2973,11 @@ fn create_binary_minus<'a>( IrExpression::Binary(Box::new_in( BinaryExpr { operator: IrBinaryOperator::Minus, - lhs: Box::new_in(lhs, allocator), - rhs: Box::new_in(rhs, allocator), + lhs: Box::new_in(lhs, &allocator), + rhs: Box::new_in(rhs, &allocator), source_span: None, }, - allocator, + &allocator, )) } @@ -2990,11 +2990,11 @@ fn create_binary_modulo<'a>( IrExpression::Binary(Box::new_in( BinaryExpr { operator: IrBinaryOperator::Modulo, - lhs: Box::new_in(lhs, allocator), - rhs: Box::new_in(rhs, allocator), + lhs: Box::new_in(lhs, &allocator), + rhs: Box::new_in(rhs, &allocator), source_span: None, }, - allocator, + &allocator, )) } @@ -3029,7 +3029,7 @@ fn ingest_switch_block<'a>( // The downstream generate_conditional_expressions phase handles @default at // any position by splicing it out as the ternary fallback base. let mut first_xref: Option = None; - let mut conditions: Vec<'a, ConditionalCaseExpr<'a>> = Vec::new_in(allocator); + let mut conditions: Vec<'a, ConditionalCaseExpr<'a>> = Vec::new_in(&allocator); let mut create_ops: std::vec::Vec> = std::vec::Vec::new(); for (i, group) in switch_block.groups.into_iter().enumerate() { @@ -3075,7 +3075,7 @@ fn ingest_switch_block<'a>( tag: tag.clone(), decls: None, vars: None, - local_refs: Vec::new_in(allocator), + local_refs: Vec::new_in(&allocator), local_refs_index: None, // Set by local_refs phase i18n_placeholder, attributes: None, @@ -3093,7 +3093,7 @@ fn ingest_switch_block<'a>( tag: tag.clone(), decls: None, vars: None, - local_refs: Vec::new_in(allocator), + local_refs: Vec::new_in(&allocator), local_refs_index: None, // Set by local_refs phase i18n_placeholder, attributes: None, @@ -3220,7 +3220,7 @@ fn ingest_defer_view<'a>( decl_count: None, vars: None, attributes: None, - local_refs: Vec::new_in(job.allocator), + local_refs: Vec::new_in(&job.allocator), local_refs_index: None, i18n_placeholder, }); @@ -3646,7 +3646,7 @@ fn ingest_references_owned<'a>( allocator: &'a Allocator, references: Vec<'a, crate::ast::r3::R3Reference<'a>>, ) -> Vec<'a, LocalRef<'a>> { - let mut local_refs = Vec::new_in(allocator); + let mut local_refs = Vec::new_in(&allocator); for reference in references { local_refs.push(LocalRef { name: reference.name, target: reference.value }); @@ -3683,7 +3683,7 @@ fn host_store_and_ref_expr<'a>( expr: AngularExpression<'a>, ) -> Box<'a, IrExpression<'a>> { let id = job.store_expression(expr); - Box::new_in(IrExpression::ExpressionRef(id), job.allocator) + Box::new_in(IrExpression::ExpressionRef(id), &job.allocator) } /// Converts an Angular expression to an IR expression for host bindings. @@ -3703,7 +3703,7 @@ fn host_convert_ast_to_ir<'a>( let pipe = pipe.unbox(); let target = job.allocate_xref_id(); - let mut args = Vec::with_capacity_in(1 + pipe.args.len(), allocator); + let mut args = Vec::with_capacity_in(1 + pipe.args.len(), &allocator); // First argument is the pipe input expression let input_expr = host_convert_ast_to_ir(job, pipe.exp); @@ -3725,9 +3725,9 @@ fn host_convert_ast_to_ir<'a>( var_offset: None, source_span: Some(pipe.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -3748,9 +3748,9 @@ fn host_convert_ast_to_ir<'a>( name: safe.name, source_span: Some(safe.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -3766,9 +3766,9 @@ fn host_convert_ast_to_ir<'a>( index, source_span: Some(safe.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -3776,7 +3776,7 @@ fn host_convert_ast_to_ir<'a>( AngularExpression::SafeCall(safe) => { let safe = safe.unbox(); let receiver = host_convert_ast_to_ir(job, safe.receiver); - let mut args = Vec::with_capacity_in(safe.args.len(), allocator); + let mut args = Vec::with_capacity_in(safe.args.len(), &allocator); for arg in safe.args { let arg_expr = host_convert_ast_to_ir(job, arg); args.push(arg_expr.unbox()); @@ -3784,9 +3784,9 @@ fn host_convert_ast_to_ir<'a>( Box::new_in( IrExpression::SafeInvokeFunction(Box::new_in( SafeInvokeFunctionExpr { receiver, args, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -3804,9 +3804,9 @@ fn host_convert_ast_to_ir<'a>( rhs, source_span: Some(bin.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -3831,9 +3831,9 @@ fn host_convert_ast_to_ir<'a>( false_expr: false_exp, source_span: Some(cond.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -3848,9 +3848,9 @@ fn host_convert_ast_to_ir<'a>( name: prop.name, source_span: Some(prop.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } else { let receiver = host_convert_ast_to_ir(job, prop.receiver); @@ -3862,9 +3862,9 @@ fn host_convert_ast_to_ir<'a>( optional: false, source_span: Some(prop.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } } @@ -3882,9 +3882,9 @@ fn host_convert_ast_to_ir<'a>( optional: false, source_span: Some(keyed.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -3892,7 +3892,7 @@ fn host_convert_ast_to_ir<'a>( AngularExpression::Call(call) => { let call = call.unbox(); let receiver = host_convert_ast_to_ir(job, call.receiver); - let mut args = Vec::with_capacity_in(call.args.len(), allocator); + let mut args = Vec::with_capacity_in(call.args.len(), &allocator); for arg in call.args { let arg_expr = host_convert_ast_to_ir(job, arg); args.push(arg_expr.unbox()); @@ -3905,9 +3905,9 @@ fn host_convert_ast_to_ir<'a>( optional: false, source_span: Some(call.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -3921,9 +3921,9 @@ fn host_convert_ast_to_ir<'a>( expr, source_span: Some(not.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -3946,9 +3946,9 @@ fn host_convert_ast_to_ir<'a>( expr, source_span: Some(unary.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -3962,9 +3962,9 @@ fn host_convert_ast_to_ir<'a>( expr, source_span: Some(typeof_expr.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -3978,9 +3978,9 @@ fn host_convert_ast_to_ir<'a>( expr, source_span: Some(void_expr.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -3999,7 +3999,7 @@ fn host_convert_interpolation_to_ir<'a>( if let AngularExpression::Interpolation(interp_box) = expr { let interp = interp_box.unbox(); - let mut ir_expressions = Vec::new_in(allocator); + let mut ir_expressions = Vec::new_in(&allocator); for inner_expr in interp.expressions { let converted = host_convert_ast_to_ir(job, inner_expr); ir_expressions.push(converted.unbox()); @@ -4010,12 +4010,12 @@ fn host_convert_interpolation_to_ir<'a>( crate::ir::expression::Interpolation { strings: interp.strings, expressions: ir_expressions, - i18n_placeholders: Vec::new_in(allocator), + i18n_placeholders: Vec::new_in(&allocator), source_span: Some(interp.source_span.to_span()), }, - allocator, + &allocator, )), - allocator, + &allocator, ) } else { host_convert_ast_to_ir(job, expr) @@ -4049,7 +4049,7 @@ pub fn ingest_host_binding_with_version<'a>( legacy_optional_chaining: Option, ) -> HostBindingCompilationJob<'a> { let mut job = HostBindingCompilationJob::with_pool_starting_index( - allocator, + &allocator, input.component_name, input.component_selector, pool_starting_index, @@ -4207,7 +4207,7 @@ fn ingest_host_attribute<'a>( // Wrap the OutputExpression in IrExpression::OutputExpr // This matches TypeScript which passes o.Expression directly to the IR let expression = - Box::new_in(IrExpression::OutputExpr(Box::new_in(value, allocator)), allocator); + Box::new_in(IrExpression::OutputExpr(Box::new_in(value, &allocator)), &allocator); // Create a BindingOp and add it to the UPDATE list, just like Angular's ingestHostAttribute. // The binding is marked as is_text_attribute: true, which means it will be extracted to @@ -4263,7 +4263,7 @@ fn ingest_host_event<'a>(job: &mut HostBindingCompilationJob<'a>, event: R3Bound // Ported from Angular's makeListenerHandlerOps in ingest.ts: // - All expressions except the last become ExpressionStatement ops in handler_ops // - The last expression becomes the handler_expression (wrapped in return) - let mut handler_ops = Vec::new_in(allocator); + let mut handler_ops = Vec::new_in(&allocator); let mut handler_expr: Option>> = None; let exprs_count = handler_exprs.len(); @@ -4283,11 +4283,11 @@ fn ingest_host_event<'a>(job: &mut HostBindingCompilationJob<'a>, event: R3Bound node: ir_expr, source_span: Some(event.source_span), }, - allocator, + &allocator, )), source_span: Some(event.source_span), }, - allocator, + &allocator, )); handler_ops.push(UpdateOp::Statement(StatementOp { base: UpdateOpBase::default(), @@ -4461,7 +4461,7 @@ fn ingest_control_flow_insertion_point<'a, 'b>( // Store i18n message metadata for later phases (only if not already stored) if !job.i18n_message_metadata.contains_key(&instance_id) { - let mut legacy_ids = Vec::new_in(allocator); + let mut legacy_ids = Vec::new_in(&allocator); for id in message.legacy_ids.iter() { legacy_ids.push(id.clone()); } @@ -4503,7 +4503,7 @@ fn ingest_control_flow_insertion_point<'a, 'b>( target: xref, kind: BindingKind::Attribute, name: attr.name.clone(), - expression: Box::new_in(value_expr, allocator), + expression: Box::new_in(value_expr, &allocator), unit: None, security_context, i18n_message, @@ -4611,12 +4611,12 @@ mod tests { // Control flow blocks should only have BlockPlaceholder metadata. let unexpected_i18n = I18nMeta::Message(I18nMessage { instance_id: 0, - nodes: Vec::new_in(&allocator), + nodes: Vec::new_in(&&allocator), meaning: Ident::from(""), description: Ident::from(""), custom_id: Ident::from(""), id: Ident::from(""), - legacy_ids: Vec::new_in(&allocator), + legacy_ids: Vec::new_in(&&allocator), message_string: Ident::from(""), }); diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/any_cast.rs b/crates/oxc_angular_compiler/src/pipeline/phases/any_cast.rs index 9a2113255..5e3125c4a 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/any_cast.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/any_cast.rs @@ -32,7 +32,7 @@ pub fn delete_any_casts(job: &mut ComponentCompilationJob<'_>) { transform_expressions_in_create_op( op, &|expr, _flags| { - remove_any_cast(expr, allocator); + remove_any_cast(expr, &allocator); }, VisitorContextFlag::NONE, ); @@ -43,7 +43,7 @@ pub fn delete_any_casts(job: &mut ComponentCompilationJob<'_>) { transform_expressions_in_update_op( op, &|expr, _flags| { - remove_any_cast(expr, allocator); + remove_any_cast(expr, &allocator); }, VisitorContextFlag::NONE, ); @@ -100,7 +100,7 @@ pub fn delete_any_casts_for_host(job: &mut HostBindingCompilationJob<'_>) { transform_expressions_in_create_op( op, &|expr, _flags| { - remove_any_cast(expr, allocator); + remove_any_cast(expr, &allocator); }, VisitorContextFlag::NONE, ); @@ -111,7 +111,7 @@ pub fn delete_any_casts_for_host(job: &mut HostBindingCompilationJob<'_>) { transform_expressions_in_update_op( op, &|expr, _flags| { - remove_any_cast(expr, allocator); + remove_any_cast(expr, &allocator); }, VisitorContextFlag::NONE, ); diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/attribute_extraction.rs b/crates/oxc_angular_compiler/src/pipeline/phases/attribute_extraction.rs index d07ea8468..898eeccfe 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/attribute_extraction.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/attribute_extraction.rs @@ -27,12 +27,12 @@ pub fn extract_attributes(job: &mut ComponentCompilationJob<'_>) { let allocator = job.allocator; // Process root view - process_view_attributes(job, job.root.xref, allocator); + process_view_attributes(job, job.root.xref, &allocator); // Process embedded views let view_xrefs: Vec = job.views.keys().copied().collect(); for view_xref in view_xrefs { - process_view_attributes(job, view_xref, allocator); + process_view_attributes(job, view_xref, &allocator); } } @@ -448,10 +448,10 @@ fn extract_value_from_binding_expr<'a>( let literal_expr = OutputExpression::Literal(Box::new_in( LiteralExpr { value: output_value, source_span: None }, - allocator, + &allocator, )); - let value_expr = IrExpression::OutputExpr(Box::new_in(literal_expr, allocator)); - Some(Box::new_in(value_expr, allocator)) + let value_expr = IrExpression::OutputExpr(Box::new_in(literal_expr, &allocator)); + Some(Box::new_in(value_expr, &allocator)) } else { None } @@ -460,8 +460,8 @@ fn extract_value_from_binding_expr<'a>( // Already in the right format - clone it and wrap in IrExpression // This is needed for host attributes from decorators which are already OutputExpr literals let cloned = output_expr.clone_in(allocator); - let value_expr = IrExpression::OutputExpr(Box::new_in(cloned, allocator)); - Some(Box::new_in(value_expr, allocator)) + let value_expr = IrExpression::OutputExpr(Box::new_in(cloned, &allocator)); + Some(Box::new_in(value_expr, &allocator)) } IrExpression::Empty(_) => { // Empty expression means no value diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/binding_specialization.rs b/crates/oxc_angular_compiler/src/pipeline/phases/binding_specialization.rs index f63972e4a..d2dbad0b4 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/binding_specialization.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/binding_specialization.rs @@ -117,13 +117,13 @@ pub fn specialize_bindings(job: &mut ComponentCompilationJob<'_>) { // Process root view let root_non_bindable = - specialize_in_view(&mut job.root.update, allocator, &elements, mode, extended_controls); + specialize_in_view(&mut job.root.update, &allocator, &elements, mode, extended_controls); all_non_bindable.extend(root_non_bindable); // Process embedded views for view in job.views.values_mut() { let view_non_bindable = - specialize_in_view(&mut view.update, allocator, &elements, mode, extended_controls); + specialize_in_view(&mut view.update, &allocator, &elements, mode, extended_controls); all_non_bindable.extend(view_non_bindable); } @@ -179,9 +179,9 @@ fn create_placeholder_expression<'a>( ) -> Box<'a, IrExpression<'a>> { let empty_expr = AngularExpression::Empty(Box::new_in( EmptyExpr { span: ParseSpan::new(0, 0), source_span: AbsoluteSourceSpan::new(0, 0) }, - allocator, + &allocator, )); - Box::new_in(IrExpression::Ast(Box::new_in(empty_expr, allocator)), allocator) + Box::new_in(IrExpression::Ast(Box::new_in(empty_expr, &allocator)), &allocator) } /// Specializes bindings within a single view. diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/chaining.rs b/crates/oxc_angular_compiler/src/pipeline/phases/chaining.rs index cd4b8f09b..c179fb96f 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/chaining.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/chaining.rs @@ -440,7 +440,7 @@ fn clone_args<'a>( args: &oxc_allocator::Vec<'a, OutputExpression<'a>>, diagnostics: &mut Vec, ) -> oxc_allocator::Vec<'a, OutputExpression<'a>> { - let mut cloned = oxc_allocator::Vec::new_in(allocator); + let mut cloned = oxc_allocator::Vec::new_in(&allocator); for arg in args.iter() { cloned.push(clone_expression(allocator, arg, diagnostics)); } @@ -472,20 +472,20 @@ fn clone_expression<'a>( match expr { OutputExpression::Literal(lit) => OutputExpression::Literal(Box::new_in( LiteralExpr { value: clone_literal_value(&lit.value), source_span: lit.source_span }, - allocator, + &allocator, )), OutputExpression::LiteralArray(arr) => { - let mut entries = oxc_allocator::Vec::new_in(allocator); + let mut entries = oxc_allocator::Vec::new_in(&allocator); for entry in arr.entries.iter() { entries.push(clone_expression(allocator, entry, diagnostics)); } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: arr.source_span }, - allocator, + &allocator, )) } OutputExpression::LiteralMap(map) => { - let mut entries = oxc_allocator::Vec::new_in(allocator); + let mut entries = oxc_allocator::Vec::new_in(&allocator); for entry in map.entries.iter() { entries.push(LiteralMapEntry { key: entry.key.clone(), @@ -496,7 +496,7 @@ fn clone_expression<'a>( } OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: map.source_span }, - allocator, + &allocator, )) } OutputExpression::RegularExpressionLiteral(regex) => { @@ -506,11 +506,11 @@ fn clone_expression<'a>( flags: regex.flags.clone(), source_span: regex.source_span, }, - allocator, + &allocator, )) } OutputExpression::TemplateLiteral(tpl) => { - let mut elements = oxc_allocator::Vec::new_in(allocator); + let mut elements = oxc_allocator::Vec::new_in(&allocator); for el in tpl.elements.iter() { elements.push(TemplateLiteralElement { text: el.text.clone(), @@ -518,18 +518,18 @@ fn clone_expression<'a>( source_span: el.source_span, }); } - let mut expressions = oxc_allocator::Vec::new_in(allocator); + let mut expressions = oxc_allocator::Vec::new_in(&allocator); for expr in tpl.expressions.iter() { expressions.push(clone_expression(allocator, expr, diagnostics)); } OutputExpression::TemplateLiteral(Box::new_in( TemplateLiteralExpr { elements, expressions, source_span: tpl.source_span }, - allocator, + &allocator, )) } OutputExpression::TaggedTemplateLiteral(tagged) => { let cloned_tag = clone_expression(allocator, &tagged.tag, diagnostics); - let mut elements = oxc_allocator::Vec::new_in(allocator); + let mut elements = oxc_allocator::Vec::new_in(&allocator); for el in tagged.template.elements.iter() { elements.push(TemplateLiteralElement { text: el.text.clone(), @@ -537,146 +537,155 @@ fn clone_expression<'a>( source_span: el.source_span, }); } - let mut expressions = oxc_allocator::Vec::new_in(allocator); + let mut expressions = oxc_allocator::Vec::new_in(&allocator); for expr in tagged.template.expressions.iter() { expressions.push(clone_expression(allocator, expr, diagnostics)); } OutputExpression::TaggedTemplateLiteral(Box::new_in( TaggedTemplateLiteralExpr { - tag: Box::new_in(cloned_tag, allocator), + tag: Box::new_in(cloned_tag, &allocator), template: Box::new_in( TemplateLiteralExpr { elements, expressions, source_span: tagged.template.source_span, }, - allocator, + &allocator, ), source_span: tagged.source_span, }, - allocator, + &allocator, )) } OutputExpression::ReadVar(var) => OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: var.name.clone(), source_span: var.source_span }, - allocator, + &allocator, )), OutputExpression::ReadProp(prop) => OutputExpression::ReadProp(Box::new_in( ReadPropExpr { receiver: Box::new_in( clone_expression(allocator, &prop.receiver, diagnostics), - allocator, + &allocator, ), name: prop.name.clone(), optional: prop.optional, source_span: prop.source_span, }, - allocator, + &allocator, )), OutputExpression::ReadKey(key) => OutputExpression::ReadKey(Box::new_in( ReadKeyExpr { receiver: Box::new_in( clone_expression(allocator, &key.receiver, diagnostics), - allocator, + &allocator, + ), + index: Box::new_in( + clone_expression(allocator, &key.index, diagnostics), + &allocator, ), - index: Box::new_in(clone_expression(allocator, &key.index, diagnostics), allocator), optional: key.optional, source_span: key.source_span, }, - allocator, + &allocator, )), OutputExpression::BinaryOperator(binop) => OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: binop.operator, - lhs: Box::new_in(clone_expression(allocator, &binop.lhs, diagnostics), allocator), - rhs: Box::new_in(clone_expression(allocator, &binop.rhs, diagnostics), allocator), + lhs: Box::new_in(clone_expression(allocator, &binop.lhs, diagnostics), &allocator), + rhs: Box::new_in(clone_expression(allocator, &binop.rhs, diagnostics), &allocator), source_span: binop.source_span, }, - allocator, + &allocator, )), OutputExpression::UnaryOperator(unary) => OutputExpression::UnaryOperator(Box::new_in( UnaryOperatorExpr { operator: unary.operator, - expr: Box::new_in(clone_expression(allocator, &unary.expr, diagnostics), allocator), + expr: Box::new_in( + clone_expression(allocator, &unary.expr, diagnostics), + &allocator, + ), parens: unary.parens, source_span: unary.source_span, }, - allocator, + &allocator, )), OutputExpression::Conditional(cond) => { let false_case = cond .false_case .as_ref() - .map(|fc| Box::new_in(clone_expression(allocator, fc, diagnostics), allocator)); + .map(|fc| Box::new_in(clone_expression(allocator, fc, diagnostics), &allocator)); OutputExpression::Conditional(Box::new_in( ConditionalExpr { condition: Box::new_in( clone_expression(allocator, &cond.condition, diagnostics), - allocator, + &allocator, ), true_case: Box::new_in( clone_expression(allocator, &cond.true_case, diagnostics), - allocator, + &allocator, ), false_case, source_span: cond.source_span, }, - allocator, + &allocator, )) } OutputExpression::Not(not) => OutputExpression::Not(Box::new_in( NotExpr { condition: Box::new_in( clone_expression(allocator, ¬.condition, diagnostics), - allocator, + &allocator, ), source_span: not.source_span, }, - allocator, + &allocator, )), OutputExpression::Typeof(typeof_expr) => OutputExpression::Typeof(Box::new_in( TypeofExpr { expr: Box::new_in( clone_expression(allocator, &typeof_expr.expr, diagnostics), - allocator, + &allocator, ), source_span: typeof_expr.source_span, }, - allocator, + &allocator, )), OutputExpression::Void(void_expr) => OutputExpression::Void(Box::new_in( VoidExpr { expr: Box::new_in( clone_expression(allocator, &void_expr.expr, diagnostics), - allocator, + &allocator, ), source_span: void_expr.source_span, }, - allocator, + &allocator, )), OutputExpression::Parenthesized(paren) => OutputExpression::Parenthesized(Box::new_in( ParenthesizedExpr { - expr: Box::new_in(clone_expression(allocator, &paren.expr, diagnostics), allocator), + expr: Box::new_in( + clone_expression(allocator, &paren.expr, diagnostics), + &allocator, + ), source_span: paren.source_span, }, - allocator, + &allocator, )), OutputExpression::Comma(comma) => { - let mut parts = oxc_allocator::Vec::new_in(allocator); + let mut parts = oxc_allocator::Vec::new_in(&allocator); for part in comma.parts.iter() { parts.push(clone_expression(allocator, part, diagnostics)); } OutputExpression::Comma(Box::new_in( CommaExpr { parts, source_span: comma.source_span }, - allocator, + &allocator, )) } OutputExpression::Function(func) => { - let mut params = oxc_allocator::Vec::new_in(allocator); + let mut params = oxc_allocator::Vec::new_in(&allocator); for param in func.params.iter() { params.push(FnParam { name: param.name.clone() }); } - let mut statements = oxc_allocator::Vec::new_in(allocator); + let mut statements = oxc_allocator::Vec::new_in(&allocator); for stmt in func.statements.iter() { statements.push(clone_statement(allocator, stmt, diagnostics)); } @@ -687,21 +696,21 @@ fn clone_expression<'a>( statements, source_span: func.source_span, }, - allocator, + &allocator, )) } OutputExpression::ArrowFunction(arrow) => { - let mut params = oxc_allocator::Vec::new_in(allocator); + let mut params = oxc_allocator::Vec::new_in(&allocator); for param in arrow.params.iter() { params.push(FnParam { name: param.name.clone() }); } let body = match &arrow.body { ArrowFunctionBody::Expression(expr) => ArrowFunctionBody::Expression(Box::new_in( clone_expression(allocator, expr, diagnostics), - allocator, + &allocator, )), ArrowFunctionBody::Statements(stmts) => { - let mut statements = oxc_allocator::Vec::new_in(allocator); + let mut statements = oxc_allocator::Vec::new_in(&allocator); for stmt in stmts.iter() { statements.push(clone_statement(allocator, stmt, diagnostics)); } @@ -710,39 +719,39 @@ fn clone_expression<'a>( }; OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { params, body, source_span: arrow.source_span }, - allocator, + &allocator, )) } OutputExpression::InvokeFunction(invoke) => OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { fn_expr: Box::new_in( clone_expression(allocator, &invoke.fn_expr, diagnostics), - allocator, + &allocator, ), args: clone_args(allocator, &invoke.args, diagnostics), pure: invoke.pure, optional: invoke.optional, source_span: invoke.source_span, }, - allocator, + &allocator, )), OutputExpression::Instantiate(inst) => OutputExpression::Instantiate(Box::new_in( InstantiateExpr { class_expr: Box::new_in( clone_expression(allocator, &inst.class_expr, diagnostics), - allocator, + &allocator, ), args: clone_args(allocator, &inst.args, diagnostics), source_span: inst.source_span, }, - allocator, + &allocator, )), OutputExpression::DynamicImport(import) => { let url = match &import.url { DynamicImportUrl::String(s) => DynamicImportUrl::String(s.clone()), DynamicImportUrl::Expression(expr) => DynamicImportUrl::Expression(Box::new_in( clone_expression(allocator, expr, diagnostics), - allocator, + &allocator, )), }; OutputExpression::DynamicImport(Box::new_in( @@ -751,7 +760,7 @@ fn clone_expression<'a>( url_comment: import.url_comment.clone(), source_span: import.source_span, }, - allocator, + &allocator, )) } OutputExpression::External(ext) => OutputExpression::External(Box::new_in( @@ -762,18 +771,18 @@ fn clone_expression<'a>( }, source_span: ext.source_span, }, - allocator, + &allocator, )), OutputExpression::LocalizedString(loc) => { - let mut message_parts = oxc_allocator::Vec::new_in(allocator); + let mut message_parts = oxc_allocator::Vec::new_in(&allocator); for part in loc.message_parts.iter() { message_parts.push(part.clone()); } - let mut placeholder_names = oxc_allocator::Vec::new_in(allocator); + let mut placeholder_names = oxc_allocator::Vec::new_in(&allocator); for name in loc.placeholder_names.iter() { placeholder_names.push(name.clone()); } - let mut expressions = oxc_allocator::Vec::new_in(allocator); + let mut expressions = oxc_allocator::Vec::new_in(&allocator); for expr in loc.expressions.iter() { expressions.push(clone_expression(allocator, expr, diagnostics)); } @@ -787,12 +796,12 @@ fn clone_expression<'a>( expressions, source_span: loc.source_span, }, - allocator, + &allocator, )) } OutputExpression::WrappedNode(wrapped) => OutputExpression::WrappedNode(Box::new_in( WrappedNodeExpr { node_id: wrapped.node_id.clone(), source_span: wrapped.source_span }, - allocator, + &allocator, )), OutputExpression::WrappedIrNode(_) => { // WrappedIrNode expressions wrap IR expressions for deferred processing. @@ -804,22 +813,22 @@ fn clone_expression<'a>( // Return a placeholder undefined literal OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Undefined, source_span: None }, - allocator, + &allocator, )) } OutputExpression::SpreadElement(spread) => OutputExpression::SpreadElement(Box::new_in( SpreadElementExpr { expr: Box::new_in( clone_expression(allocator, &spread.expr, diagnostics), - allocator, + &allocator, ), source_span: spread.source_span, }, - allocator, + &allocator, )), OutputExpression::RawSource(raw) => OutputExpression::RawSource(Box::new_in( RawSourceExpr { source: raw.source.clone(), source_span: raw.source_span }, - allocator, + &allocator, )), } } @@ -843,15 +852,15 @@ fn clone_statement<'a>( leading_comment: decl.leading_comment.clone(), source_span: decl.source_span, }, - allocator, + &allocator, )) } OutputStatement::DeclareFunction(func) => { - let mut params = oxc_allocator::Vec::new_in(allocator); + let mut params = oxc_allocator::Vec::new_in(&allocator); for param in func.params.iter() { params.push(FnParam { name: param.name.clone() }); } - let mut statements = oxc_allocator::Vec::new_in(allocator); + let mut statements = oxc_allocator::Vec::new_in(&allocator); for s in func.statements.iter() { statements.push(clone_statement(allocator, s, diagnostics)); } @@ -863,7 +872,7 @@ fn clone_statement<'a>( modifiers: func.modifiers, source_span: func.source_span, }, - allocator, + &allocator, )) } OutputStatement::Expression(expr_stmt) => OutputStatement::Expression(Box::new_in( @@ -871,21 +880,21 @@ fn clone_statement<'a>( expr: clone_expression(allocator, &expr_stmt.expr, diagnostics), source_span: expr_stmt.source_span, }, - allocator, + &allocator, )), OutputStatement::Return(ret) => OutputStatement::Return(Box::new_in( ReturnStatement { value: clone_expression(allocator, &ret.value, diagnostics), source_span: ret.source_span, }, - allocator, + &allocator, )), OutputStatement::If(if_stmt) => { - let mut true_case = oxc_allocator::Vec::new_in(allocator); + let mut true_case = oxc_allocator::Vec::new_in(&allocator); for s in if_stmt.true_case.iter() { true_case.push(clone_statement(allocator, s, diagnostics)); } - let mut false_case = oxc_allocator::Vec::new_in(allocator); + let mut false_case = oxc_allocator::Vec::new_in(&allocator); for s in if_stmt.false_case.iter() { false_case.push(clone_statement(allocator, s, diagnostics)); } @@ -896,7 +905,7 @@ fn clone_statement<'a>( false_case, source_span: if_stmt.source_span, }, - allocator, + &allocator, )) } } @@ -926,20 +935,20 @@ fn chain_into_statement<'a>( value: crate::output::ast::LiteralValue::Null, source_span: None, }, - allocator, + &allocator, )), ); // Create the chained call: current_expr(additional_args) let chained = OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(current_expr, allocator), + fn_expr: Box::new_in(current_expr, &allocator), args: additional_args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )); expr_stmt.expr = chained; diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/collapse_singleton_interpolations.rs b/crates/oxc_angular_compiler/src/pipeline/phases/collapse_singleton_interpolations.rs index da809bec7..7bdb56887 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/collapse_singleton_interpolations.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/collapse_singleton_interpolations.rs @@ -33,11 +33,11 @@ pub fn collapse_singleton_interpolations(job: &mut ComponentCompilationJob<'_>) let allocator = job.allocator; // Process root view - collapse_in_view(&mut job.root.update, allocator); + collapse_in_view(&mut job.root.update, &allocator); // Process embedded views for view in job.views.values_mut() { - collapse_in_view(&mut view.update, allocator); + collapse_in_view(&mut view.update, &allocator); } } @@ -62,10 +62,10 @@ fn try_collapse_interpolation<'a>( && interp.strings.iter().all(|s| s.as_str().is_empty()) { // Clone the inner expression and replace - let cloned_inner = clone_angular_expression(&interp.expressions[0], allocator); + let cloned_inner = clone_angular_expression(&interp.expressions[0], &allocator); *expr = Box::new_in( - IrExpression::Ast(Box::new_in(cloned_inner, allocator)), - allocator, + IrExpression::Ast(Box::new_in(cloned_inner, &allocator)), + &allocator, ); } } @@ -78,7 +78,7 @@ fn try_collapse_interpolation<'a>( { // Clone the inner IR expression and replace let cloned_inner = interp.expressions[0].clone_in(allocator); - *expr = Box::new_in(cloned_inner, allocator); + *expr = Box::new_in(cloned_inner, &allocator); } } _ => {} @@ -95,16 +95,16 @@ fn collapse_in_view<'a>( while cursor.move_next() { match cursor.current_mut() { Some(UpdateOp::Attribute(attr)) => { - try_collapse_interpolation(&mut attr.expression, allocator); + try_collapse_interpolation(&mut attr.expression, &allocator); } Some(UpdateOp::StyleProp(style)) => { - try_collapse_interpolation(&mut style.expression, allocator); + try_collapse_interpolation(&mut style.expression, &allocator); } Some(UpdateOp::StyleMap(style)) => { - try_collapse_interpolation(&mut style.expression, allocator); + try_collapse_interpolation(&mut style.expression, &allocator); } Some(UpdateOp::ClassMap(class)) => { - try_collapse_interpolation(&mut class.expression, allocator); + try_collapse_interpolation(&mut class.expression, &allocator); } _ => {} } @@ -115,5 +115,5 @@ fn collapse_in_view<'a>( /// /// Host version - only processes the root unit (no embedded views). pub fn collapse_singleton_interpolations_for_host(job: &mut HostBindingCompilationJob<'_>) { - collapse_in_view(&mut job.root.update, job.allocator); + collapse_in_view(&mut job.root.update, &job.allocator); } diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/conditionals.rs b/crates/oxc_angular_compiler/src/pipeline/phases/conditionals.rs index 635ff7b88..f62e79d9b 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/conditionals.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/conditionals.rs @@ -99,7 +99,7 @@ pub fn generate_conditional_expressions(job: &mut ComponentCompilationJob<'_>) { // Build the conditional expression let (processed, context_value) = build_conditional_expression( - allocator, + &allocator, &mut cond.conditions, cond.test.as_ref(), temp_xref, @@ -178,36 +178,36 @@ fn build_conditional_expression<'a>( Box::new_in( IrExpression::AssignTemporary(Box::new_in( AssignTemporaryExpr { - expr: Box::new_in(switch_test.clone_in(allocator), allocator), + expr: Box::new_in(switch_test.clone_in(allocator), &allocator), xref, name: None, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ) } else { - Box::new_in(switch_test.clone_in(allocator), allocator) + Box::new_in(switch_test.clone_in(allocator), &allocator) } } else if let Some(xref) = temp_xref { // Read from temporary Box::new_in( IrExpression::ReadTemporary(Box::new_in( ReadTemporaryExpr { xref, name: None, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ) } else { - Box::new_in(switch_test.clone_in(allocator), allocator) + Box::new_in(switch_test.clone_in(allocator), &allocator) }; // Build: test === case_value build_equality_check( - allocator, + &allocator, use_tmp, - Box::new_in(cond_expr.clone_in(allocator), allocator), + Box::new_in(cond_expr.clone_in(allocator), &allocator), ) } else { // @if case: handle alias capture @@ -217,14 +217,14 @@ fn build_conditional_expression<'a>( let assign_expr = Box::new_in( IrExpression::AssignTemporary(Box::new_in( AssignTemporaryExpr { - expr: Box::new_in(cond_expr.clone_in(allocator), allocator), + expr: Box::new_in(cond_expr.clone_in(allocator), &allocator), xref, name: None, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ); // Set context value to read from the temporary @@ -232,20 +232,20 @@ fn build_conditional_expression<'a>( context_value = Some(Box::new_in( IrExpression::ReadTemporary(Box::new_in( ReadTemporaryExpr { xref, name: None, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, )); } // Update the condition's expression to the assignment *cond_expr = assign_expr; - Box::new_in(cond_expr.clone_in(allocator), allocator) + Box::new_in(cond_expr.clone_in(allocator), &allocator) } else { - Box::new_in(cond_expr.clone_in(allocator), allocator) + Box::new_in(cond_expr.clone_in(allocator), &allocator) } } else { - Box::new_in(cond_expr.clone_in(allocator), allocator) + Box::new_in(cond_expr.clone_in(allocator), &allocator) } } } else { @@ -273,9 +273,9 @@ fn create_slot_literal_from_handle<'a>( target_xref: Some(target_xref), source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -290,11 +290,11 @@ fn create_literal_number<'a>( IrExpression::Ast(Box::new_in( AngularExpression::LiteralPrimitive(Box::new_in( LiteralPrimitive { span, source_span, value: AstLiteralValue::Number(value) }, - allocator, + &allocator, )), - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -316,9 +316,9 @@ fn build_equality_check<'a>( rhs: case_value, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ) } @@ -340,8 +340,8 @@ fn build_ternary<'a>( false_expr: false_case, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ) } diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/const_collection.rs b/crates/oxc_angular_compiler/src/pipeline/phases/const_collection.rs index 72d2919b6..bacd8b7b5 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/const_collection.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/const_collection.rs @@ -314,7 +314,7 @@ fn serialize_attributes<'a>( allocator: &'a oxc_allocator::Allocator, attrs: &ElementAttributes<'a>, ) -> ConstValue<'a> { - let mut elements = OxcVec::new_in(allocator); + let mut elements = OxcVec::new_in(&allocator); // Add static attributes for (namespace, name, value) in &attrs.attributes { @@ -339,7 +339,7 @@ fn serialize_attributes<'a>( name: var_name.clone(), source_span: None, }, - allocator, + &allocator, )); elements.push(ConstValue::Expression(read_var)); } @@ -362,7 +362,7 @@ fn serialize_attributes<'a>( let selector_elements = r3_selector_to_output_expr(allocator, first_selector); let selector_array = OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: selector_elements, source_span: None }, - allocator, + &allocator, )); elements.push(ConstValue::Expression(selector_array)); } @@ -422,7 +422,7 @@ fn serialize_attributes_to_array_expr<'a>( allocator: &'a oxc_allocator::Allocator, attrs: &ElementAttributes<'a>, ) -> OutputExpression<'a> { - let mut entries = OxcVec::new_in(allocator); + let mut entries = OxcVec::new_in(&allocator); // Add static attributes for (namespace, name, value) in &attrs.attributes { @@ -433,23 +433,23 @@ fn serialize_attributes_to_array_expr<'a>( value: LiteralValue::Number(AttributeMarker::NamespaceUri as i32 as f64), source_span: None, }, - allocator, + &allocator, ))); entries.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(ns.clone()), source_span: None }, - allocator, + &allocator, ))); } entries.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); if let Some(val) = value { match val { AttributeValue::String(s) => { entries.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(s.clone()), source_span: None }, - allocator, + &allocator, ))); } AttributeValue::I18nVar(var_name) => { @@ -459,7 +459,7 @@ fn serialize_attributes_to_array_expr<'a>( name: var_name.clone(), source_span: None, }, - allocator, + &allocator, ))); } } @@ -480,14 +480,14 @@ fn serialize_attributes_to_array_expr<'a>( value: LiteralValue::Number(AttributeMarker::ProjectAs as i32 as f64), source_span: None, }, - allocator, + &allocator, ))); // Add the parsed selector as an array let selector_elements = r3_selector_to_output_expr(allocator, first_selector); entries.push(OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: selector_elements, source_span: None }, - allocator, + &allocator, ))); } } @@ -499,12 +499,12 @@ fn serialize_attributes_to_array_expr<'a>( value: LiteralValue::Number(AttributeMarker::Classes as i32 as f64), source_span: None, }, - allocator, + &allocator, ))); for class in &attrs.classes { entries.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(class.clone()), source_span: None }, - allocator, + &allocator, ))); } } @@ -516,17 +516,17 @@ fn serialize_attributes_to_array_expr<'a>( value: LiteralValue::Number(AttributeMarker::Styles as i32 as f64), source_span: None, }, - allocator, + &allocator, ))); for (name, value) in &attrs.styles { entries.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); if let Some(val) = value { entries.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(val.clone()), source_span: None }, - allocator, + &allocator, ))); } } @@ -539,12 +539,12 @@ fn serialize_attributes_to_array_expr<'a>( value: LiteralValue::Number(AttributeMarker::Bindings as i32 as f64), source_span: None, }, - allocator, + &allocator, ))); for name in &attrs.bindings { entries.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); } } @@ -556,12 +556,12 @@ fn serialize_attributes_to_array_expr<'a>( value: LiteralValue::Number(AttributeMarker::Template as i32 as f64), source_span: None, }, - allocator, + &allocator, ))); for name in &attrs.template { entries.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); } } @@ -573,19 +573,19 @@ fn serialize_attributes_to_array_expr<'a>( value: LiteralValue::Number(AttributeMarker::I18n as i32 as f64), source_span: None, }, - allocator, + &allocator, ))); for name in &attrs.i18n { entries.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); } } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: None }, - allocator, + &allocator, )) } @@ -817,7 +817,7 @@ pub fn collect_element_consts(job: &mut ComponentCompilationJob<'_>) { name: pooled_name.clone(), source_span: None, }, - allocator, + &allocator, ))); } } diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/convert_animations.rs b/crates/oxc_angular_compiler/src/pipeline/phases/convert_animations.rs index e5177cc51..e9ce7c51d 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/convert_animations.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/convert_animations.rs @@ -136,17 +136,17 @@ pub fn convert_animations(job: &mut ComponentCompilationJob<'_>) { AnimationBindingKind::Value => { // Create handler_ops with a return statement containing the expression // This matches Angular's createAnimationOp which wraps expression in ReturnStatement - let mut handler_ops = OxcVec::new_in(allocator); + let mut handler_ops = OxcVec::new_in(&allocator); // Create a WrappedIrNode to hold the IR expression let wrapped_expr = OutputExpression::WrappedIrNode(Box::new_in( WrappedIrExpr { node: expression, source_span }, - allocator, + &allocator, )); let return_stmt = OutputStatement::Return(Box::new_in( ReturnStatement { value: wrapped_expr, source_span: None }, - allocator, + &allocator, )); handler_ops.push(UpdateOp::Statement(StatementOp { @@ -262,9 +262,9 @@ fn create_placeholder_expression<'a>( ) -> Box<'a, IrExpression<'a>> { let empty_expr = AngularExpression::Empty(Box::new_in( EmptyExpr { span: ParseSpan::new(0, 0), source_span: AbsoluteSourceSpan::new(0, 0) }, - allocator, + &allocator, )); - Box::new_in(IrExpression::Ast(Box::new_in(empty_expr, allocator)), allocator) + Box::new_in(IrExpression::Ast(Box::new_in(empty_expr, &allocator)), &allocator) } /// Converts animation bindings for host binding compilation. diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/convert_i18n_bindings.rs b/crates/oxc_angular_compiler/src/pipeline/phases/convert_i18n_bindings.rs index cbc720b38..1093dea1e 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/convert_i18n_bindings.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/convert_i18n_bindings.rs @@ -183,7 +183,10 @@ fn process_update_ops_for_view( target: conversion.target, context: conversion.i18n_context, handle: i18n_attrs.handle, - expression: oxc_allocator::Box::new_in(expr.clone_in(allocator), allocator), + expression: oxc_allocator::Box::new_in( + expr.clone_in(allocator), + &allocator, + ), resolution_time: I18nParamResolutionTime::Creation, usage: I18nExpressionFor::I18nAttribute, name: conversion.name.clone(), diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/create_i18n_contexts.rs b/crates/oxc_angular_compiler/src/pipeline/phases/create_i18n_contexts.rs index ff8f45f9a..64235eaf1 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/create_i18n_contexts.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/create_i18n_contexts.rs @@ -115,9 +115,9 @@ pub fn create_i18n_contexts(job: &mut ComponentCompilationJob<'_>) { xref: context_xref, context_kind: I18nContextKind::Attr, i18n_block: None, // Attribute contexts don't have an i18n block - params: oxc_allocator::HashMap::new_in(allocator), - postprocessing_params: oxc_allocator::HashMap::new_in(allocator), - icu_placeholder_literals: oxc_allocator::HashMap::new_in(allocator), + params: oxc_allocator::HashMap::new_in(&allocator), + postprocessing_params: oxc_allocator::HashMap::new_in(&allocator), + icu_placeholder_literals: oxc_allocator::HashMap::new_in(&allocator), message: Some(info.message_instance_id), }); @@ -217,9 +217,9 @@ pub fn create_i18n_contexts(job: &mut ComponentCompilationJob<'_>) { xref: context_xref, context_kind: I18nContextKind::RootI18n, i18n_block: Some(i18n_xref), - params: oxc_allocator::HashMap::new_in(allocator), - postprocessing_params: oxc_allocator::HashMap::new_in(allocator), - icu_placeholder_literals: oxc_allocator::HashMap::new_in(allocator), + params: oxc_allocator::HashMap::new_in(&allocator), + postprocessing_params: oxc_allocator::HashMap::new_in(&allocator), + icu_placeholder_literals: oxc_allocator::HashMap::new_in(&allocator), message, }); @@ -381,9 +381,9 @@ fn create_icu_contexts_for_view( xref: context_xref, context_kind: I18nContextKind::Icu, i18n_block: Some(root_xref), - params: oxc_allocator::HashMap::new_in(allocator), - postprocessing_params: oxc_allocator::HashMap::new_in(allocator), - icu_placeholder_literals: oxc_allocator::HashMap::new_in(allocator), + params: oxc_allocator::HashMap::new_in(&allocator), + postprocessing_params: oxc_allocator::HashMap::new_in(&allocator), + icu_placeholder_literals: oxc_allocator::HashMap::new_in(&allocator), message: icu_message, }); diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/defer_configs.rs b/crates/oxc_angular_compiler/src/pipeline/phases/defer_configs.rs index 46a8d0153..454d59b4d 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/defer_configs.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/defer_configs.rs @@ -86,8 +86,8 @@ pub fn configure_defer_instructions(job: &mut ComponentCompilationJob<'_>) { // Angular uses `literalOrArrayLiteral([op.loadingMinimumTime, op.loadingAfterTime])` // which emits `null` for missing values, not `0`. if config.loading_minimum_time.is_some() || config.loading_after_time.is_some() { - let mut elements = OxcVec::with_capacity_in(2, allocator); - let mut spreads = oxc_allocator::Vec::with_capacity_in(2, allocator); + let mut elements = OxcVec::with_capacity_in(2, &allocator); + let mut spreads = oxc_allocator::Vec::with_capacity_in(2, &allocator); // minimumTime: number or null let min_val = match config.loading_minimum_time { @@ -97,9 +97,9 @@ pub fn configure_defer_instructions(job: &mut ComponentCompilationJob<'_>) { elements.push(IrExpression::Ast(Box::new_in( crate::ast::expression::AngularExpression::LiteralPrimitive(Box::new_in( LiteralPrimitive { span, source_span, value: min_val }, - allocator, + &allocator, )), - allocator, + &allocator, ))); spreads.push(false); @@ -111,33 +111,33 @@ pub fn configure_defer_instructions(job: &mut ComponentCompilationJob<'_>) { elements.push(IrExpression::Ast(Box::new_in( crate::ast::expression::AngularExpression::LiteralPrimitive(Box::new_in( LiteralPrimitive { span, source_span, value: after_val }, - allocator, + &allocator, )), - allocator, + &allocator, ))); spreads.push(false); let array_expr = IrExpression::LiteralArray(Box::new_in( IrLiteralArrayExpr { elements, spreads, source_span: None }, - allocator, + &allocator, )); loading_config_expr = Some(Box::new_in( IrExpression::ConstCollected(Box::new_in( ConstCollectedExpr { - expr: Box::new_in(array_expr, allocator), + expr: Box::new_in(array_expr, &allocator), source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, )); } // Create placeholder config: [minimumTime] if let Some(min_time) = config.placeholder_minimum_time { - let mut elements = OxcVec::with_capacity_in(1, allocator); - let mut spreads = oxc_allocator::Vec::with_capacity_in(1, allocator); + let mut elements = OxcVec::with_capacity_in(1, &allocator); + let mut spreads = oxc_allocator::Vec::with_capacity_in(1, &allocator); elements.push(IrExpression::Ast(Box::new_in( crate::ast::expression::AngularExpression::LiteralPrimitive(Box::new_in( LiteralPrimitive { @@ -145,26 +145,26 @@ pub fn configure_defer_instructions(job: &mut ComponentCompilationJob<'_>) { source_span, value: LiteralValue::Number(min_time as f64), }, - allocator, + &allocator, )), - allocator, + &allocator, ))); spreads.push(false); let array_expr = IrExpression::LiteralArray(Box::new_in( IrLiteralArrayExpr { elements, spreads, source_span: None }, - allocator, + &allocator, )); placeholder_config_expr = Some(Box::new_in( IrExpression::ConstCollected(Box::new_in( ConstCollectedExpr { - expr: Box::new_in(array_expr, allocator), + expr: Box::new_in(array_expr, &allocator), source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, )); } diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/empty_elements.rs b/crates/oxc_angular_compiler/src/pipeline/phases/empty_elements.rs index 63b8bbb8e..a24178af7 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/empty_elements.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/empty_elements.rs @@ -126,7 +126,7 @@ pub fn collapse_empty_instructions(job: &mut ComponentCompilationJob<'_>) { attribute_namespace: start.attribute_namespace.clone(), local_refs: std::mem::replace( &mut start.local_refs, - oxc_allocator::Vec::new_in(allocator), + oxc_allocator::Vec::new_in(&allocator), ), local_refs_index: start.local_refs_index, non_bindable: start.non_bindable, @@ -148,7 +148,7 @@ pub fn collapse_empty_instructions(job: &mut ComponentCompilationJob<'_>) { local_refs_index: start.local_refs_index, local_refs: std::mem::replace( &mut start.local_refs, - oxc_allocator::Vec::new_in(allocator), + oxc_allocator::Vec::new_in(&allocator), ), non_bindable: start.non_bindable, i18n_placeholder: start.i18n_placeholder.clone(), diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/expand_safe_reads.rs b/crates/oxc_angular_compiler/src/pipeline/phases/expand_safe_reads.rs index 881d660da..839320cc3 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/expand_safe_reads.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/expand_safe_reads.rs @@ -204,12 +204,12 @@ fn safe_transform_modern<'a>(expr: &mut IrExpression<'a>, ctx: &SafeTransformCon let source_span = p.source_span; *expr = IrExpression::ResolvedPropertyRead(ArenaBox::new_in( ResolvedPropertyReadExpr { - receiver: ArenaBox::new_in(receiver, allocator), + receiver: ArenaBox::new_in(receiver, &allocator), name, optional: true, source_span, }, - allocator, + &allocator, )); } IrExpression::SafeKeyedRead(k) => { @@ -218,26 +218,26 @@ fn safe_transform_modern<'a>(expr: &mut IrExpression<'a>, ctx: &SafeTransformCon let source_span = k.source_span; *expr = IrExpression::ResolvedKeyedRead(ArenaBox::new_in( ResolvedKeyedReadExpr { - receiver: ArenaBox::new_in(receiver, allocator), - key: ArenaBox::new_in(key, allocator), + receiver: ArenaBox::new_in(receiver, &allocator), + key: ArenaBox::new_in(key, &allocator), optional: true, source_span, }, - allocator, + &allocator, )); } IrExpression::SafeInvokeFunction(c) => { let receiver = std::mem::replace(c.receiver.as_mut(), make_placeholder(allocator)); - let args = std::mem::replace(&mut c.args, ArenaVec::new_in(allocator)); + let args = std::mem::replace(&mut c.args, ArenaVec::new_in(&allocator)); let source_span = c.source_span; *expr = IrExpression::ResolvedCall(ArenaBox::new_in( ResolvedCallExpr { - receiver: ArenaBox::new_in(receiver, allocator), + receiver: ArenaBox::new_in(receiver, &allocator), args, optional: true, source_span, }, - allocator, + &allocator, )); } _ => {} @@ -369,12 +369,12 @@ where // Create: (tmp = guard, body(tmp)) let assign_temp = IrExpression::AssignTemporary(ArenaBox::new_in( AssignTemporaryExpr { - expr: ArenaBox::new_in(guard, allocator), + expr: ArenaBox::new_in(guard, &allocator), xref, name: None, // Name is resolved in a later phase source_span: None, }, - allocator, + &allocator, )); let read_temp = IrExpression::ReadTemporary(ArenaBox::new_in( @@ -383,12 +383,12 @@ where name: None, // Name is resolved in a later phase source_span: None, }, - allocator, + &allocator, )); SafeTernaryExpr { - guard: ArenaBox::new_in(assign_temp, allocator), - expr: ArenaBox::new_in(body(read_temp), allocator), + guard: ArenaBox::new_in(assign_temp, &allocator), + expr: ArenaBox::new_in(body(read_temp), &allocator), source_span: None, } } else { @@ -396,8 +396,8 @@ where let guard_clone = guard.clone_in(allocator); SafeTernaryExpr { - guard: ArenaBox::new_in(guard, allocator), - expr: ArenaBox::new_in(body(guard_clone), allocator), + guard: ArenaBox::new_in(guard, &allocator), + expr: ArenaBox::new_in(body(guard_clone), &allocator), source_span: None, } } @@ -452,7 +452,7 @@ fn has_safe_ternary_receiver(e: &IrExpression<'_>) -> bool { fn make_placeholder<'a>(allocator: &'a Allocator) -> IrExpression<'a> { IrExpression::Empty(ArenaBox::new_in( crate::ir::expression::EmptyExpr { source_span: None }, - allocator, + &allocator, )) } @@ -477,7 +477,7 @@ fn extract_access_info<'a>( } IrExpression::SafeInvokeFunction(c) => { let receiver = std::mem::replace(c.receiver.as_mut(), make_placeholder(allocator)); - let mut args = ArenaVec::with_capacity_in(c.args.len(), allocator); + let mut args = ArenaVec::with_capacity_in(c.args.len(), &allocator); for arg in c.args.iter() { args.push(arg.clone_in(allocator)); } @@ -498,7 +498,7 @@ fn extract_access_info<'a>( } IrExpression::ResolvedCall(c) => { let receiver = std::mem::replace(c.receiver.as_mut(), make_placeholder(allocator)); - let mut args = ArenaVec::with_capacity_in(c.args.len(), allocator); + let mut args = ArenaVec::with_capacity_in(c.args.len(), &allocator); for arg in c.args.iter() { args.push(arg.clone_in(allocator)); } @@ -518,35 +518,35 @@ fn create_access_expr<'a>( AccessInfo::PropertyRead { name, source_span } => { IrExpression::ResolvedPropertyRead(ArenaBox::new_in( ResolvedPropertyReadExpr { - receiver: ArenaBox::new_in(receiver, allocator), + receiver: ArenaBox::new_in(receiver, &allocator), name, // Legacy expansion produces a plain read inside the `== null ? null` // ternary, not native optional chaining. optional: false, source_span, }, - allocator, + &allocator, )) } AccessInfo::KeyedRead { key, source_span } => { IrExpression::ResolvedKeyedRead(ArenaBox::new_in( ResolvedKeyedReadExpr { - receiver: ArenaBox::new_in(receiver, allocator), - key: ArenaBox::new_in(key, allocator), + receiver: ArenaBox::new_in(receiver, &allocator), + key: ArenaBox::new_in(key, &allocator), optional: false, source_span, }, - allocator, + &allocator, )) } AccessInfo::Call { args, source_span } => IrExpression::ResolvedCall(ArenaBox::new_in( ResolvedCallExpr { - receiver: ArenaBox::new_in(receiver, allocator), + receiver: ArenaBox::new_in(receiver, &allocator), args, optional: false, source_span, }, - allocator, + &allocator, )), } } @@ -603,7 +603,7 @@ fn modify_deepest_safe_ternary<'a>( let old_expr = std::mem::replace(deepest.expr.as_mut(), make_placeholder(allocator)); // Replace with the new expression - deepest.expr = ArenaBox::new_in(new_expr, allocator); + deepest.expr = ArenaBox::new_in(new_expr, &allocator); old_expr } @@ -639,7 +639,7 @@ fn safe_transform<'a>(expr: &mut IrExpression<'a>, ctx: &SafeTransformContext<'a } // Extract access info from the expression - let Some((info, mut receiver, is_safe)) = extract_access_info(expr, allocator) else { + let Some((info, mut receiver, is_safe)) = extract_access_info(expr, &allocator) else { return; }; @@ -649,24 +649,24 @@ fn safe_transform<'a>(expr: &mut IrExpression<'a>, ctx: &SafeTransformContext<'a // We use a placeholder to get the old expr out let placeholder = IrExpression::Empty(ArenaBox::new_in( crate::ir::expression::EmptyExpr { source_span: None }, - allocator, + &allocator, )); - let dst_expr = modify_deepest_safe_ternary(&mut receiver, placeholder, allocator); + let dst_expr = modify_deepest_safe_ternary(&mut receiver, placeholder, &allocator); if is_safe { // Safe access: wrap in a new SafeTernary let st = safe_ternary_with_temporary( dst_expr, - |r| create_access_expr(r, info, allocator), + |r| create_access_expr(r, info, &allocator), ctx, ); - let new_inner = IrExpression::SafeTernary(ArenaBox::new_in(st, allocator)); + let new_inner = IrExpression::SafeTernary(ArenaBox::new_in(st, &allocator)); // Put the new SafeTernary back into the deepest slot - modify_deepest_safe_ternary(&mut receiver, new_inner, allocator); + modify_deepest_safe_ternary(&mut receiver, new_inner, &allocator); } else { // Unsafe access: just add the access to dst.expr - let new_access = create_access_expr(dst_expr, info, allocator); - modify_deepest_safe_ternary(&mut receiver, new_access, allocator); + let new_access = create_access_expr(dst_expr, info, &allocator); + modify_deepest_safe_ternary(&mut receiver, new_access, &allocator); } // Return the receiver (the outer SafeTernary) @@ -675,8 +675,8 @@ fn safe_transform<'a>(expr: &mut IrExpression<'a>, ctx: &SafeTransformContext<'a // No SafeTernary in receiver, and this is a safe access - create new SafeTernary // (We know is_safe is true here because of the early return above) let st = - safe_ternary_with_temporary(receiver, |r| create_access_expr(r, info, allocator), ctx); - *expr = IrExpression::SafeTernary(ArenaBox::new_in(st, allocator)); + safe_ternary_with_temporary(receiver, |r| create_access_expr(r, info, &allocator), ctx); + *expr = IrExpression::SafeTernary(ArenaBox::new_in(st, &allocator)); } } diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/extract_i18n_messages.rs b/crates/oxc_angular_compiler/src/pipeline/phases/extract_i18n_messages.rs index 0a98c4b66..e7046034b 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/extract_i18n_messages.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/extract_i18n_messages.rs @@ -134,7 +134,7 @@ pub fn extract_i18n_messages(job: &mut ComponentCompilationJob<'_>) { description: metadata.and_then(|m| m.description.clone()), message_string: metadata.and_then(|m| m.message_string.clone()), needs_postprocessing, - sub_messages: oxc_allocator::Vec::new_in(allocator), + sub_messages: oxc_allocator::Vec::new_in(&allocator), }); } } diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/generate_arrow_functions.rs b/crates/oxc_angular_compiler/src/pipeline/phases/generate_arrow_functions.rs index 1138581fd..0744db68d 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/generate_arrow_functions.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/generate_arrow_functions.rs @@ -40,7 +40,7 @@ pub fn generate_arrow_functions(job: &mut ComponentCompilationJob<'_>) { transform_expressions_in_create_op( op, &|expr, flags| { - add_arrow_function(expr, allocator, flags); + add_arrow_function(expr, &allocator, flags); }, VisitorContextFlag::NONE, ); @@ -52,7 +52,7 @@ pub fn generate_arrow_functions(job: &mut ComponentCompilationJob<'_>) { transform_expressions_in_update_op( op, &|expr, flags| { - add_arrow_function(expr, allocator, flags); + add_arrow_function(expr, &allocator, flags); }, VisitorContextFlag::NONE, ); @@ -97,8 +97,8 @@ fn add_arrow_function<'a>( if let crate::output::ast::OutputExpression::ArrowFunction(arrow_fn) = output_expr.as_ref() { // Convert output arrow function to IR arrow function - if let Some(ir_arrow_fn) = convert_output_arrow_to_ir(arrow_fn.as_ref(), allocator) { - *expr = IrExpression::ArrowFunction(AllocBox::new_in(ir_arrow_fn, allocator)); + if let Some(ir_arrow_fn) = convert_output_arrow_to_ir(arrow_fn.as_ref(), &allocator) { + *expr = IrExpression::ArrowFunction(AllocBox::new_in(ir_arrow_fn, &allocator)); } } } @@ -117,7 +117,7 @@ fn convert_output_arrow_to_ir<'a>( ArrowFunctionBody::Expression(expr) => { // Wrap the output expression in an IrExpression::OutputExpr // It will be converted later in the reify phase - IrExpression::OutputExpr(AllocBox::new_in(expr.clone_in(allocator), allocator)) + IrExpression::OutputExpr(AllocBox::new_in(expr.clone_in(allocator), &allocator)) } ArrowFunctionBody::Statements(_) => { // The expression syntax doesn't support multi-line arrow functions, @@ -128,15 +128,15 @@ fn convert_output_arrow_to_ir<'a>( }; // Clone parameters - let mut params: AllocVec<'a, FnParam<'a>> = AllocVec::new_in(allocator); + let mut params: AllocVec<'a, FnParam<'a>> = AllocVec::new_in(&allocator); for param in arrow_fn.params.iter() { params.push(FnParam { name: param.name.clone() }); } Some(ArrowFunctionExpr { params, - body: AllocBox::new_in(body, allocator), - ops: AllocVec::new_in(allocator), + body: AllocBox::new_in(body, &allocator), + ops: AllocVec::new_in(&allocator), var_offset: None, source_span: arrow_fn.source_span, }) @@ -156,7 +156,7 @@ pub fn generate_arrow_functions_for_host(job: &mut HostBindingCompilationJob<'_> transform_expressions_in_create_op( op, &|expr, flags| { - add_arrow_function(expr, allocator, flags); + add_arrow_function(expr, &allocator, flags); }, VisitorContextFlag::NONE, ); @@ -168,7 +168,7 @@ pub fn generate_arrow_functions_for_host(job: &mut HostBindingCompilationJob<'_> transform_expressions_in_update_op( op, &|expr, flags| { - add_arrow_function(expr, allocator, flags); + add_arrow_function(expr, &allocator, flags); }, VisitorContextFlag::NONE, ); diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/generate_local_let_references.rs b/crates/oxc_angular_compiler/src/pipeline/phases/generate_local_let_references.rs index 02918ef05..09bfd8a56 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/generate_local_let_references.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/generate_local_let_references.rs @@ -92,11 +92,11 @@ pub fn generate_local_let_references(job: &mut ComponentCompilationJob<'_>) { let store_let_expr = IrExpression::StoreLet(Box::new_in( StoreLetExpr { target: store_let.target, - value: Box::new_in((*store_let.value).clone_in(allocator), allocator), + value: Box::new_in((*store_let.value).clone_in(allocator), &allocator), var_offset: None, // Assigned by var_counting phase source_span: store_let.base.source_span.unwrap_or_default(), }, - allocator, + &allocator, )); // Use pre-allocated xref @@ -110,7 +110,7 @@ pub fn generate_local_let_references(job: &mut ComponentCompilationJob<'_>) { xref: var_xref, kind: SemanticVariableKind::Identifier, name: declared_name, - initializer: Box::new_in(store_let_expr, allocator), + initializer: Box::new_in(store_let_expr, &allocator), flags: VariableFlags::NONE, view: None, local: true, // @let declarations are local to the view diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/generate_projection_def.rs b/crates/oxc_angular_compiler/src/pipeline/phases/generate_projection_def.rs index 1285395a6..a4c9bd51e 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/generate_projection_def.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/generate_projection_def.rs @@ -106,7 +106,7 @@ pub fn generate_projection_defs(job: &mut ComponentCompilationJob<'_>) { // Convert selectors to R3 format for projectionDef instruction // Build the full def array expression: [selector1, selector2, ...] // Where each selector is either "*" (string) or R3 format (array) - let mut def_elements = OxcVec::with_capacity_in(selectors.len(), allocator); + let mut def_elements = OxcVec::with_capacity_in(selectors.len(), &allocator); for selector in &selectors { if selector.as_str() == "*" { @@ -116,7 +116,7 @@ pub fn generate_projection_defs(job: &mut ComponentCompilationJob<'_>) { value: LiteralValue::String(Ident::from("*")), source_span: None, }, - allocator, + &allocator, ))); } else { // Parse and convert to R3 format @@ -126,12 +126,12 @@ pub fn generate_projection_defs(job: &mut ComponentCompilationJob<'_>) { // Build the selector list array - each R3 selector becomes a nested array // TypeScript: literalOrArrayLiteral(parseSelectorToR3Selector(s)) // This preserves the nesting: [[["", "slot", "value"]]] for single selectors - let mut selector_array = OxcVec::with_capacity_in(r3_list.len(), allocator); + let mut selector_array = OxcVec::with_capacity_in(r3_list.len(), &allocator); for r3_sel in &r3_list { let inner_array = r3_selector_to_output_expr(allocator, r3_sel); selector_array.push(OutputExpression::LiteralArray(OxcBox::new_in( LiteralArrayExpr { entries: inner_array, source_span: None }, - allocator, + &allocator, ))); } @@ -139,14 +139,14 @@ pub fn generate_projection_defs(job: &mut ComponentCompilationJob<'_>) { // This ensures the correct nesting level: [[["", "slot", "value"]]] def_elements.push(OutputExpression::LiteralArray(OxcBox::new_in( LiteralArrayExpr { entries: selector_array, source_span: None }, - allocator, + &allocator, ))); } } let literal_array = OutputExpression::LiteralArray(OxcBox::new_in( LiteralArrayExpr { entries: def_elements, source_span: None }, - allocator, + &allocator, )); // Pool the constant like Angular TS does with job.pool.getConstLiteral() Some(job.pool.get_const_literal(literal_array, true)) @@ -156,16 +156,16 @@ pub fn generate_projection_defs(job: &mut ComponentCompilationJob<'_>) { // Create contentSelectors SECOND (to match TypeScript Angular's constant ordering) { - let mut selector_exprs = OxcVec::with_capacity_in(selectors.len(), allocator); + let mut selector_exprs = OxcVec::with_capacity_in(selectors.len(), &allocator); for selector in &selectors { selector_exprs.push(OutputExpression::Literal(OxcBox::new_in( LiteralExpr { value: LiteralValue::String(selector.clone()), source_span: None }, - allocator, + &allocator, ))); } let literal_array = OutputExpression::LiteralArray(OxcBox::new_in( LiteralArrayExpr { entries: selector_exprs, source_span: None }, - allocator, + &allocator, )); // Pool the constant like Angular TS does with job.pool.getConstLiteral() job.content_selectors = Some(job.pool.get_const_literal(literal_array, true)); diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/generate_variables.rs b/crates/oxc_angular_compiler/src/pipeline/phases/generate_variables.rs index 28743ed01..885c8dce1 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/generate_variables.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/generate_variables.rs @@ -483,7 +483,7 @@ fn generate_variables_in_scope_for_view<'a>( for (name, value) in &scope.context_variables { let xref = job.allocate_xref_id(); new_ops.push(create_context_read_variable( - allocator, + &allocator, xref, scope.view, name.clone(), @@ -495,7 +495,7 @@ fn generate_variables_in_scope_for_view<'a>( for (name, expr) in &scope.alias_variables { let xref = job.allocate_xref_id(); new_ops.push(create_alias_variable( - allocator, + &allocator, xref, scope.view, name.clone(), @@ -516,7 +516,7 @@ fn generate_variables_in_scope_for_view<'a>( for decl in &scope.let_declarations { let xref = job.allocate_xref_id(); new_ops.push(create_context_let_reference_variable( - allocator, + &allocator, xref, decl.variable_name.clone(), decl.target_id, @@ -543,7 +543,7 @@ fn clone_update_op<'a>(allocator: &'a oxc_allocator::Allocator, op: &UpdateOp<'a xref: var.xref, kind: var.kind, name: var.name.clone(), - initializer: Box::new_in(var.initializer.clone_in(allocator), allocator), + initializer: Box::new_in(var.initializer.clone_in(allocator), &allocator), flags: var.flags, view: var.view, local: var.local, @@ -558,9 +558,9 @@ fn clone_update_op<'a>(allocator: &'a oxc_allocator::Allocator, op: &UpdateOp<'a initializer: Box::new_in( IrExpression::NextContext(Box::new_in( NextContextExpr { steps: 0, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), flags: VariableFlags::NONE, view: None, @@ -667,7 +667,7 @@ fn create_next_context_variable<'a>( ) -> UpdateOp<'a> { let initializer = IrExpression::NextContext(Box::new_in( NextContextExpr { steps: 1, source_span: None }, - allocator, + &allocator, )); UpdateOp::Variable(UpdateVariableOp { @@ -675,7 +675,7 @@ fn create_next_context_variable<'a>( xref, kind: SemanticVariableKind::Context, name: Ident::from(""), // Empty = naming phase will assign it - initializer: Box::new_in(initializer, allocator), + initializer: Box::new_in(initializer, &allocator), flags: VariableFlags::NONE, view: Some(context_view), local: false, @@ -703,7 +703,7 @@ fn create_context_read_variable<'a>( // This will be resolved by resolve_contexts to either `ctx` or `ReadVariable(nextContext_var)` let context_expr = IrExpression::Context(Box::new_in( ContextExpr { view: view_xref, source_span: None }, - allocator, + &allocator, )); // Per Angular's generate_variables.ts line 257-258: @@ -715,12 +715,12 @@ fn create_context_read_variable<'a>( // Create a property read from the context: ctx.$implicit, ctx.$index, etc. IrExpression::ResolvedPropertyRead(Box::new_in( ResolvedPropertyReadExpr { - receiver: Box::new_in(context_expr, allocator), + receiver: Box::new_in(context_expr, &allocator), name: context_value, optional: false, source_span: None, }, - allocator, + &allocator, )) }; @@ -729,7 +729,7 @@ fn create_context_read_variable<'a>( xref, kind: SemanticVariableKind::Identifier, name, - initializer: Box::new_in(initializer, allocator), + initializer: Box::new_in(initializer, &allocator), flags: VariableFlags::NONE, view: Some(view_xref), local: false, @@ -749,7 +749,7 @@ fn create_alias_variable<'a>( xref, kind: SemanticVariableKind::Alias, name, - initializer: Box::new_in(expression, allocator), + initializer: Box::new_in(expression, &allocator), flags: VariableFlags::ALWAYS_INLINE, view: Some(view_xref), local: false, @@ -775,7 +775,7 @@ fn create_reference_variable<'a>( offset: local_ref.offset, source_span: None, }, - allocator, + &allocator, )); UpdateOp::Variable(UpdateVariableOp { @@ -783,7 +783,7 @@ fn create_reference_variable<'a>( xref, kind: SemanticVariableKind::Identifier, name: local_ref.name, - initializer: Box::new_in(initializer, allocator), + initializer: Box::new_in(initializer, &allocator), flags: VariableFlags::NONE, view: Some(view_xref), local: false, @@ -807,7 +807,7 @@ fn create_context_let_reference_variable<'a>( let initializer = IrExpression::ContextLetReference(Box::new_in( ContextLetReferenceExpr { target: target_id, target_slot: slot_handle, source_span: None }, - allocator, + &allocator, )); UpdateOp::Variable(UpdateVariableOp { @@ -815,7 +815,7 @@ fn create_context_let_reference_variable<'a>( xref, kind: SemanticVariableKind::Identifier, name, - initializer: Box::new_in(initializer, allocator), + initializer: Box::new_in(initializer, &allocator), flags: VariableFlags::NONE, view: None, local: false, diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/has_const_expression_collection.rs b/crates/oxc_angular_compiler/src/pipeline/phases/has_const_expression_collection.rs index c463ee13f..227028ac6 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/has_const_expression_collection.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/has_const_expression_collection.rs @@ -54,13 +54,13 @@ pub fn collect_const_expressions(job: &mut ComponentCompilationJob<'_>) { let view_xrefs: Vec = job.all_views().map(|v| v.xref).collect(); // Process root view first - process_view_const_expressions(&mut job.root, allocator, &collected, &next_index); + process_view_const_expressions(&mut job.root, &allocator, &collected, &next_index); // Process embedded views for xref in view_xrefs { if xref != root_xref { if let Some(view) = job.views.get_mut(&xref) { - process_view_const_expressions(view.as_mut(), allocator, &collected, &next_index); + process_view_const_expressions(view.as_mut(), &allocator, &collected, &next_index); } } } @@ -106,7 +106,7 @@ fn process_view_const_expressions<'a>( transform_expressions_in_update_op( op, &|expr, _flags| { - collect_const_expr(expr, allocator, collected, next_index); + collect_const_expr(expr, &allocator, collected, next_index); }, VisitorContextFlag::NONE, ); @@ -118,7 +118,7 @@ fn process_view_const_expressions<'a>( transform_expressions_in_create_op( op, &|expr, _flags| { - collect_const_expr(expr, allocator, collected, next_index); + collect_const_expr(expr, &allocator, collected, next_index); }, VisitorContextFlag::NONE, ); @@ -129,7 +129,7 @@ fn process_view_const_expressions<'a>( transform_expressions_in_update_op( op, &|expr, _flags| { - collect_const_expr(expr, allocator, collected, next_index); + collect_const_expr(expr, &allocator, collected, next_index); }, VisitorContextFlag::NONE, ); @@ -160,7 +160,7 @@ fn collect_const_expr<'a>( let source_span = cc.source_span; *expr = IrExpression::ConstReference(Box::new_in( ConstReferenceExpr { index, source_span }, - allocator, + &allocator, )); } } diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/i18n_closure.rs b/crates/oxc_angular_compiler/src/pipeline/phases/i18n_closure.rs index 682f34f16..c667726aa 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/i18n_closure.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/i18n_closure.rs @@ -60,47 +60,47 @@ pub fn create_closure_mode_guard<'a>( expr: AllocBox::new_in( OutputExpression::ReadVar(AllocBox::new_in( ReadVarExpr { name: Ident::from(NG_I18N_CLOSURE_MODE), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), source_span: None, }, - allocator, + &allocator, )); // "undefined" let undefined_literal = OutputExpression::Literal(AllocBox::new_in( LiteralExpr { value: LiteralValue::String(Ident::from("undefined")), source_span: None }, - allocator, + &allocator, )); // typeof ngI18nClosureMode !== "undefined" let not_undefined = OutputExpression::BinaryOperator(AllocBox::new_in( BinaryOperatorExpr { operator: BinaryOperator::NotIdentical, - lhs: AllocBox::new_in(typeof_expr, allocator), - rhs: AllocBox::new_in(undefined_literal, allocator), + lhs: AllocBox::new_in(typeof_expr, &allocator), + rhs: AllocBox::new_in(undefined_literal, &allocator), source_span: None, }, - allocator, + &allocator, )); // ngI18nClosureMode let closure_mode_var = OutputExpression::ReadVar(AllocBox::new_in( ReadVarExpr { name: Ident::from(NG_I18N_CLOSURE_MODE), source_span: None }, - allocator, + &allocator, )); // typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode OutputExpression::BinaryOperator(AllocBox::new_in( BinaryOperatorExpr { operator: BinaryOperator::And, - lhs: AllocBox::new_in(not_undefined, allocator), - rhs: AllocBox::new_in(closure_mode_var, allocator), + lhs: AllocBox::new_in(not_undefined, &allocator), + rhs: AllocBox::new_in(closure_mode_var, &allocator), source_span: None, }, - allocator, + &allocator, )) } @@ -174,21 +174,21 @@ pub fn create_goog_get_msg_statements<'a>( params: &[(String, String)], meta: Option<&I18nMessageMeta<'a>>, ) -> AllocVec<'a, OutputStatement<'a>> { - let mut statements = AllocVec::new_in(allocator); + let mut statements = AllocVec::new_in(&allocator); // Build goog.getMsg arguments - let mut goog_args = AllocVec::new_in(allocator); + let mut goog_args = AllocVec::new_in(&allocator); // First arg: message string with {$placeholder} format let message_str = allocator.alloc_str(message_string); goog_args.push(OutputExpression::Literal(AllocBox::new_in( LiteralExpr { value: LiteralValue::String(Ident::from(message_str)), source_span: None }, - allocator, + &allocator, ))); // Second arg: placeholder values object (if any) if !params.is_empty() { - let mut entries = AllocVec::new_in(allocator); + let mut entries = AllocVec::new_in(&allocator); for (name, value) in params { // Format placeholder name to camelCase for Closure let formatted_name = format_i18n_placeholder_name(name, true); @@ -201,42 +201,42 @@ pub fn create_goog_get_msg_statements<'a>( value: LiteralValue::String(Ident::from(value_str)), source_span: None, }, - allocator, + &allocator, )), true, )); } goog_args.push(OutputExpression::LiteralMap(AllocBox::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, ))); } // goog.getMsg reference let goog_var = OutputExpression::ReadVar(AllocBox::new_in( ReadVarExpr { name: Ident::from("goog"), source_span: None }, - allocator, + &allocator, )); let goog_get_msg = OutputExpression::ReadProp(AllocBox::new_in( ReadPropExpr { - receiver: AllocBox::new_in(goog_var, allocator), + receiver: AllocBox::new_in(goog_var, &allocator), name: Ident::from("getMsg"), optional: false, source_span: None, }, - allocator, + &allocator, )); // goog.getMsg(...) let goog_call = OutputExpression::InvokeFunction(AllocBox::new_in( InvokeFunctionExpr { - fn_expr: AllocBox::new_in(goog_get_msg, allocator), + fn_expr: AllocBox::new_in(goog_get_msg, &allocator), args: goog_args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )); // Create JSDoc comment if metadata is provided @@ -251,30 +251,30 @@ pub fn create_goog_get_msg_statements<'a>( leading_comment, source_span: None, }, - allocator, + &allocator, ))); // i18n_X = MSG_XXX let i18n_var = OutputExpression::ReadVar(AllocBox::new_in( ReadVarExpr { name: i18n_var_name.clone(), source_span: None }, - allocator, + &allocator, )); let closure_var = OutputExpression::ReadVar(AllocBox::new_in( ReadVarExpr { name: closure_var_name.clone(), source_span: None }, - allocator, + &allocator, )); let assignment = OutputExpression::BinaryOperator(AllocBox::new_in( BinaryOperatorExpr { operator: BinaryOperator::Assign, - lhs: AllocBox::new_in(i18n_var, allocator), - rhs: AllocBox::new_in(closure_var, allocator), + lhs: AllocBox::new_in(i18n_var, &allocator), + rhs: AllocBox::new_in(closure_var, &allocator), source_span: None, }, - allocator, + &allocator, )); statements.push(OutputStatement::Expression(AllocBox::new_in( ExpressionStatement { expr: assignment, source_span: None }, - allocator, + &allocator, ))); statements @@ -291,25 +291,25 @@ pub fn create_localize_statements<'a>( i18n_var_name: &Ident<'a>, localized_expr: OutputExpression<'a>, ) -> AllocVec<'a, OutputStatement<'a>> { - let mut statements = AllocVec::new_in(allocator); + let mut statements = AllocVec::new_in(&allocator); // i18n_X = $localize`...` let i18n_var = OutputExpression::ReadVar(AllocBox::new_in( ReadVarExpr { name: i18n_var_name.clone(), source_span: None }, - allocator, + &allocator, )); let assignment = OutputExpression::BinaryOperator(AllocBox::new_in( BinaryOperatorExpr { operator: BinaryOperator::Assign, - lhs: AllocBox::new_in(i18n_var, allocator), - rhs: AllocBox::new_in(localized_expr, allocator), + lhs: AllocBox::new_in(i18n_var, &allocator), + rhs: AllocBox::new_in(localized_expr, &allocator), source_span: None, }, - allocator, + &allocator, )); statements.push(OutputStatement::Expression(AllocBox::new_in( ExpressionStatement { expr: assignment, source_span: None }, - allocator, + &allocator, ))); statements @@ -340,7 +340,7 @@ pub fn create_translation_declaration<'a>( localized_expr: OutputExpression<'a>, meta: Option<&I18nMessageMeta<'a>>, ) -> AllocVec<'a, OutputStatement<'a>> { - let mut statements = AllocVec::new_in(allocator); + let mut statements = AllocVec::new_in(&allocator); // var i18n_X; statements.push(OutputStatement::DeclareVar(AllocBox::new_in( @@ -351,13 +351,13 @@ pub fn create_translation_declaration<'a>( leading_comment: None, source_span: None, }, - allocator, + &allocator, ))); // Create the if statement let guard = create_closure_mode_guard(allocator); let true_case = create_goog_get_msg_statements( - allocator, + &allocator, &i18n_var_name, &closure_var_name, message_for_closure, @@ -368,7 +368,7 @@ pub fn create_translation_declaration<'a>( statements.push(OutputStatement::If(AllocBox::new_in( IfStmt { condition: guard, true_case, false_case, source_span: None }, - allocator, + &allocator, ))); statements diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/i18n_const_collection.rs b/crates/oxc_angular_compiler/src/pipeline/phases/i18n_const_collection.rs index a23b76442..b9f45a0f2 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/i18n_const_collection.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/i18n_const_collection.rs @@ -170,7 +170,7 @@ pub fn collect_i18n_consts(job: &mut ComponentCompilationJob<'_>) { // Collect messages recursively and generate statements let (main_var_name, statements) = collect_message( - allocator, + &allocator, &messages, ¶ms_by_context, &msg_info, @@ -185,7 +185,7 @@ pub fn collect_i18n_consts(job: &mut ComponentCompilationJob<'_>) { let var_name_str = allocator.alloc_str(&main_var_name); let main_var = OutputExpression::ReadVar(oxc_allocator::Box::new_in( ReadVarExpr { name: Ident::from(var_name_str), source_span: None }, - allocator, + &allocator, )); let const_index = job.add_const_with_initializers(ConstValue::Expression(main_var), statements); @@ -220,13 +220,13 @@ pub fn collect_i18n_consts(job: &mut ComponentCompilationJob<'_>) { name: var_name_atom.clone(), source_span: None, }, - allocator, + &allocator, )); attr_op.value = Some(oxc_allocator::Box::new_in( crate::ir::expression::IrExpression::OutputExpr( - oxc_allocator::Box::new_in(var_expr, allocator), + oxc_allocator::Box::new_in(var_expr, &allocator), ), - allocator, + &allocator, )); } } @@ -323,13 +323,13 @@ pub fn collect_i18n_consts(job: &mut ComponentCompilationJob<'_>) { value: LiteralValue::String(Ident::from(name_str)), source_span: None, }, - allocator, + &allocator, )); // Add i18n variable reference let i18n_var = OutputExpression::ReadVar(oxc_allocator::Box::new_in( ReadVarExpr { name: i18n_var_name.clone(), source_span: None }, - allocator, + &allocator, )); Some(vec![name_literal, i18n_var]) @@ -339,7 +339,7 @@ pub fn collect_i18n_consts(job: &mut ComponentCompilationJob<'_>) { if !i18n_attribute_config.is_empty() { // Create array expression and add to consts - let mut config_elements = ArenaVec::new_in(allocator); + let mut config_elements = ArenaVec::new_in(&allocator); config_elements.extend(i18n_attribute_config); let config_array = OutputExpression::LiteralArray(oxc_allocator::Box::new_in( @@ -347,7 +347,7 @@ pub fn collect_i18n_consts(job: &mut ComponentCompilationJob<'_>) { entries: config_elements, source_span: None, }, - allocator, + &allocator, )); let const_index = job.add_const(ConstValue::Expression(config_array)); i18n_attrs_configs.insert(config.elem_xref, const_index); @@ -450,14 +450,14 @@ fn collect_message<'a>( use_external_ids: bool, counter: &mut usize, ) -> (String, ArenaVec<'a, OutputStatement<'a>>) { - let mut all_statements = ArenaVec::new_in(allocator); + let mut all_statements = ArenaVec::new_in(&allocator); // Recursively collect sub-messages first let mut sub_message_placeholders: FxHashMap> = FxHashMap::default(); for &sub_msg_xref in &msg_info.sub_messages { if let Some(sub_msg) = messages.get(&sub_msg_xref) { let (sub_var_name, sub_statements) = collect_message( - allocator, + &allocator, messages, params_by_context, sub_msg, @@ -526,7 +526,7 @@ fn collect_message<'a>( // Create $localize expression let localized_expr = create_localize_expression( - allocator, + &allocator, &message_for_closure, ¶ms, msg_info.description.clone(), @@ -546,7 +546,7 @@ fn collect_message<'a>( let closure_var_atom = Ident::from(allocator.alloc_str(&closure_var_name)); let statements = create_translation_declaration( - allocator, + &allocator, i18n_var_atom, closure_var_atom, &message_for_closure, @@ -627,9 +627,9 @@ fn create_localize_expression<'a>( // Parse message_string to extract text parts and placeholder names in order let (text_parts, placeholder_order) = parse_message_string(message_string); - let mut message_parts = ArenaVec::new_in(allocator); - let mut placeholder_names = ArenaVec::new_in(allocator); - let mut expressions = ArenaVec::new_in(allocator); + let mut message_parts = ArenaVec::new_in(&allocator); + let mut placeholder_names = ArenaVec::new_in(&allocator); + let mut expressions = ArenaVec::new_in(&allocator); // Build a map from placeholder name to value for quick lookup let params_map: FxHashMap = @@ -660,7 +660,7 @@ fn create_localize_expression<'a>( value: LiteralValue::String(Ident::from(value_str)), source_span: None, }, - allocator, + &allocator, )); expressions.push(literal_expr); @@ -695,7 +695,7 @@ fn create_localize_expression<'a>( expressions, source_span: None, }, - allocator, + &allocator, )) } @@ -830,36 +830,36 @@ fn wrap_with_postprocess<'a>( receiver: oxc_allocator::Box::new_in( OutputExpression::ReadVar(oxc_allocator::Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(Identifiers::I18N_POSTPROCESS), optional: false, source_span: None, }, - allocator, + &allocator, )); // Create args array with the localized expression - let mut args = ArenaVec::new_in(allocator); + let mut args = ArenaVec::new_in(&allocator); args.push(expr); // Add postprocessing params if any if !postprocessing_params.is_empty() { - let mut entries = ArenaVec::new_in(allocator); + let mut entries = ArenaVec::new_in(&allocator); for (placeholder, var_names) in postprocessing_params { // Format placeholder name let formatted_name = format_i18n_placeholder_name(placeholder, false); let key_str = allocator.alloc_str(&formatted_name); // Create array of variable references - let mut var_refs = ArenaVec::new_in(allocator); + let mut var_refs = ArenaVec::new_in(&allocator); for var_name in var_names { let var_str = allocator.alloc_str(var_name); var_refs.push(OutputExpression::ReadVar(oxc_allocator::Box::new_in( ReadVarExpr { name: Ident::from(var_str), source_span: None }, - allocator, + &allocator, ))); } @@ -867,7 +867,7 @@ fn wrap_with_postprocess<'a>( Ident::from(key_str), OutputExpression::LiteralArray(oxc_allocator::Box::new_in( LiteralArrayExpr { entries: var_refs, source_span: None }, - allocator, + &allocator, )), true, )); @@ -875,20 +875,20 @@ fn wrap_with_postprocess<'a>( args.push(OutputExpression::LiteralMap(oxc_allocator::Box::new_in( LiteralMapExpr { entries, source_span: None }, - allocator, + &allocator, ))); } // Create the function call: ɵɵi18nPostprocess(localizedExpr, params?) OutputExpression::InvokeFunction(oxc_allocator::Box::new_in( InvokeFunctionExpr { - fn_expr: oxc_allocator::Box::new_in(fn_var, allocator), + fn_expr: oxc_allocator::Box::new_in(fn_var, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -916,7 +916,7 @@ mod tests { value: LiteralValue::String(Ident::from("test message")), source_span: None, }, - &allocator, + &&allocator, )); // Call wrap_with_postprocess with no extra params @@ -942,7 +942,7 @@ mod tests { let input_expr = OutputExpression::ReadVar(oxc_allocator::Box::new_in( ReadVarExpr { name: Ident::from("i18n_0"), source_span: None }, - &allocator, + &&allocator, )); let params = vec![("ICU_0".to_string(), vec!["i18n_1".to_string(), "i18n_2".to_string()])]; diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/i18n_text_extraction.rs b/crates/oxc_angular_compiler/src/pipeline/phases/i18n_text_extraction.rs index 61c24d2f7..91d4c7864 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/i18n_text_extraction.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/i18n_text_extraction.rs @@ -119,7 +119,7 @@ fn convert_i18n_text_in_view(job: &mut ComponentCompilationJob<'_>, view_xref: X icu_placeholder_by_text.insert(text_xref, icu_xref); // Create the IcuPlaceholder op with initial_value as the first string - let mut strings = oxc_allocator::Vec::new_in(allocator); + let mut strings = oxc_allocator::Vec::new_in(&allocator); strings.push(initial_value); let icu_placeholder_op = CreateOp::IcuPlaceholder(IcuPlaceholderOp { @@ -127,7 +127,7 @@ fn convert_i18n_text_in_view(job: &mut ComponentCompilationJob<'_>, view_xref: X xref: icu_xref, name: icu_placeholder_name, strings, - expression_placeholders: oxc_allocator::Vec::new_in(allocator), + expression_placeholders: oxc_allocator::Vec::new_in(&allocator), }); // Replace the Text op with the IcuPlaceholder op @@ -261,7 +261,10 @@ fn convert_i18n_text_in_view(job: &mut ComponentCompilationJob<'_>, view_xref: X target: info.i18n_xref, context: context_id, handle: info.i18n_handle, - expression: oxc_allocator::Box::new_in(expr.clone_in(allocator), allocator), + expression: oxc_allocator::Box::new_in( + expr.clone_in(allocator), + &allocator, + ), resolution_time, usage: I18nExpressionFor::I18nText, name: Ident::from(""), @@ -305,7 +308,7 @@ fn convert_i18n_text_in_view(job: &mut ComponentCompilationJob<'_>, view_xref: X handle: info.i18n_handle, expression: oxc_allocator::Box::new_in( interpolation.clone_in(allocator), - allocator, + &allocator, ), resolution_time, usage: I18nExpressionFor::I18nText, diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/local_refs.rs b/crates/oxc_angular_compiler/src/pipeline/phases/local_refs.rs index 59fec94e0..974e32223 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/local_refs.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/local_refs.rs @@ -174,7 +174,7 @@ fn serialize_local_refs_to_const_value<'a>( allocator: &'a oxc_allocator::Allocator, refs: &[(Ident<'a>, Ident<'a>)], ) -> ConstValue<'a> { - let mut entries = OxcVec::with_capacity_in(refs.len() * 2, allocator); + let mut entries = OxcVec::with_capacity_in(refs.len() * 2, &allocator); for (name, target) in refs { // Add name diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/naming.rs b/crates/oxc_angular_compiler/src/pipeline/phases/naming.rs index f8ce41094..5c168e1c0 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/naming.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/naming.rs @@ -275,7 +275,7 @@ pub fn name_functions_and_variables(job: &mut ComponentCompilationJob<'_>) { add_names_to_root_view( job, &sanitized_base, - allocator, + &allocator, &mut state, &mut var_names, &mut semantic_var_names, @@ -324,7 +324,7 @@ fn add_names_to_root_view<'a>( job, None, // Root view - no xref base_name, - allocator, + &allocator, root_fn_name.as_ref(), state, var_names, @@ -359,7 +359,7 @@ fn add_names_to_child_view<'a>( job, Some(view_xref), base_name, - allocator, + &allocator, Some(&fn_name), state, var_names, @@ -399,7 +399,7 @@ fn process_view_ops_depth_first<'a>( // Phase 0: Process function ops FIRST (matches TypeScript ops() generator order) // Arrow functions have their own ops lists that contain Variable ops prepended // by the generate_variables phase. These must be named before create/update ops. - process_function_ops_in_view(job, view_xref, allocator, state, var_names); + process_function_ops_in_view(job, view_xref, &allocator, state, var_names); // Phase 1: Collect info about child views with their create op indices // We need to collect upfront to avoid borrow issues during iteration @@ -410,7 +410,7 @@ fn process_view_ops_depth_first<'a>( process_create_ops_with_child_recursion( job, view_xref, - allocator, + &allocator, base_name, fn_name, state, @@ -420,7 +420,7 @@ fn process_view_ops_depth_first<'a>( ); // Phase 3: Process update ops (style props, variables) AFTER all create ops and child views - process_update_ops_in_view(job, view_xref, allocator, state, var_names, semantic_var_names); + process_update_ops_in_view(job, view_xref, &allocator, state, var_names, semantic_var_names); } /// Collects child view info with their create op indices for interleaved processing. @@ -608,7 +608,7 @@ fn process_create_ops_with_child_recursion<'a>( process_single_create_op_ref( op, - allocator, + &allocator, base_name, fn_name, state, @@ -632,7 +632,7 @@ fn process_create_ops_with_child_recursion<'a>( job, child_xref, &child_base_name, - allocator, + &allocator, state, var_names, semantic_var_names, @@ -662,7 +662,7 @@ fn process_create_ops_with_child_recursion<'a>( if let UpdateOp::Variable(var_op) = track_op { name_variable_op( var_op, - allocator, + &allocator, state, var_names, semantic_var_names, @@ -835,7 +835,7 @@ fn process_single_create_op_ref<'a>( // Process handler ops inline for handler_op in listener.handler_ops.iter_mut() { if let UpdateOp::Variable(var_op) = handler_op { - name_variable_op(var_op, allocator, state, var_names, semantic_var_names); + name_variable_op(var_op, &allocator, state, var_names, semantic_var_names); } } } @@ -854,7 +854,7 @@ fn process_single_create_op_ref<'a>( // Process handler ops inline for handler_op in listener.handler_ops.iter_mut() { if let UpdateOp::Variable(var_op) = handler_op { - name_variable_op(var_op, allocator, state, var_names, semantic_var_names); + name_variable_op(var_op, &allocator, state, var_names, semantic_var_names); } } } @@ -882,7 +882,7 @@ fn process_single_create_op_ref<'a>( // Process handler ops inline for handler_op in listener.handler_ops.iter_mut() { if let UpdateOp::Variable(var_op) = handler_op { - name_variable_op(var_op, allocator, state, var_names, semantic_var_names); + name_variable_op(var_op, &allocator, state, var_names, semantic_var_names); } } } @@ -902,7 +902,7 @@ fn process_single_create_op_ref<'a>( // Process handler ops inline for handler_op in animation.handler_ops.iter_mut() { if let UpdateOp::Variable(var_op) = handler_op { - name_variable_op(var_op, allocator, state, var_names, semantic_var_names); + name_variable_op(var_op, &allocator, state, var_names, semantic_var_names); } } } @@ -912,7 +912,7 @@ fn process_single_create_op_ref<'a>( // yields track_by_ops inline with the RepeaterCreate op. } CreateOp::Variable(var_op) => { - name_create_variable_op(var_op, allocator, state, var_names, semantic_var_names); + name_create_variable_op(var_op, &allocator, state, var_names, semantic_var_names); } _ => {} } @@ -980,7 +980,7 @@ fn process_function_ops_in_view<'a>( if let UpdateOp::Variable(var_op) = op { name_variable_op( var_op, - allocator, + &allocator, state, var_names, &mut arrow_fn_semantic_var_names, @@ -1041,7 +1041,7 @@ fn process_update_ops_in_view<'a>( } } UpdateOp::Variable(var_op) => { - name_variable_op(var_op, allocator, state, var_names, semantic_var_names); + name_variable_op(var_op, &allocator, state, var_names, semantic_var_names); } _ => {} } @@ -1229,9 +1229,9 @@ mod tests { initializer: AllocBox::new_in( IrExpression::NextContext(AllocBox::new_in( NextContextExpr { steps: 1, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), flags: VariableFlags::NONE, view: Some(view_xref), diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/ng_container.rs b/crates/oxc_angular_compiler/src/pipeline/phases/ng_container.rs index cd189e99e..d1bca4c1f 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/ng_container.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/ng_container.rs @@ -51,7 +51,7 @@ pub fn generate_ng_container_ops(job: &mut ComponentCompilationJob<'_>) { local_refs_index: elem.local_refs_index, // Copy from element local_refs: std::mem::replace( &mut elem.local_refs, - ArenaVec::new_in(allocator), + ArenaVec::new_in(&allocator), ), non_bindable: elem.non_bindable, i18n_placeholder: elem.i18n_placeholder.clone(), diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/ordering.rs b/crates/oxc_angular_compiler/src/pipeline/phases/ordering.rs index fd26edc89..fe6dc79b5 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/ordering.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/ordering.rs @@ -560,7 +560,7 @@ mod tests { host_listener, name: Ident::from(""), handler_expression: None, - handler_ops: AllocVec::new_in(allocator), + handler_ops: AllocVec::new_in(&allocator), handler_fn_name: None, consume_fn_name: None, is_animation_listener, diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/parse_extracted_styles.rs b/crates/oxc_angular_compiler/src/pipeline/phases/parse_extracted_styles.rs index 89974b006..6f70535e5 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/parse_extracted_styles.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/parse_extracted_styles.rs @@ -117,11 +117,11 @@ pub fn parse_extracted_styles(job: &mut ComponentCompilationJob<'_>) { allocator.alloc_str(&prop_value), )), }, - allocator, + &allocator, )), - allocator, + &allocator, )), - allocator, + &allocator, ); let new_op = CreateOp::ExtractedAttribute(ExtractedAttributeOp { @@ -390,11 +390,11 @@ pub fn parse_extracted_styles_for_host(job: &mut HostBindingCompilationJob<'_>) allocator.alloc_str(&prop_value), )), }, - allocator, + &allocator, )), - allocator, + &allocator, )), - allocator, + &allocator, ); let new_op = CreateOp::ExtractedAttribute(ExtractedAttributeOp { diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/pipe_variadic.rs b/crates/oxc_angular_compiler/src/pipeline/phases/pipe_variadic.rs index 940d6eb8d..29a874a61 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/pipe_variadic.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/pipe_variadic.rs @@ -32,7 +32,7 @@ pub fn create_variadic_pipes(job: &mut ComponentCompilationJob<'_>) { for op in view.update.iter_mut() { transform_expressions_in_update_op( op, - &|expr, _flags| transform_pipe_binding(expr, allocator), + &|expr, _flags| transform_pipe_binding(expr, &allocator), VisitorContextFlag::NONE, ); } @@ -54,8 +54,8 @@ fn transform_pipe_binding<'a>( let num_args = pipe.args.len() as u32; // Clone all arguments into a DerivedLiteralArray, preserving all IrExpression types - let mut entries = ArenaVec::with_capacity_in(pipe.args.len(), allocator); - let mut spreads = oxc_allocator::Vec::with_capacity_in(pipe.args.len(), allocator); + let mut entries = ArenaVec::with_capacity_in(pipe.args.len(), &allocator); + let mut spreads = oxc_allocator::Vec::with_capacity_in(pipe.args.len(), &allocator); for arg in pipe.args.iter() { entries.push(arg.clone_in(allocator)); spreads.push(false); @@ -66,9 +66,9 @@ fn transform_pipe_binding<'a>( let args_array = Box::new_in( IrExpression::DerivedLiteralArray(Box::new_in( DerivedLiteralArrayExpr { entries, spreads, source_span: pipe.source_span }, - allocator, + &allocator, )), - allocator, + &allocator, ); // Replace with variadic version @@ -82,7 +82,7 @@ fn transform_pipe_binding<'a>( var_offset: pipe.var_offset, source_span: pipe.source_span, }, - allocator, + &allocator, )); } } diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/pure_function_extraction.rs b/crates/oxc_angular_compiler/src/pipeline/phases/pure_function_extraction.rs index 505b29518..0729ff811 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/pure_function_extraction.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/pure_function_extraction.rs @@ -115,11 +115,11 @@ fn extract_pure_function<'a>( IrExpression::OutputExpr(Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: fn_name, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, )), - allocator, + &allocator, )); } } diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/pure_literal_structures.rs b/crates/oxc_angular_compiler/src/pipeline/phases/pure_literal_structures.rs index c1fffffc9..5d03eda09 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/pure_literal_structures.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/pure_literal_structures.rs @@ -62,7 +62,7 @@ pub fn generate_pure_literal_structures(job: &mut ComponentCompilationJob<'_>) { return; } - transform_literal_structure(expr, allocator, expressions); + transform_literal_structure(expr, &allocator, expressions); }, VisitorContextFlag::NONE, ); @@ -81,16 +81,16 @@ fn transform_literal_structure<'a>( // We do this in a separate step to avoid borrowing issues. let pure_fn_opt: Option> = match expr { IrExpression::Ast(ast_expr) => { - try_create_pure_function_for_angular_expr(ast_expr.as_ref(), allocator) + try_create_pure_function_for_angular_expr(ast_expr.as_ref(), &allocator) } IrExpression::ExpressionRef(id) => { let stored_expr = expressions.get(*id); - try_create_pure_function_for_angular_expr(stored_expr, allocator) + try_create_pure_function_for_angular_expr(stored_expr, &allocator) } // Handle IrExpression::LiteralArray - elements are already IR expressions // TypeScript always creates a PureFunction for literal arrays, even if all constant IrExpression::LiteralArray(arr) => { - create_pure_function_for_ir_array(&arr.elements, &arr.spreads, allocator, expressions) + create_pure_function_for_ir_array(&arr.elements, &arr.spreads, &allocator, expressions) } // Handle IrExpression::LiteralMap - values are already IR expressions // TypeScript always creates a PureFunction for literal maps, even if all constant @@ -99,7 +99,7 @@ fn transform_literal_structure<'a>( &map.values, &map.quoted, &map.spreads, - allocator, + &allocator, expressions, ), // Handle IrExpression::DerivedLiteralArray - created by pipe_variadic phase @@ -107,7 +107,7 @@ fn transform_literal_structure<'a>( IrExpression::DerivedLiteralArray(arr) => create_pure_function_for_derived_array( &arr.entries, &arr.spreads, - allocator, + &allocator, expressions, ), // Handle IrExpression::DerivedLiteralMap - created for variadic maps @@ -116,7 +116,7 @@ fn transform_literal_structure<'a>( &map.values, &map.quoted, &map.spreads, - allocator, + &allocator, expressions, ), _ => None, @@ -124,7 +124,7 @@ fn transform_literal_structure<'a>( // Now apply the transformation if we created a pure function if let Some(pure_fn) = pure_fn_opt { - *expr = IrExpression::PureFunction(AllocBox::new_in(pure_fn, allocator)); + *expr = IrExpression::PureFunction(AllocBox::new_in(pure_fn, &allocator)); } } @@ -138,10 +138,10 @@ fn try_create_pure_function_for_angular_expr<'a>( match angular_expr { // TypeScript always creates a PureFunction for literal arrays, even if all constant AngularExpression::LiteralArray(arr) => { - create_pure_function_for_array(&arr.expressions, allocator) + create_pure_function_for_array(&arr.expressions, &allocator) } // TypeScript always creates a PureFunction for literal maps, even if all constant - AngularExpression::LiteralMap(map) => create_pure_function_for_map(map, allocator), + AngularExpression::LiteralMap(map) => create_pure_function_for_map(map, &allocator), _ => None, } } @@ -204,8 +204,8 @@ fn resolve_expression_for_body<'a>( IrExpression::ExpressionRef(id) => { // Resolve the reference to the actual Angular expression and wrap in Ast let angular_expr = expressions.get(*id); - let cloned = clone_angular_expression(angular_expr, allocator); - IrExpression::Ast(AllocBox::new_in(cloned, allocator)) + let cloned = clone_angular_expression(angular_expr, &allocator); + IrExpression::Ast(AllocBox::new_in(cloned, &allocator)) } // For other expressions, just clone _ => expr.clone_in(allocator), @@ -220,20 +220,20 @@ fn create_pure_function_for_derived_array<'a>( allocator: &'a oxc_allocator::Allocator, expressions: &ExpressionStore<'a>, ) -> Option> { - let mut args: AllocVec<'a, IrExpression<'a>> = AllocVec::new_in(allocator); - let mut body_entries: AllocVec<'a, IrExpression<'a>> = AllocVec::new_in(allocator); - let mut body_spreads: AllocVec<'a, bool> = AllocVec::new_in(allocator); + let mut args: AllocVec<'a, IrExpression<'a>> = AllocVec::new_in(&allocator); + let mut body_entries: AllocVec<'a, IrExpression<'a>> = AllocVec::new_in(&allocator); + let mut body_spreads: AllocVec<'a, bool> = AllocVec::new_in(&allocator); let mut param_index: u32 = 0; for (i, expr) in entries.iter().enumerate() { let is_spread = spreads.get(i).copied().unwrap_or(false); if is_constant_ir_expression(expr, expressions) { - body_entries.push(resolve_expression_for_body(expr, allocator, expressions)); + body_entries.push(resolve_expression_for_body(expr, &allocator, expressions)); } else { args.push(expr.clone_in(allocator)); body_entries.push(IrExpression::PureFunctionParameter(AllocBox::new_in( PureFunctionParameterExpr { index: param_index, source_span: None }, - allocator, + &allocator, ))); param_index += 1; } @@ -242,11 +242,11 @@ fn create_pure_function_for_derived_array<'a>( let body = IrExpression::DerivedLiteralArray(AllocBox::new_in( DerivedLiteralArrayExpr { entries: body_entries, spreads: body_spreads, source_span: None }, - allocator, + &allocator, )); Some(PureFunctionExpr { - body: Some(AllocBox::new_in(body, allocator)), + body: Some(AllocBox::new_in(body, &allocator)), args, fn_ref: None, // Set by pure_function_extraction phase var_offset: None, // Set by var_counting phase @@ -261,20 +261,20 @@ fn create_pure_function_for_ir_array<'a>( allocator: &'a oxc_allocator::Allocator, expressions: &ExpressionStore<'a>, ) -> Option> { - let mut args: AllocVec<'a, IrExpression<'a>> = AllocVec::new_in(allocator); - let mut body_entries: AllocVec<'a, IrExpression<'a>> = AllocVec::new_in(allocator); - let mut body_spreads: AllocVec<'a, bool> = AllocVec::new_in(allocator); + let mut args: AllocVec<'a, IrExpression<'a>> = AllocVec::new_in(&allocator); + let mut body_entries: AllocVec<'a, IrExpression<'a>> = AllocVec::new_in(&allocator); + let mut body_spreads: AllocVec<'a, bool> = AllocVec::new_in(&allocator); let mut param_index: u32 = 0; for (i, expr) in elements.iter().enumerate() { let is_spread = spreads.get(i).copied().unwrap_or(false); if is_constant_ir_expression(expr, expressions) { - body_entries.push(resolve_expression_for_body(expr, allocator, expressions)); + body_entries.push(resolve_expression_for_body(expr, &allocator, expressions)); } else { args.push(expr.clone_in(allocator)); body_entries.push(IrExpression::PureFunctionParameter(AllocBox::new_in( PureFunctionParameterExpr { index: param_index, source_span: None }, - allocator, + &allocator, ))); param_index += 1; } @@ -283,11 +283,11 @@ fn create_pure_function_for_ir_array<'a>( let body = IrExpression::DerivedLiteralArray(AllocBox::new_in( DerivedLiteralArrayExpr { entries: body_entries, spreads: body_spreads, source_span: None }, - allocator, + &allocator, )); Some(PureFunctionExpr { - body: Some(AllocBox::new_in(body, allocator)), + body: Some(AllocBox::new_in(body, &allocator)), args, fn_ref: None, // Set by pure_function_extraction phase var_offset: None, // Set by var_counting phase @@ -304,11 +304,11 @@ fn create_pure_function_for_ir_map<'a>( allocator: &'a oxc_allocator::Allocator, expressions: &ExpressionStore<'a>, ) -> Option> { - let mut args: AllocVec<'a, IrExpression<'a>> = AllocVec::new_in(allocator); - let mut body_keys: AllocVec<'a, Ident<'a>> = AllocVec::new_in(allocator); - let mut body_values: AllocVec<'a, IrExpression<'a>> = AllocVec::new_in(allocator); - let mut body_quoted: AllocVec<'a, bool> = AllocVec::new_in(allocator); - let mut body_spreads: AllocVec<'a, bool> = AllocVec::new_in(allocator); + let mut args: AllocVec<'a, IrExpression<'a>> = AllocVec::new_in(&allocator); + let mut body_keys: AllocVec<'a, Ident<'a>> = AllocVec::new_in(&allocator); + let mut body_values: AllocVec<'a, IrExpression<'a>> = AllocVec::new_in(&allocator); + let mut body_quoted: AllocVec<'a, bool> = AllocVec::new_in(&allocator); + let mut body_spreads: AllocVec<'a, bool> = AllocVec::new_in(&allocator); let mut param_index: u32 = 0; for (i, value) in values.iter().enumerate() { @@ -322,14 +322,14 @@ fn create_pure_function_for_ir_map<'a>( if is_constant_ir_expression(value, expressions) { // Constant value: resolve and clone - body_values.push(resolve_expression_for_body(value, allocator, expressions)); + body_values.push(resolve_expression_for_body(value, &allocator, expressions)); } else { // Non-constant value: add to args and replace with PureFunctionParameterExpr args.push(value.clone_in(allocator)); body_values.push(IrExpression::PureFunctionParameter(AllocBox::new_in( PureFunctionParameterExpr { index: param_index, source_span: None }, - allocator, + &allocator, ))); param_index += 1; } @@ -345,11 +345,11 @@ fn create_pure_function_for_ir_map<'a>( spreads: body_spreads, source_span: None, }, - allocator, + &allocator, )); Some(PureFunctionExpr { - body: Some(AllocBox::new_in(body, allocator)), + body: Some(AllocBox::new_in(body, &allocator)), args, fn_ref: None, // Set by pure_function_extraction phase var_offset: None, // Set by var_counting phase @@ -366,9 +366,9 @@ fn create_pure_function_for_array<'a>( allocator: &'a oxc_allocator::Allocator, ) -> Option> { use crate::ast::expression::AngularExpression; - let mut args: AllocVec<'a, IrExpression<'a>> = AllocVec::new_in(allocator); - let mut body_entries: AllocVec<'a, IrExpression<'a>> = AllocVec::new_in(allocator); - let mut body_spreads: AllocVec<'a, bool> = AllocVec::new_in(allocator); + let mut args: AllocVec<'a, IrExpression<'a>> = AllocVec::new_in(&allocator); + let mut body_entries: AllocVec<'a, IrExpression<'a>> = AllocVec::new_in(&allocator); + let mut body_spreads: AllocVec<'a, bool> = AllocVec::new_in(&allocator); let mut param_index: u32 = 0; for expr in expressions.iter() { @@ -376,14 +376,14 @@ fn create_pure_function_for_array<'a>( let inner = if let AngularExpression::SpreadElement(s) = expr { &s.expression } else { expr }; if is_constant_expression(inner) { - let cloned = clone_angular_expression(inner, allocator); - body_entries.push(IrExpression::Ast(AllocBox::new_in(cloned, allocator))); + let cloned = clone_angular_expression(inner, &allocator); + body_entries.push(IrExpression::Ast(AllocBox::new_in(cloned, &allocator))); } else { - let cloned = clone_angular_expression(inner, allocator); - args.push(IrExpression::Ast(AllocBox::new_in(cloned, allocator))); + let cloned = clone_angular_expression(inner, &allocator); + args.push(IrExpression::Ast(AllocBox::new_in(cloned, &allocator))); body_entries.push(IrExpression::PureFunctionParameter(AllocBox::new_in( PureFunctionParameterExpr { index: param_index, source_span: None }, - allocator, + &allocator, ))); param_index += 1; } @@ -392,11 +392,11 @@ fn create_pure_function_for_array<'a>( let body = IrExpression::DerivedLiteralArray(AllocBox::new_in( DerivedLiteralArrayExpr { entries: body_entries, spreads: body_spreads, source_span: None }, - allocator, + &allocator, )); Some(PureFunctionExpr { - body: Some(AllocBox::new_in(body, allocator)), + body: Some(AllocBox::new_in(body, &allocator)), args, fn_ref: None, // Set by pure_function_extraction phase var_offset: None, // Set by var_counting phase @@ -409,11 +409,11 @@ fn create_pure_function_for_map<'a>( map: &LiteralMap<'a>, allocator: &'a oxc_allocator::Allocator, ) -> Option> { - let mut args: AllocVec<'a, IrExpression<'a>> = AllocVec::new_in(allocator); - let mut body_keys: AllocVec<'a, Ident<'a>> = AllocVec::new_in(allocator); - let mut body_values: AllocVec<'a, IrExpression<'a>> = AllocVec::new_in(allocator); - let mut body_quoted: AllocVec<'a, bool> = AllocVec::new_in(allocator); - let mut body_spreads: AllocVec<'a, bool> = AllocVec::new_in(allocator); + let mut args: AllocVec<'a, IrExpression<'a>> = AllocVec::new_in(&allocator); + let mut body_keys: AllocVec<'a, Ident<'a>> = AllocVec::new_in(&allocator); + let mut body_values: AllocVec<'a, IrExpression<'a>> = AllocVec::new_in(&allocator); + let mut body_quoted: AllocVec<'a, bool> = AllocVec::new_in(&allocator); + let mut body_spreads: AllocVec<'a, bool> = AllocVec::new_in(&allocator); let mut param_index: u32 = 0; for (i, value) in map.values.iter().enumerate() { @@ -433,16 +433,16 @@ fn create_pure_function_for_map<'a>( if is_constant_expression(value) { // Constant value: clone and wrap in IrExpression::Ast - let cloned = clone_angular_expression(value, allocator); - body_values.push(IrExpression::Ast(AllocBox::new_in(cloned, allocator))); + let cloned = clone_angular_expression(value, &allocator); + body_values.push(IrExpression::Ast(AllocBox::new_in(cloned, &allocator))); } else { // Non-constant value: add to args and replace with PureFunctionParameterExpr - let cloned = clone_angular_expression(value, allocator); - args.push(IrExpression::Ast(AllocBox::new_in(cloned, allocator))); + let cloned = clone_angular_expression(value, &allocator); + args.push(IrExpression::Ast(AllocBox::new_in(cloned, &allocator))); body_values.push(IrExpression::PureFunctionParameter(AllocBox::new_in( PureFunctionParameterExpr { index: param_index, source_span: None }, - allocator, + &allocator, ))); param_index += 1; } @@ -458,11 +458,11 @@ fn create_pure_function_for_map<'a>( spreads: body_spreads, source_span: None, }, - allocator, + &allocator, )); Some(PureFunctionExpr { - body: Some(AllocBox::new_in(body, allocator)), + body: Some(AllocBox::new_in(body, &allocator)), args, fn_ref: None, // Set by pure_function_extraction phase var_offset: None, // Set by var_counting phase @@ -493,7 +493,7 @@ pub fn generate_pure_literal_structures_for_host(job: &mut HostBindingCompilatio return; } - transform_literal_structure(expr, allocator, expressions); + transform_literal_structure(expr, &allocator, expressions); }, VisitorContextFlag::NONE, ); diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/regular_expression_optimization.rs b/crates/oxc_angular_compiler/src/pipeline/phases/regular_expression_optimization.rs index a113af8fa..393fd84e5 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/regular_expression_optimization.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/regular_expression_optimization.rs @@ -62,10 +62,10 @@ pub fn optimize_regular_expressions(job: &mut ComponentCompilationJob<'_>) { // Process root view { for op in job.root.create.iter_mut() { - transform_regexes_in_create_op(op, allocator, ®ex_replacements); + transform_regexes_in_create_op(op, &allocator, ®ex_replacements); } for op in job.root.update.iter_mut() { - transform_regexes_in_update_op(op, allocator, ®ex_replacements); + transform_regexes_in_update_op(op, &allocator, ®ex_replacements); } } @@ -76,10 +76,10 @@ pub fn optimize_regular_expressions(job: &mut ComponentCompilationJob<'_>) { } if let Some(view) = job.views.get_mut(&xref) { for op in view.create.iter_mut() { - transform_regexes_in_create_op(op, allocator, ®ex_replacements); + transform_regexes_in_create_op(op, &allocator, ®ex_replacements); } for op in view.update.iter_mut() { - transform_regexes_in_update_op(op, allocator, ®ex_replacements); + transform_regexes_in_update_op(op, &allocator, ®ex_replacements); } } } @@ -195,26 +195,26 @@ fn transform_regexes_in_create_op<'a>( ) { match op { CreateOp::Variable(var) => { - transform_expr(&mut var.initializer, allocator, replacements); + transform_expr(&mut var.initializer, &allocator, replacements); } CreateOp::Listener(listener) => { for handler_op in listener.handler_ops.iter_mut() { - transform_regexes_in_update_op(handler_op, allocator, replacements); + transform_regexes_in_update_op(handler_op, &allocator, replacements); } } CreateOp::TwoWayListener(listener) => { for handler_op in listener.handler_ops.iter_mut() { - transform_regexes_in_update_op(handler_op, allocator, replacements); + transform_regexes_in_update_op(handler_op, &allocator, replacements); } } CreateOp::AnimationListener(listener) => { for handler_op in listener.handler_ops.iter_mut() { - transform_regexes_in_update_op(handler_op, allocator, replacements); + transform_regexes_in_update_op(handler_op, &allocator, replacements); } } CreateOp::Animation(animation) => { for handler_op in animation.handler_ops.iter_mut() { - transform_regexes_in_update_op(handler_op, allocator, replacements); + transform_regexes_in_update_op(handler_op, &allocator, replacements); } } _ => {} @@ -229,22 +229,22 @@ fn transform_regexes_in_update_op<'a>( ) { match op { UpdateOp::Property(prop) => { - transform_expr(&mut prop.expression, allocator, replacements); + transform_expr(&mut prop.expression, &allocator, replacements); } UpdateOp::StyleProp(style) => { - transform_expr(&mut style.expression, allocator, replacements); + transform_expr(&mut style.expression, &allocator, replacements); } UpdateOp::ClassProp(class) => { - transform_expr(&mut class.expression, allocator, replacements); + transform_expr(&mut class.expression, &allocator, replacements); } UpdateOp::Binding(bind) => { - transform_expr(&mut bind.expression, allocator, replacements); + transform_expr(&mut bind.expression, &allocator, replacements); } UpdateOp::Variable(var) => { - transform_expr(&mut var.initializer, allocator, replacements); + transform_expr(&mut var.initializer, &allocator, replacements); } UpdateOp::InterpolateText(interp) => { - transform_expr(&mut interp.interpolation, allocator, replacements); + transform_expr(&mut interp.interpolation, &allocator, replacements); } _ => {} } @@ -270,9 +270,9 @@ fn transform_expr<'a>( *expr = IrExpression::OutputExpr(Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: name.clone(), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, )); } } @@ -300,9 +300,9 @@ pub fn optimize_regular_expressions_for_host(job: &mut HostBindingCompilationJob // Second pass: Replace regex expressions with references to pooled constants for op in job.root.create.iter_mut() { - transform_regexes_in_create_op(op, allocator, ®ex_replacements); + transform_regexes_in_create_op(op, &allocator, ®ex_replacements); } for op in job.root.update.iter_mut() { - transform_regexes_in_update_op(op, allocator, ®ex_replacements); + transform_regexes_in_update_op(op, &allocator, ®ex_replacements); } } diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/reify/angular_expression.rs b/crates/oxc_angular_compiler/src/pipeline/phases/reify/angular_expression.rs index 4e510fb7d..dcacb502e 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/reify/angular_expression.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/reify/angular_expression.rs @@ -123,7 +123,7 @@ fn convert_angular_expression_with_ctx<'a>( }; OutputExpression::Literal(Box::new_in( LiteralExpr { value, source_span: Some(lit.source_span.to_span()) }, - allocator, + &allocator, )) } @@ -134,7 +134,7 @@ fn convert_angular_expression_with_ctx<'a>( name: Ident::from("ctx"), source_span: Some(ir.source_span.to_span()), }, - allocator, + &allocator, )) } @@ -145,7 +145,7 @@ fn convert_angular_expression_with_ctx<'a>( name: Ident::from("ctx"), source_span: Some(tr.source_span.to_span()), }, - allocator, + &allocator, )) } @@ -159,7 +159,7 @@ fn convert_angular_expression_with_ctx<'a>( name: Ident::from("$event"), source_span: Some(prop.source_span.to_span()), }, - allocator, + &allocator, )); } } @@ -167,12 +167,12 @@ fn convert_angular_expression_with_ctx<'a>( convert_angular_expression_with_ctx(allocator, &prop.receiver, root_xref, ctx); OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(receiver, allocator), + receiver: Box::new_in(receiver, &allocator), name: prop.name.clone(), optional: false, source_span: Some(prop.source_span.to_span()), }, - allocator, + &allocator, )) } @@ -182,31 +182,31 @@ fn convert_angular_expression_with_ctx<'a>( let key = convert_angular_expression_with_ctx(allocator, &keyed.key, root_xref, ctx); OutputExpression::ReadKey(Box::new_in( ReadKeyExpr { - receiver: Box::new_in(receiver, allocator), - index: Box::new_in(key, allocator), + receiver: Box::new_in(receiver, &allocator), + index: Box::new_in(key, &allocator), optional: false, source_span: Some(keyed.source_span.to_span()), }, - allocator, + &allocator, )) } AngularExpression::Call(call) => { let receiver = convert_angular_expression_with_ctx(allocator, &call.receiver, root_xref, ctx); - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); for arg in call.args.iter() { args.push(convert_angular_expression_with_ctx(allocator, arg, root_xref, ctx)); } OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(receiver, allocator), + fn_expr: Box::new_in(receiver, &allocator), args, pure: false, optional: false, source_span: Some(call.source_span.to_span()), }, - allocator, + &allocator, )) } @@ -248,11 +248,11 @@ fn convert_angular_expression_with_ctx<'a>( OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: op, - lhs: Box::new_in(left, allocator), - rhs: Box::new_in(right, allocator), + lhs: Box::new_in(left, &allocator), + rhs: Box::new_in(right, &allocator), source_span: Some(bin.source_span.to_span()), }, - allocator, + &allocator, )) } @@ -266,11 +266,11 @@ fn convert_angular_expression_with_ctx<'a>( OutputExpression::UnaryOperator(Box::new_in( UnaryOperatorExpr { operator: op, - expr: Box::new_in(operand, allocator), + expr: Box::new_in(operand, &allocator), parens: false, source_span: Some(unary.source_span.to_span()), }, - allocator, + &allocator, )) } @@ -279,10 +279,10 @@ fn convert_angular_expression_with_ctx<'a>( convert_angular_expression_with_ctx(allocator, ¬.expression, root_xref, ctx); OutputExpression::Not(Box::new_in( NotExpr { - condition: Box::new_in(operand, allocator), + condition: Box::new_in(operand, &allocator), source_span: Some(not.source_span.to_span()), }, - allocator, + &allocator, )) } @@ -295,31 +295,31 @@ fn convert_angular_expression_with_ctx<'a>( convert_angular_expression_with_ctx(allocator, &cond.false_exp, root_xref, ctx); OutputExpression::Conditional(Box::new_in( ConditionalExpr { - condition: Box::new_in(condition, allocator), - true_case: Box::new_in(true_case, allocator), - false_case: Some(Box::new_in(false_case, allocator)), + condition: Box::new_in(condition, &allocator), + true_case: Box::new_in(true_case, &allocator), + false_case: Some(Box::new_in(false_case, &allocator)), source_span: Some(cond.source_span.to_span()), }, - allocator, + &allocator, )) } AngularExpression::LiteralArray(arr) => { - let mut entries = OxcVec::new_in(allocator); + let mut entries = OxcVec::new_in(&allocator); for entry in arr.expressions.iter() { if let AngularExpression::SpreadElement(spread) = entry { let inner = convert_angular_expression_with_ctx( - allocator, + &allocator, &spread.expression, root_xref, ctx, ); entries.push(OutputExpression::SpreadElement(Box::new_in( SpreadElementExpr { - expr: Box::new_in(inner, allocator), + expr: Box::new_in(inner, &allocator), source_span: None, }, - allocator, + &allocator, ))); } else { entries.push(convert_angular_expression_with_ctx( @@ -329,13 +329,13 @@ fn convert_angular_expression_with_ctx<'a>( } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: Some(arr.source_span.to_span()) }, - allocator, + &allocator, )) } AngularExpression::LiteralMap(map) => { use crate::ast::expression::LiteralMapKey; - let mut entries = OxcVec::new_in(allocator); + let mut entries = OxcVec::new_in(&allocator); for (i, key) in map.keys.iter().enumerate() { if i < map.values.len() { match key { @@ -343,7 +343,7 @@ fn convert_angular_expression_with_ctx<'a>( entries.push(LiteralMapEntry::new( prop.key.clone(), convert_angular_expression_with_ctx( - allocator, + &allocator, &map.values[i], root_xref, ctx, @@ -354,7 +354,7 @@ fn convert_angular_expression_with_ctx<'a>( LiteralMapKey::Spread(_) => { entries.push(LiteralMapEntry::spread( convert_angular_expression_with_ctx( - allocator, + &allocator, &map.values[i], root_xref, ctx, @@ -366,7 +366,7 @@ fn convert_angular_expression_with_ctx<'a>( } OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: Some(map.source_span.to_span()) }, - allocator, + &allocator, )) } @@ -375,7 +375,7 @@ fn convert_angular_expression_with_ctx<'a>( value: LiteralValue::Undefined, source_span: Some(empty.source_span.to_span()), }, - allocator, + &allocator, )), AngularExpression::BindingPipe(pipe) => { @@ -397,7 +397,7 @@ fn convert_angular_expression_with_ctx<'a>( let temp_var_read = || { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: temp_name.clone(), source_span: None }, - allocator, + &allocator, )) }; @@ -409,11 +409,11 @@ fn convert_angular_expression_with_ctx<'a>( let assign = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Assign, - lhs: Box::new_in(temp_var_read(), allocator), - rhs: Box::new_in(receiver, allocator), + lhs: Box::new_in(temp_var_read(), &allocator), + rhs: Box::new_in(receiver, &allocator), source_span: None, }, - allocator, + &allocator, )); // Create: ((tmp = receiver) == null ? null : tmp.prop) @@ -421,19 +421,19 @@ fn convert_angular_expression_with_ctx<'a>( // Expr: tmp.prop OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(temp_var_read(), allocator), + receiver: Box::new_in(temp_var_read(), &allocator), name: safe.name.clone(), optional: false, source_span: span, }, - allocator, + &allocator, )) }); // Wrap in parentheses for proper grouping OutputExpression::Parenthesized(Box::new_in( - ParenthesizedExpr { expr: Box::new_in(ternary, allocator), source_span: span }, - allocator, + ParenthesizedExpr { expr: Box::new_in(ternary, &allocator), source_span: span }, + &allocator, )) } else { // Simple case: convert receiver twice (safe for simple expressions) @@ -445,49 +445,49 @@ fn convert_angular_expression_with_ctx<'a>( let null_check = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Equals, - lhs: Box::new_in(receiver_for_check, allocator), + lhs: Box::new_in(receiver_for_check, &allocator), rhs: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), source_span: None, }, - allocator, + &allocator, )); let prop_read = OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(receiver_for_prop, allocator), + receiver: Box::new_in(receiver_for_prop, &allocator), name: safe.name.clone(), optional: false, source_span: span, }, - allocator, + &allocator, )); let conditional = OutputExpression::Conditional(Box::new_in( ConditionalExpr { - condition: Box::new_in(null_check, allocator), + condition: Box::new_in(null_check, &allocator), true_case: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), - false_case: Some(Box::new_in(prop_read, allocator)), + false_case: Some(Box::new_in(prop_read, &allocator)), source_span: span, }, - allocator, + &allocator, )); // Wrap in parentheses for correct operator precedence OutputExpression::Parenthesized(Box::new_in( ParenthesizedExpr { - expr: Box::new_in(conditional, allocator), + expr: Box::new_in(conditional, &allocator), source_span: span, }, - allocator, + &allocator, )) } } @@ -505,7 +505,7 @@ fn convert_angular_expression_with_ctx<'a>( let temp_var_read = || { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: temp_name.clone(), source_span: None }, - allocator, + &allocator, )) }; @@ -517,11 +517,11 @@ fn convert_angular_expression_with_ctx<'a>( let assign = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Assign, - lhs: Box::new_in(temp_var_read(), allocator), - rhs: Box::new_in(receiver, allocator), + lhs: Box::new_in(temp_var_read(), &allocator), + rhs: Box::new_in(receiver, &allocator), source_span: None, }, - allocator, + &allocator, )); // Create: ((tmp = receiver) == null ? null : tmp[key]) @@ -529,19 +529,19 @@ fn convert_angular_expression_with_ctx<'a>( // Expr: tmp[key] OutputExpression::ReadKey(Box::new_in( ReadKeyExpr { - receiver: Box::new_in(temp_var_read(), allocator), - index: Box::new_in(key.clone_in(allocator), allocator), + receiver: Box::new_in(temp_var_read(), &allocator), + index: Box::new_in(key.clone_in(allocator), &allocator), optional: false, source_span: span, }, - allocator, + &allocator, )) }); // Wrap in parentheses for proper grouping OutputExpression::Parenthesized(Box::new_in( - ParenthesizedExpr { expr: Box::new_in(ternary, allocator), source_span: span }, - allocator, + ParenthesizedExpr { expr: Box::new_in(ternary, &allocator), source_span: span }, + &allocator, )) } else { // Simple case: convert receiver twice (safe for simple expressions) @@ -556,53 +556,53 @@ fn convert_angular_expression_with_ctx<'a>( OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Equals, - lhs: Box::new_in(receiver_for_check, allocator), + lhs: Box::new_in(receiver_for_check, &allocator), rhs: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), true_case: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), false_case: Some(Box::new_in( OutputExpression::ReadKey(Box::new_in( ReadKeyExpr { - receiver: Box::new_in(receiver_for_access, allocator), - index: Box::new_in(key, allocator), + receiver: Box::new_in(receiver_for_access, &allocator), + index: Box::new_in(key, &allocator), optional: false, source_span: span, }, - allocator, + &allocator, )), - allocator, + &allocator, )), source_span: span, }, - allocator, + &allocator, )); // Wrap in parentheses for correct operator precedence OutputExpression::Parenthesized(Box::new_in( ParenthesizedExpr { - expr: Box::new_in(conditional, allocator), + expr: Box::new_in(conditional, &allocator), source_span: span, }, - allocator, + &allocator, )) } } @@ -619,7 +619,7 @@ fn convert_angular_expression_with_ctx<'a>( let temp_var_read = || { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: temp_name.clone(), source_span: None }, - allocator, + &allocator, )) }; @@ -631,15 +631,15 @@ fn convert_angular_expression_with_ctx<'a>( let assign = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Assign, - lhs: Box::new_in(temp_var_read(), allocator), - rhs: Box::new_in(receiver, allocator), + lhs: Box::new_in(temp_var_read(), &allocator), + rhs: Box::new_in(receiver, &allocator), source_span: None, }, - allocator, + &allocator, )); // Convert args for the call inside the ternary - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); for arg in safe.args.iter() { args.push(convert_angular_expression_with_ctx(allocator, arg, root_xref, ctx)); } @@ -647,20 +647,20 @@ fn convert_angular_expression_with_ctx<'a>( // Create: ((tmp = receiver) == null ? null : tmp()) let call = OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(temp_var_read(), allocator), + fn_expr: Box::new_in(temp_var_read(), &allocator), args, pure: false, optional: false, source_span: span, }, - allocator, + &allocator, )); let ternary = safe_ternary_with_temp(allocator, assign, || call); // Wrap in parentheses for proper grouping OutputExpression::Parenthesized(Box::new_in( - ParenthesizedExpr { expr: Box::new_in(ternary, allocator), source_span: span }, - allocator, + ParenthesizedExpr { expr: Box::new_in(ternary, &allocator), source_span: span }, + &allocator, )) } else { // Simple case: convert receiver twice (safe for simple expressions) @@ -670,20 +670,20 @@ fn convert_angular_expression_with_ctx<'a>( convert_angular_expression_with_ctx(allocator, &safe.receiver, root_xref, ctx); // Convert args - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); for arg in safe.args.iter() { args.push(convert_angular_expression_with_ctx(allocator, arg, root_xref, ctx)); } let call = OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(receiver_for_call, allocator), + fn_expr: Box::new_in(receiver_for_call, &allocator), args, pure: false, optional: false, source_span: span, }, - allocator, + &allocator, )); let conditional = OutputExpression::Conditional(Box::new_in( ConditionalExpr { @@ -691,42 +691,42 @@ fn convert_angular_expression_with_ctx<'a>( OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Equals, - lhs: Box::new_in(receiver_for_check, allocator), + lhs: Box::new_in(receiver_for_check, &allocator), rhs: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), true_case: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), - false_case: Some(Box::new_in(call, allocator)), + false_case: Some(Box::new_in(call, &allocator)), source_span: span, }, - allocator, + &allocator, )); // Wrap in parentheses for correct operator precedence OutputExpression::Parenthesized(Box::new_in( ParenthesizedExpr { - expr: Box::new_in(conditional, allocator), + expr: Box::new_in(conditional, &allocator), source_span: span, }, - allocator, + &allocator, )) } } @@ -749,7 +749,7 @@ fn convert_angular_expression_with_ctx<'a>( value: LiteralValue::Undefined, source_span: Some(chain.source_span.to_span()), }, - allocator, + &allocator, )) } } @@ -766,7 +766,7 @@ fn convert_angular_expression_with_ctx<'a>( value: LiteralValue::String(Ident::from("")), source_span: Some(interp.source_span.to_span()), }, - allocator, + &allocator, )) } } @@ -776,10 +776,10 @@ fn convert_angular_expression_with_ctx<'a>( convert_angular_expression_with_ctx(allocator, &te.expression, root_xref, ctx); OutputExpression::Typeof(Box::new_in( TypeofExpr { - expr: Box::new_in(operand, allocator), + expr: Box::new_in(operand, &allocator), source_span: Some(te.source_span.to_span()), }, - allocator, + &allocator, )) } @@ -788,10 +788,10 @@ fn convert_angular_expression_with_ctx<'a>( convert_angular_expression_with_ctx(allocator, &ve.expression, root_xref, ctx); OutputExpression::Void(Box::new_in( VoidExpr { - expr: Box::new_in(operand, allocator), + expr: Box::new_in(operand, &allocator), source_span: Some(ve.source_span.to_span()), }, - allocator, + &allocator, )) } @@ -803,8 +803,8 @@ fn convert_angular_expression_with_ctx<'a>( AngularExpression::TemplateLiteral(tl) => { // Convert template literal: `text ${expr} more text` - let mut elements = OxcVec::new_in(allocator); - let mut expressions = OxcVec::new_in(allocator); + let mut elements = OxcVec::new_in(&allocator); + let mut expressions = OxcVec::new_in(&allocator); for elem in tl.elements.iter() { elements.push(TemplateLiteralElement { @@ -825,7 +825,7 @@ fn convert_angular_expression_with_ctx<'a>( expressions, source_span: Some(tl.source_span.to_span()), }, - allocator, + &allocator, )) } @@ -833,8 +833,8 @@ fn convert_angular_expression_with_ctx<'a>( // Convert tagged template literal: tag`text ${expr}` let tag = convert_angular_expression_with_ctx(allocator, &ttl.tag, root_xref, ctx); - let mut elements = OxcVec::new_in(allocator); - let mut expressions = OxcVec::new_in(allocator); + let mut elements = OxcVec::new_in(&allocator); + let mut expressions = OxcVec::new_in(&allocator); for elem in ttl.template.elements.iter() { elements.push(TemplateLiteralElement { @@ -857,11 +857,11 @@ fn convert_angular_expression_with_ctx<'a>( OutputExpression::TaggedTemplateLiteral(Box::new_in( TaggedTemplateLiteralExpr { - tag: Box::new_in(tag, allocator), - template: Box::new_in(template, allocator), + tag: Box::new_in(tag, &allocator), + template: Box::new_in(template, &allocator), source_span: Some(ttl.source_span.to_span()), }, - allocator, + &allocator, )) } @@ -873,7 +873,7 @@ fn convert_angular_expression_with_ctx<'a>( flags: re.flags.clone(), source_span: Some(re.source_span.to_span()), }, - allocator, + &allocator, )) } @@ -884,7 +884,7 @@ fn convert_angular_expression_with_ctx<'a>( // Arrow function - convert to OutputExpression::ArrowFunction AngularExpression::ArrowFunction(arrow) => { - let mut params = OxcVec::new_in(allocator); + let mut params = OxcVec::new_in(&allocator); for p in arrow.parameters.iter() { params.push(FnParam { name: p.name.clone() }); } @@ -894,10 +894,10 @@ fn convert_angular_expression_with_ctx<'a>( OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { params, - body: ArrowFunctionBody::Expression(Box::new_in(body, allocator)), + body: ArrowFunctionBody::Expression(Box::new_in(body, &allocator)), source_span: Some(arrow.source_span.to_span()), }, - allocator, + &allocator, )) } } @@ -923,30 +923,30 @@ where OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Equals, - lhs: Box::new_in(guard, allocator), + lhs: Box::new_in(guard, &allocator), rhs: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), true_case: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), - false_case: Some(Box::new_in(make_expr(), allocator)), + false_case: Some(Box::new_in(make_expr(), &allocator)), source_span: None, }, - allocator, + &allocator, )) } diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/reify/ir_expression.rs b/crates/oxc_angular_compiler/src/pipeline/phases/reify/ir_expression.rs index 3eefc5a05..bc062c597 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/reify/ir_expression.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/reify/ir_expression.rs @@ -44,7 +44,7 @@ pub fn convert_ir_expression<'a>( }; OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: var_name, source_span: var.source_span }, - allocator, + &allocator, )) } @@ -53,7 +53,7 @@ pub fn convert_ir_expression<'a>( // This becomes `ctx` in the generated code OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("ctx"), source_span: ctx.source_span }, - allocator, + &allocator, )) } @@ -64,7 +64,7 @@ pub fn convert_ir_expression<'a>( if lexical.name.as_str() == "$event" || lexical.name.as_str() == "ctx" { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: lexical.name.clone(), source_span: lexical.source_span }, - allocator, + &allocator, )) } else { // If we still have a lexical read at this point, it's a component property @@ -74,15 +74,15 @@ pub fn convert_ir_expression<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("ctx"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: lexical.name.clone(), optional: false, source_span: lexical.source_span, }, - allocator, + &allocator, )) } } @@ -102,20 +102,20 @@ pub fn convert_ir_expression<'a>( // Empty expression becomes undefined OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Undefined, source_span: empty.source_span }, - allocator, + &allocator, )) } IrExpression::NextContext(ctx) => { // i0.ɵɵnextContext(steps) - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); if ctx.steps > 1 { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(ctx.steps as f64), source_span: None, }, - allocator, + &allocator, ))); } create_instruction_call_expr(allocator, Identifiers::NEXT_CONTEXT, args) @@ -124,7 +124,7 @@ pub fn convert_ir_expression<'a>( IrExpression::Reference(ref_expr) => { // i0.ɵɵreference(slot + 1 + offset) // TypeScript: ng.reference(expr.targetSlot.slot! + 1 + expr.offset) - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); if let Some(slot) = ref_expr.target_slot.slot { let slot_value = slot.0 as i32 + 1 + ref_expr.offset; args.push(OutputExpression::Literal(Box::new_in( @@ -132,7 +132,7 @@ pub fn convert_ir_expression<'a>( value: LiteralValue::Number(slot_value as f64), source_span: None, }, - allocator, + &allocator, ))); } create_instruction_call_expr(allocator, Identifiers::REFERENCE, args) @@ -140,7 +140,7 @@ pub fn convert_ir_expression<'a>( IrExpression::RestoreView(rv) => { // i0.ɵɵrestoreView(savedView) - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // The view should have been resolved to a variable during resolve_names phase match &rv.view { crate::ir::expression::RestoreViewTarget::Dynamic(inner_expr) => { @@ -151,7 +151,7 @@ pub fn convert_ir_expression<'a>( // Fallback: use _r if not resolved (shouldn't happen in correct flow) args.push(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("_r"), source_span: None }, - allocator, + &allocator, ))); } } @@ -161,33 +161,33 @@ pub fn convert_ir_expression<'a>( IrExpression::GetCurrentView(_) => { // i0.ɵɵgetCurrentView() create_instruction_call_expr( - allocator, + &allocator, Identifiers::GET_CURRENT_VIEW, - OxcVec::new_in(allocator), + OxcVec::new_in(&allocator), ) } IrExpression::ResetView(rv) => { // i0.ɵɵresetView(expr) - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(convert_ir_expression(allocator, &rv.expr, expressions, root_xref)); create_instruction_call_expr(allocator, Identifiers::RESET_VIEW, args) } IrExpression::PipeBinding(pipe) => { // i0.ɵɵpipeBind1/2/3/4/V(slot, varOffset, args...) - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // Add pipe slot (targetSlot.slot - must always be present after slot allocation) let slot_value = pipe.target_slot.slot.map_or(0, |s| s.0); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(slot_value as f64), source_span: None }, - allocator, + &allocator, ))); // Add var offset (assigned by var_counting phase) let var_offset = pipe.var_offset.unwrap_or(0); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(var_offset as f64), source_span: None }, - allocator, + &allocator, ))); // Add pipe arguments for arg in pipe.args.iter() { @@ -201,18 +201,18 @@ pub fn convert_ir_expression<'a>( // i0.ɵɵpipeBindV(slot, varOffset, pureFunctionExpr) // For variadic pipes (>4 args), the args field contains a PureFunction // expression that wraps all the pipe arguments. - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // Add pipe slot let slot_value = pipe.target_slot.slot.map_or(0, |s| s.0); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(slot_value as f64), source_span: None }, - allocator, + &allocator, ))); // Add var offset let var_offset = pipe.var_offset.unwrap_or(0); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(var_offset as f64), source_span: None }, - allocator, + &allocator, ))); // Add the pure function expression containing all arguments args.push(convert_ir_expression(allocator, &pipe.args, expressions, root_xref)); @@ -228,14 +228,14 @@ pub fn convert_ir_expression<'a>( // // For variadic (arg count > 8): pureFunctionV(offset, fn, [args...]) // The args are wrapped in an array literal for the variadic case. - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // Add var offset (assigned by var_counting phase) args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(pf.var_offset.unwrap_or(0) as f64), source_span: None, }, - allocator, + &allocator, ))); // Add function reference (the pure function constant) // This should always be set by the pure_function_extraction phase. @@ -250,7 +250,7 @@ pub fn convert_ir_expression<'a>( // Output null as placeholder - this will cause a runtime error args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } } @@ -258,10 +258,10 @@ pub fn convert_ir_expression<'a>( let is_variadic = pf.args.len() > 8; if is_variadic { // Variadic calling pattern: pureFunctionV(offset, fn, [args...]) - let mut array_entries = OxcVec::with_capacity_in(pf.args.len(), allocator); + let mut array_entries = OxcVec::with_capacity_in(pf.args.len(), &allocator); for arg in pf.args.iter() { array_entries.push(convert_ir_expression( - allocator, + &allocator, arg, expressions, root_xref, @@ -269,7 +269,7 @@ pub fn convert_ir_expression<'a>( } args.push(OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: array_entries, source_span: None }, - allocator, + &allocator, ))); } else { // Constant calling pattern: pureFunction1/2/etc(offset, fn, arg1, arg2, ...) @@ -289,24 +289,24 @@ pub fn convert_ir_expression<'a>( value: LiteralValue::Number(value), source_span: slot_lit.source_span, }, - allocator, + &allocator, )) } IrExpression::StoreLet(store) => { // i0.ɵɵstoreLet(value) - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(convert_ir_expression(allocator, &store.value, expressions, root_xref)); create_instruction_call_expr(allocator, Identifiers::STORE_LET, args) } IrExpression::ContextLetReference(ctx_let) => { // i0.ɵɵreadContextLet(slot) - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); if let Some(slot) = ctx_let.target_slot.slot { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(slot.0 as f64), source_span: None }, - allocator, + &allocator, ))); } create_instruction_call_expr(allocator, Identifiers::READ_CONTEXT_LET, args) @@ -316,7 +316,7 @@ pub fn convert_ir_expression<'a>( // Reference to `this` for track functions OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("this"), source_span: None }, - allocator, + &allocator, )) } @@ -325,7 +325,7 @@ pub fn convert_ir_expression<'a>( let var_name = tmp.name.clone().unwrap_or_else(|| Ident::from("_tmp")); OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: var_name, source_span: None }, - allocator, + &allocator, )) } @@ -339,14 +339,14 @@ pub fn convert_ir_expression<'a>( lhs: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: var_name, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), - rhs: Box::new_in(value, allocator), + rhs: Box::new_in(value, &allocator), source_span: None, }, - allocator, + &allocator, )) } @@ -361,37 +361,37 @@ pub fn convert_ir_expression<'a>( let null_check = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Equals, - lhs: Box::new_in(guard, allocator), + lhs: Box::new_in(guard, &allocator), rhs: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), source_span: None, }, - allocator, + &allocator, )); let conditional = OutputExpression::Conditional(Box::new_in( ConditionalExpr { - condition: Box::new_in(null_check, allocator), + condition: Box::new_in(null_check, &allocator), true_case: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), - false_case: Some(Box::new_in(true_case, allocator)), + false_case: Some(Box::new_in(true_case, &allocator)), source_span: None, }, - allocator, + &allocator, )); // Wrap in parentheses for correct precedence OutputExpression::Parenthesized(Box::new_in( - ParenthesizedExpr { expr: Box::new_in(conditional, allocator), source_span: None }, - allocator, + ParenthesizedExpr { expr: Box::new_in(conditional, &allocator), source_span: None }, + &allocator, )) } @@ -405,14 +405,14 @@ pub fn convert_ir_expression<'a>( // Special case: [title]="{{expr}}" (single expression, all empty strings) // Generates: ɵɵinterpolate(expr) - uses the simple form that just stringifies let expr_count = interp.expressions.len(); - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // For single expression with empty surrounding strings, use ɵɵinterpolate(expr) // This is the simple form that just stringifies the value without prefix/suffix. // Note: we use expr_count=0 to select ɵɵinterpolate instead of ɵɵinterpolate1. if expr_count == 1 && interp.strings.iter().all(|s| s.is_empty()) { args.push(convert_ir_expression( - allocator, + &allocator, &interp.expressions[0], expressions, root_xref, @@ -428,7 +428,7 @@ pub fn convert_ir_expression<'a>( value: LiteralValue::String(interp.strings[i].clone()), source_span: None, }, - allocator, + &allocator, ))); } args.push(convert_ir_expression(allocator, ir_expr, expressions, root_xref)); @@ -443,7 +443,7 @@ pub fn convert_ir_expression<'a>( value: LiteralValue::String(trailing.clone()), source_span: None, }, - allocator, + &allocator, ))); } } @@ -462,7 +462,7 @@ pub fn convert_ir_expression<'a>( // Reference to a const array index - emit as a literal number OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(cr.index as f64), source_span: None }, - allocator, + &allocator, )) } @@ -475,11 +475,11 @@ pub fn convert_ir_expression<'a>( OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator, - lhs: Box::new_in(lhs, allocator), - rhs: Box::new_in(rhs, allocator), + lhs: Box::new_in(lhs, &allocator), + rhs: Box::new_in(rhs, &allocator), source_span: binary.source_span, }, - allocator, + &allocator, )) } @@ -491,12 +491,12 @@ pub fn convert_ir_expression<'a>( convert_ir_expression(allocator, &resolved.receiver, expressions, root_xref); OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(receiver, allocator), + receiver: Box::new_in(receiver, &allocator), name: resolved.name.clone(), optional: resolved.optional, source_span: resolved.source_span, }, - allocator, + &allocator, )) } @@ -548,11 +548,11 @@ pub fn convert_ir_expression<'a>( OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator, - lhs: Box::new_in(left, allocator), - rhs: Box::new_in(right, allocator), + lhs: Box::new_in(left, &allocator), + rhs: Box::new_in(right, &allocator), source_span: resolved.source_span, }, - allocator, + &allocator, )) } @@ -562,19 +562,19 @@ pub fn convert_ir_expression<'a>( // To: ctx.removeTodo(todo_i8) let receiver = convert_ir_expression(allocator, &resolved.receiver, expressions, root_xref); - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); for arg in resolved.args.iter() { args.push(convert_ir_expression(allocator, arg, expressions, root_xref)); } OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(receiver, allocator), + fn_expr: Box::new_in(receiver, &allocator), args, pure: false, optional: resolved.optional, source_span: resolved.source_span, }, - allocator, + &allocator, )) } @@ -587,12 +587,12 @@ pub fn convert_ir_expression<'a>( let index = convert_ir_expression(allocator, &resolved.key, expressions, root_xref); OutputExpression::ReadKey(Box::new_in( ReadKeyExpr { - receiver: Box::new_in(receiver, allocator), - index: Box::new_in(index, allocator), + receiver: Box::new_in(receiver, &allocator), + index: Box::new_in(index, &allocator), optional: resolved.optional, source_span: resolved.source_span, }, - allocator, + &allocator, )) } @@ -608,12 +608,12 @@ pub fn convert_ir_expression<'a>( // should have already transformed this into a safe ternary pattern OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(receiver, allocator), + receiver: Box::new_in(receiver, &allocator), name: resolved.name.clone(), optional: false, source_span: resolved.source_span, }, - allocator, + &allocator, )) } @@ -634,46 +634,46 @@ pub fn convert_ir_expression<'a>( let null_check = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Equals, - lhs: Box::new_in(receiver, allocator), + lhs: Box::new_in(receiver, &allocator), rhs: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), source_span: None, }, - allocator, + &allocator, )); let prop_read = OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(receiver_clone, allocator), + receiver: Box::new_in(receiver_clone, &allocator), name: safe.name.clone(), optional: false, source_span: span, }, - allocator, + &allocator, )); let conditional = OutputExpression::Conditional(Box::new_in( ConditionalExpr { - condition: Box::new_in(null_check, allocator), + condition: Box::new_in(null_check, &allocator), true_case: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), - false_case: Some(Box::new_in(prop_read, allocator)), + false_case: Some(Box::new_in(prop_read, &allocator)), source_span: span, }, - allocator, + &allocator, )); // Wrap in parentheses for correct operator precedence OutputExpression::Parenthesized(Box::new_in( - ParenthesizedExpr { expr: Box::new_in(conditional, allocator), source_span: span }, - allocator, + ParenthesizedExpr { expr: Box::new_in(conditional, &allocator), source_span: span }, + &allocator, )) } @@ -687,46 +687,46 @@ pub fn convert_ir_expression<'a>( let null_check = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Equals, - lhs: Box::new_in(receiver, allocator), + lhs: Box::new_in(receiver, &allocator), rhs: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), source_span: None, }, - allocator, + &allocator, )); let keyed_read = OutputExpression::ReadKey(Box::new_in( ReadKeyExpr { - receiver: Box::new_in(receiver_clone, allocator), - index: Box::new_in(index, allocator), + receiver: Box::new_in(receiver_clone, &allocator), + index: Box::new_in(index, &allocator), optional: false, source_span: span, }, - allocator, + &allocator, )); let conditional = OutputExpression::Conditional(Box::new_in( ConditionalExpr { - condition: Box::new_in(null_check, allocator), + condition: Box::new_in(null_check, &allocator), true_case: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), - false_case: Some(Box::new_in(keyed_read, allocator)), + false_case: Some(Box::new_in(keyed_read, &allocator)), source_span: span, }, - allocator, + &allocator, )); // Wrap in parentheses for correct operator precedence OutputExpression::Parenthesized(Box::new_in( - ParenthesizedExpr { expr: Box::new_in(conditional, allocator), source_span: span }, - allocator, + ParenthesizedExpr { expr: Box::new_in(conditional, &allocator), source_span: span }, + &allocator, )) } @@ -736,54 +736,54 @@ pub fn convert_ir_expression<'a>( let span = safe.source_span; let receiver = convert_ir_expression(allocator, &safe.receiver, expressions, root_xref); let receiver_clone = receiver.clone_in(allocator); - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); for arg in safe.args.iter() { args.push(convert_ir_expression(allocator, arg, expressions, root_xref)); } let null_check = OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Equals, - lhs: Box::new_in(receiver, allocator), + lhs: Box::new_in(receiver, &allocator), rhs: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), source_span: None, }, - allocator, + &allocator, )); let call = OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(receiver_clone, allocator), + fn_expr: Box::new_in(receiver_clone, &allocator), args, pure: false, optional: false, source_span: span, }, - allocator, + &allocator, )); let conditional = OutputExpression::Conditional(Box::new_in( ConditionalExpr { - condition: Box::new_in(null_check, allocator), + condition: Box::new_in(null_check, &allocator), true_case: Box::new_in( OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), - false_case: Some(Box::new_in(call, allocator)), + false_case: Some(Box::new_in(call, &allocator)), source_span: span, }, - allocator, + &allocator, )); // Wrap in parentheses for correct operator precedence OutputExpression::Parenthesized(Box::new_in( - ParenthesizedExpr { expr: Box::new_in(conditional, allocator), source_span: span }, - allocator, + ParenthesizedExpr { expr: Box::new_in(conditional, &allocator), source_span: span }, + &allocator, )) } @@ -797,26 +797,26 @@ pub fn convert_ir_expression<'a>( convert_ir_expression(allocator, &ternary.false_expr, expressions, root_xref); OutputExpression::Conditional(Box::new_in( ConditionalExpr { - condition: Box::new_in(condition, allocator), - true_case: Box::new_in(true_case, allocator), - false_case: Some(Box::new_in(false_case, allocator)), + condition: Box::new_in(condition, &allocator), + true_case: Box::new_in(true_case, &allocator), + false_case: Some(Box::new_in(false_case, &allocator)), source_span: ternary.source_span, }, - allocator, + &allocator, )) } IrExpression::LiteralArray(arr) => { - let mut entries = OxcVec::with_capacity_in(arr.elements.len(), allocator); + let mut entries = OxcVec::with_capacity_in(arr.elements.len(), &allocator); for (i, elem) in arr.elements.iter().enumerate() { let converted = convert_ir_expression(allocator, elem, expressions, root_xref); if arr.spreads.get(i).copied().unwrap_or(false) { entries.push(OutputExpression::SpreadElement(Box::new_in( SpreadElementExpr { - expr: Box::new_in(converted, allocator), + expr: Box::new_in(converted, &allocator), source_span: None, }, - allocator, + &allocator, ))); } else { entries.push(converted); @@ -824,12 +824,12 @@ pub fn convert_ir_expression<'a>( } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: arr.source_span }, - allocator, + &allocator, )) } IrExpression::LiteralMap(map) => { - let mut entries = OxcVec::with_capacity_in(map.values.len(), allocator); + let mut entries = OxcVec::with_capacity_in(map.values.len(), &allocator); for (i, value) in map.values.iter().enumerate() { let key = map.keys.get(i).cloned().unwrap_or_else(|| Ident::from("")); let quoted = map.quoted.get(i).copied().unwrap_or(false); @@ -840,21 +840,21 @@ pub fn convert_ir_expression<'a>( } OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: map.source_span }, - allocator, + &allocator, )) } IrExpression::DerivedLiteralArray(arr) => { - let mut entries = OxcVec::with_capacity_in(arr.entries.len(), allocator); + let mut entries = OxcVec::with_capacity_in(arr.entries.len(), &allocator); for (i, entry) in arr.entries.iter().enumerate() { let converted = convert_ir_expression(allocator, entry, expressions, root_xref); if arr.spreads.get(i).copied().unwrap_or(false) { entries.push(OutputExpression::SpreadElement(Box::new_in( SpreadElementExpr { - expr: Box::new_in(converted, allocator), + expr: Box::new_in(converted, &allocator), source_span: None, }, - allocator, + &allocator, ))); } else { entries.push(converted); @@ -862,12 +862,12 @@ pub fn convert_ir_expression<'a>( } OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries, source_span: arr.source_span }, - allocator, + &allocator, )) } IrExpression::DerivedLiteralMap(map) => { - let mut entries = OxcVec::with_capacity_in(map.values.len(), allocator); + let mut entries = OxcVec::with_capacity_in(map.values.len(), &allocator); for (i, value) in map.values.iter().enumerate() { let key = map.keys.get(i).cloned().unwrap_or_else(|| Ident::from("")); let quoted = map.quoted.get(i).copied().unwrap_or(false); @@ -878,7 +878,7 @@ pub fn convert_ir_expression<'a>( } OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries, source_span: map.source_span }, - allocator, + &allocator, )) } @@ -887,10 +887,10 @@ pub fn convert_ir_expression<'a>( let expr = convert_ir_expression(allocator, ¬.expr, expressions, root_xref); OutputExpression::Not(Box::new_in( crate::output::ast::NotExpr { - condition: Box::new_in(expr, allocator), + condition: Box::new_in(expr, &allocator), source_span: not.source_span, }, - allocator, + &allocator, )) } @@ -908,11 +908,11 @@ pub fn convert_ir_expression<'a>( OutputExpression::UnaryOperator(Box::new_in( crate::output::ast::UnaryOperatorExpr { operator, - expr: Box::new_in(expr, allocator), + expr: Box::new_in(expr, &allocator), parens: false, source_span: unary.source_span, }, - allocator, + &allocator, )) } @@ -921,10 +921,10 @@ pub fn convert_ir_expression<'a>( let expr = convert_ir_expression(allocator, &typeof_expr.expr, expressions, root_xref); OutputExpression::Typeof(Box::new_in( crate::output::ast::TypeofExpr { - expr: Box::new_in(expr, allocator), + expr: Box::new_in(expr, &allocator), source_span: typeof_expr.source_span, }, - allocator, + &allocator, )) } @@ -933,18 +933,18 @@ pub fn convert_ir_expression<'a>( let expr = convert_ir_expression(allocator, &void_expr.expr, expressions, root_xref); OutputExpression::Void(Box::new_in( crate::output::ast::VoidExpr { - expr: Box::new_in(expr, allocator), + expr: Box::new_in(expr, &allocator), source_span: void_expr.source_span, }, - allocator, + &allocator, )) } // Resolved template literal (template literal with resolved expressions) IrExpression::ResolvedTemplateLiteral(rtl) => { // Convert to OutputExpression::TemplateLiteral - let mut elements = OxcVec::new_in(allocator); - let mut output_expressions = OxcVec::new_in(allocator); + let mut elements = OxcVec::new_in(&allocator); + let mut output_expressions = OxcVec::new_in(&allocator); for elem in rtl.elements.iter() { elements.push(crate::output::ast::TemplateLiteralElement { @@ -956,7 +956,7 @@ pub fn convert_ir_expression<'a>( for expr in rtl.expressions.iter() { output_expressions.push(convert_ir_expression( - allocator, + &allocator, expr, expressions, root_xref, @@ -969,7 +969,7 @@ pub fn convert_ir_expression<'a>( expressions: output_expressions, source_span: rtl.source_span, }, - allocator, + &allocator, )) } @@ -977,17 +977,17 @@ pub fn convert_ir_expression<'a>( let inner = convert_ir_expression(allocator, &paren.expr, expressions, root_xref); OutputExpression::Parenthesized(Box::new_in( ParenthesizedExpr { - expr: Box::new_in(inner, allocator), + expr: Box::new_in(inner, &allocator), source_span: paren.source_span, }, - allocator, + &allocator, )) } // For any remaining IR expressions, return null placeholder _ => OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), } } @@ -1018,12 +1018,12 @@ fn convert_two_way_binding_set<'a>( // Wrap assignment in parentheses let parens_assignment = OutputExpression::Parenthesized(Box::new_in( - ParenthesizedExpr { expr: Box::new_in(assignment, allocator), source_span: None }, - allocator, + ParenthesizedExpr { expr: Box::new_in(assignment, &allocator), source_span: None }, + &allocator, )); // Create args using fresh clones for the instruction call - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(target); args.push(value); let instruction_call = @@ -1033,15 +1033,15 @@ fn convert_two_way_binding_set<'a>( OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Or, - lhs: Box::new_in(instruction_call, allocator), - rhs: Box::new_in(parens_assignment, allocator), + lhs: Box::new_in(instruction_call, &allocator), + rhs: Box::new_in(parens_assignment, &allocator), source_span: None, }, - allocator, + &allocator, )) } else { // For variable targets: just the instruction call - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(target); args.push(value); create_instruction_call_expr(allocator, Identifiers::TWO_WAY_BINDING_SET, args) @@ -1078,11 +1078,11 @@ fn create_assignment<'a>( OutputExpression::BinaryOperator(Box::new_in( BinaryOperatorExpr { operator: BinaryOperator::Assign, - lhs: Box::new_in(clone_output_expression(allocator, target), allocator), - rhs: Box::new_in(clone_output_expression(allocator, value), allocator), + lhs: Box::new_in(clone_output_expression(allocator, target), &allocator), + rhs: Box::new_in(clone_output_expression(allocator, value), &allocator), source_span: None, }, - allocator, + &allocator, )) } @@ -1094,11 +1094,11 @@ fn clone_output_expression<'a>( match expr { OutputExpression::ReadVar(rv) => OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: rv.name.clone(), source_span: rv.source_span }, - allocator, + &allocator, )), OutputExpression::ReadProp(rp) => OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(clone_output_expression(allocator, &rp.receiver), allocator), + receiver: Box::new_in(clone_output_expression(allocator, &rp.receiver), &allocator), name: rp.name.clone(), // Intentionally non-optional: `clone_output_expression` is only used to // build the write-back assignment `target = value` for two-way bindings @@ -1107,22 +1107,22 @@ fn clone_output_expression<'a>( optional: false, source_span: rp.source_span, }, - allocator, + &allocator, )), OutputExpression::ReadKey(rk) => OutputExpression::ReadKey(Box::new_in( ReadKeyExpr { - receiver: Box::new_in(clone_output_expression(allocator, &rk.receiver), allocator), - index: Box::new_in(clone_output_expression(allocator, &rk.index), allocator), + receiver: Box::new_in(clone_output_expression(allocator, &rk.receiver), &allocator), + index: Box::new_in(clone_output_expression(allocator, &rk.index), &allocator), // Non-optional for the same reason as the `ReadProp` arm above: this // clone only ever forms a two-way write-back assignment target. optional: false, source_span: rk.source_span, }, - allocator, + &allocator, )), OutputExpression::Literal(lit) => OutputExpression::Literal(Box::new_in( LiteralExpr { value: clone_literal_value(&lit.value), source_span: lit.source_span }, - allocator, + &allocator, )), // For all other types, use the built-in clone_in other => other.clone_in(allocator), diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/reify/mod.rs b/crates/oxc_angular_compiler/src/pipeline/phases/reify/mod.rs index aad4c15df..c0de5db04 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/reify/mod.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/reify/mod.rs @@ -56,7 +56,7 @@ fn convert_statement_ir_nodes<'a>( convert_output_expr_ir_nodes(allocator, &ret.value, expressions, root_xref); OutputStatement::Return(Box::new_in( ReturnStatement { value: converted_expr, source_span: ret.source_span }, - allocator, + &allocator, )) } OutputStatement::Expression(expr_stmt) => { @@ -64,7 +64,7 @@ fn convert_statement_ir_nodes<'a>( convert_output_expr_ir_nodes(allocator, &expr_stmt.expr, expressions, root_xref); OutputStatement::Expression(Box::new_in( ExpressionStatement { expr: converted_expr, source_span: expr_stmt.source_span }, - allocator, + &allocator, )) } // Other statement types pass through (they don't contain WrappedIrNode) @@ -77,7 +77,7 @@ fn convert_statement_ir_nodes<'a>( "Unexpected statement type in handler_ops. Only Return and Expression statements are expected." )); // Return the statement unchanged as a fallback - clone_output_statement(stmt, allocator) + clone_output_statement(stmt, &allocator) } } } @@ -166,7 +166,7 @@ pub fn reify(job: &mut ComponentCompilationJob<'_>) { { let ComponentCompilationJob { expressions, root, pool, .. } = job; let (create_stmts, update_stmts) = reify_view_to_stmts( - allocator, + &allocator, root, expressions, pool, @@ -184,7 +184,7 @@ pub fn reify(job: &mut ComponentCompilationJob<'_>) { if let Some(view) = views.get_mut(&xref) { let view = view.as_mut(); let (create_stmts, update_stmts) = reify_view_to_stmts( - allocator, + &allocator, view, expressions, pool, @@ -225,7 +225,7 @@ fn reify_view_to_stmts<'a>( // Reify update operations for op in view.update.iter() { let stmt = reify_update_op( - allocator, + &allocator, op, expressions, root_xref, @@ -260,7 +260,7 @@ fn reify_create_op<'a>( let local_refs_index = elem.local_refs_index; if is_dom_only { Some(create_dom_element_start_stmt( - allocator, + &allocator, &elem.tag, slot, elem.attributes, @@ -268,7 +268,7 @@ fn reify_create_op<'a>( )) } else { Some(create_element_start_stmt( - allocator, + &allocator, &elem.tag, slot, elem.attributes, @@ -281,7 +281,7 @@ fn reify_create_op<'a>( let local_refs_index = elem.local_refs_index; if is_dom_only { Some(create_dom_element_stmt( - allocator, + &allocator, &elem.tag, slot, elem.attributes, @@ -289,7 +289,7 @@ fn reify_create_op<'a>( )) } else { Some(create_element_stmt( - allocator, + &allocator, &elem.tag, slot, elem.attributes, @@ -330,7 +330,7 @@ fn reify_create_op<'a>( tmpl.template_kind == crate::ir::enums::TemplateKind::Block || is_dom_only; if use_dom_template { Some(create_dom_template_stmt( - allocator, + &allocator, slot, fn_name, decls, @@ -341,7 +341,7 @@ fn reify_create_op<'a>( )) } else { Some(create_template_stmt( - allocator, + &allocator, slot, fn_name, decls, @@ -354,7 +354,7 @@ fn reify_create_op<'a>( } CreateOp::Listener(listener) => { // Convert handler_ops to statements for the handler function - let mut handler_stmts = OxcVec::new_in(allocator); + let mut handler_stmts = OxcVec::new_in(&allocator); // Process handler_ops if present (new approach aligned with Angular) // These include Variable ops (e.g., RestoreView) added by save_restore_view phase @@ -362,7 +362,7 @@ fn reify_create_op<'a>( if let UpdateOp::Statement(stmt_op) = handler_op { // Convert WrappedIrNode expressions in the statement to output expressions let converted_stmt = convert_statement_ir_nodes( - allocator, + &allocator, &stmt_op.statement, expressions, root_xref, @@ -370,7 +370,7 @@ fn reify_create_op<'a>( ); handler_stmts.push(converted_stmt); } else if let Some(stmt) = reify_update_op( - allocator, + &allocator, handler_op, expressions, root_xref, @@ -391,7 +391,7 @@ fn reify_create_op<'a>( // Use return statement so the handler returns the result handler_stmts.push(OutputStatement::Return(Box::new_in( ReturnStatement { value: output_expr, source_span: None }, - allocator, + &allocator, ))); } @@ -407,7 +407,7 @@ fn reify_create_op<'a>( let use_capture = listener.host_listener && listener.is_animation_listener; if use_dom_listener { Some(create_dom_listener_stmt_with_handler( - allocator, + &allocator, &listener.name, handler_stmts, event_target, @@ -416,7 +416,7 @@ fn reify_create_op<'a>( )) } else { Some(create_listener_stmt_with_handler( - allocator, + &allocator, &listener.name, handler_stmts, event_target, @@ -445,7 +445,7 @@ fn reify_create_op<'a>( let attributes = std::mem::take(&mut proj.attributes); Some(create_projection_stmt( - allocator, + &allocator, slot, projection_slot_index, attributes, @@ -482,7 +482,7 @@ fn reify_create_op<'a>( if ctx.supports_conditional_create { // Angular 20+: Emit ɵɵconditionalCreate for the first branch in @if/@switch Some(create_conditional_create_stmt( - allocator, + &allocator, slot, fn_name, cond.decls, @@ -494,7 +494,7 @@ fn reify_create_op<'a>( } else { // Angular 19: Emit ɵɵtemplate instead (conditionalCreate doesn't exist) Some(create_template_stmt( - allocator, + &allocator, slot, fn_name, cond.decls, @@ -517,7 +517,7 @@ fn reify_create_op<'a>( // Generate track function if not already set by optimization phase // Ported from Angular's reifyTrackBy() in reify.ts let track_fn_expr = reify_track_by( - allocator, + &allocator, pool, expressions, root_xref, @@ -529,7 +529,7 @@ fn reify_create_op<'a>( ); Some(create_repeater_create_stmt_with_track_expr( - allocator, + &allocator, slot, fn_name, repeater.decls, @@ -571,7 +571,7 @@ fn reify_create_op<'a>( } }); Some(create_defer_stmt( - allocator, + &allocator, slot, defer.main_slot.map(|s| s.0), defer.resolver_fn.take(), @@ -590,7 +590,7 @@ fn reify_create_op<'a>( .as_ref() .map(|expr| convert_ir_expression(allocator, expr, expressions, root_xref)); Some(create_defer_on_stmt( - allocator, + &allocator, defer_on.trigger, defer_on.target_slot.map(|s| s.0), defer_on.target_slot_view_steps, @@ -603,7 +603,7 @@ fn reify_create_op<'a>( // Emit i18nStart instruction let slot = i18n.slot.map(|s| s.0).unwrap_or(0); Some(create_i18n_start_stmt( - allocator, + &allocator, slot, i18n.message_index, i18n.sub_template_index, @@ -637,13 +637,13 @@ fn reify_create_op<'a>( CreateOp::TwoWayListener(listener) => { // Emit twoWayListener instruction // Convert handler_ops to statements for the handler function - let mut handler_stmts = OxcVec::new_in(allocator); + let mut handler_stmts = OxcVec::new_in(&allocator); for handler_op in listener.handler_ops.iter() { // Handle Statement ops specially to convert WrappedIrNode expressions if let UpdateOp::Statement(stmt_op) = handler_op { // Convert WrappedIrNode expressions in the statement to output expressions let converted_stmt = convert_statement_ir_nodes( - allocator, + &allocator, &stmt_op.statement, expressions, root_xref, @@ -651,7 +651,7 @@ fn reify_create_op<'a>( ); handler_stmts.push(converted_stmt); } else if let Some(stmt) = reify_update_op( - allocator, + &allocator, handler_op, expressions, root_xref, @@ -664,7 +664,7 @@ fn reify_create_op<'a>( } } Some(create_two_way_listener_stmt( - allocator, + &allocator, &listener.name, handler_stmts, listener.handler_fn_name.as_ref(), @@ -672,10 +672,10 @@ fn reify_create_op<'a>( } CreateOp::AnimationListener(listener) => { // Emit syntheticHostListener instruction for animation listeners - let mut handler_stmts = OxcVec::new_in(allocator); + let mut handler_stmts = OxcVec::new_in(&allocator); for handler_op in listener.handler_ops.iter() { if let Some(stmt) = reify_update_op( - allocator, + &allocator, handler_op, expressions, root_xref, @@ -688,7 +688,7 @@ fn reify_create_op<'a>( } } Some(create_animation_listener_stmt( - allocator, + &allocator, &listener.name, listener.phase, handler_stmts, @@ -704,10 +704,10 @@ fn reify_create_op<'a>( CreateOp::Animation(anim) => { // Emit ɵɵanimateEnter or ɵɵanimateLeave instruction for animation bindings (Value kind) // The handler_ops contain a return statement with the expression - let mut handler_stmts = OxcVec::new_in(allocator); + let mut handler_stmts = OxcVec::new_in(&allocator); for handler_op in anim.handler_ops.iter() { if let Some(stmt) = reify_update_op( - allocator, + &allocator, handler_op, expressions, root_xref, @@ -720,7 +720,7 @@ fn reify_create_op<'a>( } } Some(create_animation_op_stmt( - allocator, + &allocator, anim.animation_kind, handler_stmts, anim.handler_fn_name.as_ref(), @@ -763,7 +763,7 @@ fn reify_create_op<'a>( if ctx.supports_conditional_create { // Angular 20+: Emit ɵɵconditionalBranchCreate for branches after the first Some(create_conditional_branch_create_stmt( - allocator, + &allocator, slot, fn_name, branch.decls, @@ -775,7 +775,7 @@ fn reify_create_op<'a>( } else { // Angular 19: Emit ɵɵtemplate instead (conditionalBranchCreate doesn't exist) Some(create_template_stmt( - allocator, + &allocator, slot, fn_name, branch.decls, @@ -828,14 +828,14 @@ fn reify_update_op<'a>( // Angular 19: Use ɵɵpropertyInterpolate*("name", s0, v0, s1, ..., [sanitizer]) let has_extra_args = prop.sanitizer.is_some(); let (interp_args, expr_count) = reify_interpolation( - allocator, + &allocator, &prop.expression, expressions, root_xref, has_extra_args, ); Some(create_property_interpolate_stmt( - allocator, + &allocator, &prop.name, interp_args, expr_count, @@ -848,14 +848,14 @@ fn reify_update_op<'a>( if is_dom_only && !is_animation { if supports_dom_property { Some(create_dom_property_stmt( - allocator, + &allocator, &prop.name, expr, prop.sanitizer.as_ref(), )) } else { Some(create_host_property_stmt( - allocator, + &allocator, &prop.name, expr, prop.sanitizer.as_ref(), @@ -865,7 +865,7 @@ fn reify_update_op<'a>( Some(create_aria_property_stmt(allocator, &prop.name, expr)) } else { Some(create_property_stmt_with_expr( - allocator, + &allocator, &prop.name, expr, prop.sanitizer.as_ref(), @@ -876,7 +876,7 @@ fn reify_update_op<'a>( UpdateOp::InterpolateText(interp) => { // Handle multiple interpolations like "{{a}} and {{b}}" let (args, expr_count) = reify_interpolation( - allocator, + &allocator, &interp.interpolation, expressions, root_xref, @@ -898,14 +898,14 @@ fn reify_update_op<'a>( // Angular 19: Use ɵɵstylePropInterpolate*("name", s0, v0, s1, ..., [unit]) let has_extra_args = style.unit.is_some(); let (interp_args, expr_count) = reify_interpolation( - allocator, + &allocator, &style.expression, expressions, root_xref, has_extra_args, ); Some(create_style_prop_interpolate_stmt( - allocator, + &allocator, &name, interp_args, expr_count, @@ -933,14 +933,14 @@ fn reify_update_op<'a>( // Angular 19: Use ɵɵattributeInterpolate*("name", s0, v0, s1, ..., [sanitizer], [ns]) let has_extra_args = attr.sanitizer.is_some() || attr.namespace.is_some(); let (interp_args, expr_count) = reify_interpolation( - allocator, + &allocator, &attr.expression, expressions, root_xref, has_extra_args, ); Some(create_attribute_interpolate_stmt( - allocator, + &allocator, &name, interp_args, expr_count, @@ -952,7 +952,7 @@ fn reify_update_op<'a>( let expr = convert_ir_expression(allocator, &attr.expression, expressions, root_xref); Some(create_attribute_stmt_with_expr( - allocator, + &allocator, &name, expr, attr.sanitizer.as_ref(), @@ -1002,7 +1002,7 @@ fn reify_update_op<'a>( if is_interpolation && !supports_value_interpolation { // Angular 19: Use ɵɵstyleMapInterpolate*(s0, v0, s1, ...) let (interp_args, expr_count) = reify_interpolation( - allocator, + &allocator, &style.expression, expressions, root_xref, @@ -1022,7 +1022,7 @@ fn reify_update_op<'a>( if is_interpolation && !supports_value_interpolation { // Angular 19: Use ɵɵclassMapInterpolate*(s0, v0, s1, ...) let (interp_args, expr_count) = reify_interpolation( - allocator, + &allocator, &class.expression, expressions, root_xref, @@ -1049,7 +1049,7 @@ fn reify_update_op<'a>( } else { // Angular 19: Use ɵɵhostProperty instead of ɵɵdomProperty Some(create_host_property_stmt( - allocator, + &allocator, &prop.name, expr, prop.sanitizer.as_ref(), @@ -1092,7 +1092,7 @@ fn reify_update_op<'a>( // or side-effectful expressions from variable optimization). // These may contain WrappedIrNode expressions that need to be converted. UpdateOp::Statement(stmt_op) => Some(convert_statement_ir_nodes( - allocator, + &allocator, &stmt_op.statement, expressions, root_xref, @@ -1118,12 +1118,12 @@ fn reify_interpolation<'a>( IrExpression::Interpolation(ir_interp) => { // Direct IR interpolation - interleave strings and expressions let expr_count = ir_interp.expressions.len(); - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // For single expression with empty surrounding strings, use simple form if expr_count == 1 && ir_interp.strings.iter().all(|s| s.is_empty()) { args.push(convert_ir_expression( - allocator, + &allocator, &ir_interp.expressions[0], expressions, root_xref, @@ -1136,7 +1136,7 @@ fn reify_interpolation<'a>( value: LiteralValue::String(ir_interp.strings[i].clone()), source_span: None, }, - allocator, + &allocator, ))); } args.push(convert_ir_expression(allocator, expr, expressions, root_xref)); @@ -1153,7 +1153,7 @@ fn reify_interpolation<'a>( value: LiteralValue::String(trailing.clone()), source_span: None, }, - allocator, + &allocator, ))); } } @@ -1167,12 +1167,12 @@ fn reify_interpolation<'a>( if let AngularExpression::Interpolation(ang_interp) = angular_expr { // Angular interpolation - interleave strings and expressions let expr_count = ang_interp.expressions.len(); - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // For single expression with empty surrounding strings, use simple form if expr_count == 1 && ang_interp.strings.iter().all(|s| s.is_empty()) { args.push(convert_angular_expression( - allocator, + &allocator, &ang_interp.expressions[0], root_xref, )); @@ -1184,7 +1184,7 @@ fn reify_interpolation<'a>( value: LiteralValue::String(ang_interp.strings[i].clone()), source_span: None, }, - allocator, + &allocator, ))); } args.push(convert_angular_expression(allocator, expr, root_xref)); @@ -1197,7 +1197,7 @@ fn reify_interpolation<'a>( value: LiteralValue::String(trailing.clone()), source_span: None, }, - allocator, + &allocator, ))); } } @@ -1206,14 +1206,14 @@ fn reify_interpolation<'a>( (args, expr_count) } else { // Not an interpolation - convert as single expression - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(convert_angular_expression(allocator, angular_expr, root_xref)); (args, 1) } } _ => { // Other expression types - convert directly - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(convert_ir_expression(allocator, interpolation, expressions, root_xref)); (args, 1) } @@ -1235,7 +1235,7 @@ pub fn reify_host(job: &mut HostBindingCompilationJob<'_>) { // Reify create operations (listeners) for op in job.root.create.iter() { let stmt = reify_host_create_op( - allocator, + &allocator, op, &job.expressions, root_xref, @@ -1252,7 +1252,7 @@ pub fn reify_host(job: &mut HostBindingCompilationJob<'_>) { // Host bindings use Full mode (not DomOnly) for op in job.root.update.iter() { let stmt = reify_update_op( - allocator, + &allocator, op, &job.expressions, root_xref, @@ -1282,13 +1282,13 @@ fn reify_host_create_op<'a>( match op { CreateOp::Listener(listener) => { // Convert handler_ops to statements for the handler function - let mut handler_stmts = OxcVec::new_in(allocator); + let mut handler_stmts = OxcVec::new_in(&allocator); for handler_op in listener.handler_ops.iter() { // Host bindings use Full mode (not DomOnly) if let UpdateOp::Statement(stmt_op) = handler_op { // Convert WrappedIrNode expressions in the statement to output expressions let converted_stmt = convert_statement_ir_nodes( - allocator, + &allocator, &stmt_op.statement, expressions, root_xref, @@ -1296,7 +1296,7 @@ fn reify_host_create_op<'a>( ); handler_stmts.push(converted_stmt); } else if let Some(stmt) = reify_update_op( - allocator, + &allocator, handler_op, expressions, root_xref, @@ -1317,7 +1317,7 @@ fn reify_host_create_op<'a>( // Use return statement so the handler returns the result handler_stmts.push(OutputStatement::Return(Box::new_in( ReturnStatement { value: output_expr, source_span: None }, - allocator, + &allocator, ))); } @@ -1334,7 +1334,7 @@ fn reify_host_create_op<'a>( let is_synthetic_host = listener.host_listener && listener.is_legacy_animation(); if is_synthetic_host { Some(create_synthetic_host_listener_stmt( - allocator, + &allocator, &listener.name, handler_stmts, listener.handler_fn_name.as_ref(), @@ -1350,7 +1350,7 @@ fn reify_host_create_op<'a>( // the relationship to the synthetic branch explicit. let use_capture = listener.host_listener && listener.is_animation_listener; Some(create_listener_stmt_with_handler( - allocator, + &allocator, &listener.name, handler_stmts, event_target, @@ -1362,11 +1362,11 @@ fn reify_host_create_op<'a>( } CreateOp::AnimationListener(listener) => { // Emit syntheticHostListener for animation listeners - let mut handler_stmts = OxcVec::new_in(allocator); + let mut handler_stmts = OxcVec::new_in(&allocator); for handler_op in listener.handler_ops.iter() { // Host bindings use Full mode (not DomOnly) if let Some(stmt) = reify_update_op( - allocator, + &allocator, handler_op, expressions, root_xref, @@ -1379,7 +1379,7 @@ fn reify_host_create_op<'a>( } } Some(create_animation_listener_stmt( - allocator, + &allocator, &listener.name, listener.phase, handler_stmts, @@ -1428,15 +1428,15 @@ fn reify_track_by<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: fn_name.clone(), optional: false, source_span: None, }, - allocator, + &allocator, )); } // Handle property access like "ctx.trackByFn" or "componentInstance().fn" @@ -1466,32 +1466,32 @@ fn reify_track_by<'a>( name: Ident::from("i0"), source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: call_name, optional: false, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), - args: OxcVec::new_in(allocator), + args: OxcVec::new_in(&allocator), pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: prop_name, optional: false, source_span: None, }, - allocator, + &allocator, )); } // Simple property access like "ctx.trackByFn" @@ -1500,25 +1500,25 @@ fn reify_track_by<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: receiver_name, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: prop_name, optional: false, source_span: None, }, - allocator, + &allocator, )); } return OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: fn_name.clone(), source_span: None }, - allocator, + &allocator, )); } // Create the track function with params ($index, $item) - let mut params = OxcVec::with_capacity_in(2, allocator); + let mut params = OxcVec::with_capacity_in(2, &allocator); params.push(FnParam { name: Ident::from("$index") }); params.push(FnParam { name: Ident::from("$item") }); @@ -1535,12 +1535,12 @@ fn reify_track_by<'a>( // : o.arrowFn(params, statements[0].value); // Reify each op in track_by_ops into output statements - let mut statements = OxcVec::new_in(allocator); + let mut statements = OxcVec::new_in(&allocator); for track_op in track_ops.iter() { // Track-by functions don't contain property/attribute interpolation, // so version flags don't matter here. if let Some(stmt) = reify_update_op( - allocator, + &allocator, track_op, expressions, root_xref, @@ -1565,7 +1565,7 @@ fn reify_track_by<'a>( if use_function { OutputExpression::Function(Box::new_in( FunctionExpr { name: None, params, statements, source_span: None }, - allocator, + &allocator, )) } else { // Single return statement → extract value for arrow function body @@ -1580,17 +1580,17 @@ fn reify_track_by<'a>( )); return OutputExpression::Function(Box::new_in( FunctionExpr { name: None, params, statements, source_span: None }, - allocator, + &allocator, )); }; OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { params, - body: ArrowFunctionBody::Expression(Box::new_in(return_value, allocator)), + body: ArrowFunctionBody::Expression(Box::new_in(return_value, &allocator)), source_span: None, }, - allocator, + &allocator, )) } } else { @@ -1602,24 +1602,24 @@ fn reify_track_by<'a>( let track_body = convert_ir_expression(allocator, track, expressions, root_xref); if uses_component_instance { - let mut stmts = OxcVec::with_capacity_in(1, allocator); + let mut stmts = OxcVec::with_capacity_in(1, &allocator); stmts.push(OutputStatement::Return(Box::new_in( ReturnStatement { value: track_body, source_span: None }, - allocator, + &allocator, ))); OutputExpression::Function(Box::new_in( FunctionExpr { name: None, params, statements: stmts, source_span: None }, - allocator, + &allocator, )) } else { OutputExpression::ArrowFunction(Box::new_in( ArrowFunctionExpr { params, - body: ArrowFunctionBody::Expression(Box::new_in(track_body, allocator)), + body: ArrowFunctionBody::Expression(Box::new_in(track_body, &allocator)), source_span: None, }, - allocator, + &allocator, )) } }; diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/bindings.rs b/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/bindings.rs index 0accdd06c..49854e565 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/bindings.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/bindings.rs @@ -54,15 +54,15 @@ fn create_sanitizer_expr<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: sanitizer.clone(), optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -73,10 +73,10 @@ pub fn create_property_stmt_with_expr<'a>( value: OutputExpression<'a>, sanitizer: Option<&Ident<'a>>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); args.push(value); if let Some(san) = sanitizer { @@ -94,10 +94,10 @@ pub fn create_aria_property_stmt<'a>( name: &Ident<'a>, value: OutputExpression<'a>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); args.push(value); create_instruction_call_stmt(allocator, Identifiers::ARIA_PROPERTY, args) @@ -109,10 +109,10 @@ pub fn create_binding_stmt_with_expr<'a>( name: &Ident<'a>, value: OutputExpression<'a>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); args.push(value); // This should be specialized by binding_specialization phase @@ -126,17 +126,17 @@ pub fn create_style_prop_stmt_with_expr<'a>( value: OutputExpression<'a>, unit: Option<&Ident<'a>>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); args.push(value); // Add unit suffix if present if let Some(unit_val) = unit { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(unit_val.clone()), source_span: None }, - allocator, + &allocator, ))); } create_instruction_call_stmt(allocator, Identifiers::STYLE_PROP, args) @@ -148,10 +148,10 @@ pub fn create_class_prop_stmt_with_expr<'a>( name: &Ident<'a>, value: OutputExpression<'a>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); args.push(value); create_instruction_call_stmt(allocator, Identifiers::CLASS_PROP, args) @@ -168,10 +168,10 @@ pub fn create_attribute_stmt_with_expr<'a>( sanitizer: Option<&Ident<'a>>, namespace: Option<&Ident<'a>>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); args.push(value); // Add sanitizer if present, or null if namespace is present @@ -181,7 +181,7 @@ pub fn create_attribute_stmt_with_expr<'a>( } else { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } } @@ -189,7 +189,7 @@ pub fn create_attribute_stmt_with_expr<'a>( if let Some(ns) = namespace { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(ns.clone()), source_span: None }, - allocator, + &allocator, ))); } create_instruction_call_stmt(allocator, Identifiers::ATTRIBUTE, args) @@ -202,10 +202,10 @@ pub fn create_two_way_property_stmt<'a>( value: OutputExpression<'a>, sanitizer: Option<&Ident<'a>>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); args.push(value); if let Some(san) = sanitizer { @@ -226,10 +226,10 @@ pub fn create_dom_property_stmt<'a>( sanitizer: Option<&Ident<'a>>, ) -> OutputStatement<'a> { let remapped_name = remap_dom_property(name); - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(remapped_name), source_span: None }, - allocator, + &allocator, ))); args.push(value); if let Some(san) = sanitizer { @@ -243,7 +243,7 @@ pub fn create_style_map_stmt<'a>( allocator: &'a oxc_allocator::Allocator, value: OutputExpression<'a>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(value); create_instruction_call_stmt(allocator, Identifiers::STYLE_MAP, args) } @@ -253,7 +253,7 @@ pub fn create_class_map_stmt<'a>( allocator: &'a oxc_allocator::Allocator, value: OutputExpression<'a>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(value); create_instruction_call_stmt(allocator, Identifiers::CLASS_MAP, args) } @@ -294,11 +294,11 @@ pub fn create_property_interpolate_stmt<'a>( // and sanitizer). Otherwise a singleton like `{{url}}` with a sanitizer would // mis-select propertyInterpolate1 instead of propertyInterpolate. let interp_args_len = interp_args.len(); - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // First arg: property name args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); // Then interleaved strings and expressions for arg in interp_args { @@ -335,11 +335,11 @@ pub fn create_attribute_interpolate_stmt<'a>( ) -> OutputStatement<'a> { // Save length before consuming — same reason as create_property_interpolate_stmt. let interp_args_len = interp_args.len(); - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // First arg: attribute name args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); // Then interleaved strings and expressions for arg in interp_args { @@ -352,7 +352,7 @@ pub fn create_attribute_interpolate_stmt<'a>( } else { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } } @@ -360,7 +360,7 @@ pub fn create_attribute_interpolate_stmt<'a>( if let Some(ns) = namespace { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(ns.clone()), source_span: None }, - allocator, + &allocator, ))); } let instruction = if expr_count == 1 && interp_args_len == 1 { @@ -381,10 +381,10 @@ pub fn create_host_property_stmt<'a>( sanitizer: Option<&Ident<'a>>, ) -> OutputStatement<'a> { let remapped_name = remap_dom_property(name); - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(remapped_name), source_span: None }, - allocator, + &allocator, ))); args.push(value); if let Some(san) = sanitizer { @@ -407,11 +407,11 @@ pub fn create_style_prop_interpolate_stmt<'a>( expr_count: usize, unit: Option<&Ident<'a>>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // First arg: style property name args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); // Then interleaved strings and expressions for arg in interp_args { @@ -421,7 +421,7 @@ pub fn create_style_prop_interpolate_stmt<'a>( if let Some(unit_val) = unit { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(unit_val.clone()), source_span: None }, - allocator, + &allocator, ))); } let instruction = get_style_prop_interpolate_instruction(expr_count); diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/control_flow.rs b/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/control_flow.rs index c1d09deb2..700643b85 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/control_flow.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/control_flow.rs @@ -34,26 +34,26 @@ pub fn create_conditional_create_stmt<'a>( attributes: Option, local_refs_index: Option, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // Slot index args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(slot as f64), source_span: None }, - allocator, + &allocator, ))); // Template function reference if let Some(name) = fn_name { args.push(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name, source_span: None }, - allocator, + &allocator, ))); } else { // Fallback placeholder let placeholder_str = allocator.alloc_str(&format!("_c{slot}")); args.push(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(placeholder_str), source_span: None }, - allocator, + &allocator, ))); } @@ -61,26 +61,26 @@ pub fn create_conditional_create_stmt<'a>( let decl_count = decls.unwrap_or(0); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(decl_count as f64), source_span: None }, - allocator, + &allocator, ))); // vars let var_count = vars.unwrap_or(0); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(var_count as f64), source_span: None }, - allocator, + &allocator, ))); // tag (string literal or null) if let Some(tag_name) = tag { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(tag_name.clone()), source_span: None }, - allocator, + &allocator, ))); } else { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } @@ -88,12 +88,12 @@ pub fn create_conditional_create_stmt<'a>( if let Some(const_index) = attributes { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(const_index as f64), source_span: None }, - allocator, + &allocator, ))); } else { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } @@ -103,22 +103,22 @@ pub fn create_conditional_create_stmt<'a>( if let Some(refs_idx) = local_refs_index { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(refs_idx as f64), source_span: None }, - allocator, + &allocator, ))); args.push(OutputExpression::ReadProp(Box::new_in( ReadPropExpr { receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(Identifiers::TEMPLATE_REF_EXTRACTOR), optional: false, source_span: None, }, - allocator, + &allocator, ))); } @@ -144,7 +144,7 @@ pub fn create_conditional_update_stmt<'a>( test: OutputExpression<'a>, context_value: Option>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(test); if let Some(ctx) = context_value { args.push(ctx); @@ -175,26 +175,26 @@ pub fn create_conditional_branch_create_stmt<'a>( attributes: Option, local_refs_index: Option, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // Slot index args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(slot as f64), source_span: None }, - allocator, + &allocator, ))); // Template function reference if let Some(name) = fn_name { args.push(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name, source_span: None }, - allocator, + &allocator, ))); } else { // Fallback placeholder let placeholder_str = allocator.alloc_str(&format!("_c{slot}")); args.push(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(placeholder_str), source_span: None }, - allocator, + &allocator, ))); } @@ -202,26 +202,26 @@ pub fn create_conditional_branch_create_stmt<'a>( let decl_count = decls.unwrap_or(0); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(decl_count as f64), source_span: None }, - allocator, + &allocator, ))); // vars let var_count = vars.unwrap_or(0); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(var_count as f64), source_span: None }, - allocator, + &allocator, ))); // tag (string literal or null) if let Some(tag_name) = tag { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(tag_name.clone()), source_span: None }, - allocator, + &allocator, ))); } else { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } @@ -229,12 +229,12 @@ pub fn create_conditional_branch_create_stmt<'a>( if let Some(const_index) = attributes { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(const_index as f64), source_span: None }, - allocator, + &allocator, ))); } else { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } @@ -244,22 +244,22 @@ pub fn create_conditional_branch_create_stmt<'a>( if let Some(refs_idx) = local_refs_index { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(refs_idx as f64), source_span: None }, - allocator, + &allocator, ))); args.push(OutputExpression::ReadProp(Box::new_in( ReadPropExpr { receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(Identifiers::TEMPLATE_REF_EXTRACTOR), optional: false, source_span: None, }, - allocator, + &allocator, ))); } @@ -285,7 +285,7 @@ pub fn create_conditional_branch_create_stmt<'a>( pub fn create_control_create_stmt<'a>( allocator: &'a oxc_allocator::Allocator, ) -> OutputStatement<'a> { - let args = OxcVec::new_in(allocator); + let args = OxcVec::new_in(&allocator); create_instruction_call_stmt(allocator, Identifiers::CONTROL_CREATE, args) } @@ -294,11 +294,11 @@ pub fn create_advance_stmt<'a>( allocator: &'a oxc_allocator::Allocator, delta: u32, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); if delta > 1 { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(delta as f64), source_span: None }, - allocator, + &allocator, ))); } create_instruction_call_stmt(allocator, Identifiers::ADVANCE, args) @@ -309,7 +309,7 @@ pub fn create_repeater_stmt<'a>( allocator: &'a oxc_allocator::Allocator, collection: OutputExpression<'a>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(collection); create_instruction_call_stmt(allocator, Identifiers::REPEATER, args) } @@ -337,26 +337,26 @@ pub fn create_repeater_create_stmt_with_track_expr<'a>( empty_tag: Option<&Ident<'a>>, empty_attributes: Option, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // Slot index args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(slot as f64), source_span: None }, - allocator, + &allocator, ))); // Template function reference if let Some(name) = fn_name { args.push(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name, source_span: None }, - allocator, + &allocator, ))); } else { // Fallback placeholder let placeholder_str = allocator.alloc_str(&format!("_r{slot}")); args.push(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(placeholder_str), source_span: None }, - allocator, + &allocator, ))); } @@ -364,25 +364,25 @@ pub fn create_repeater_create_stmt_with_track_expr<'a>( let decls = body_decl_count.unwrap_or(0); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(decls as f64), source_span: None }, - allocator, + &allocator, ))); // vars: Use the body view's variable count let vars = body_var_count.unwrap_or(0); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(vars as f64), source_span: None }, - allocator, + &allocator, ))); // Tag (from control flow insertion point, for content projection) if let Some(tag_name) = tag { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(tag_name.clone()), source_span: None }, - allocator, + &allocator, ))); } else { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } @@ -390,12 +390,12 @@ pub fn create_repeater_create_stmt_with_track_expr<'a>( if let Some(const_index) = attributes { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(const_index as f64), source_span: None }, - allocator, + &allocator, ))); } else { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } @@ -410,14 +410,14 @@ pub fn create_repeater_create_stmt_with_track_expr<'a>( value: LiteralValue::Boolean(uses_component_instance), source_span: None, }, - allocator, + &allocator, ))); // Empty view arguments (optional) if let Some(empty_name) = empty_fn_name { args.push(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: empty_name, source_span: None }, - allocator, + &allocator, ))); // Empty decls let empty_decl_val = empty_decls.unwrap_or(0); @@ -426,7 +426,7 @@ pub fn create_repeater_create_stmt_with_track_expr<'a>( value: LiteralValue::Number(empty_decl_val as f64), source_span: None, }, - allocator, + &allocator, ))); // Empty vars let empty_var_val = empty_vars.unwrap_or(0); @@ -435,7 +435,7 @@ pub fn create_repeater_create_stmt_with_track_expr<'a>( value: LiteralValue::Number(empty_var_val as f64), source_span: None, }, - allocator, + &allocator, ))); // Empty tag (from control flow insertion point for @empty block) @@ -446,12 +446,12 @@ pub fn create_repeater_create_stmt_with_track_expr<'a>( value: LiteralValue::String(empty_tag_name.clone()), source_span: None, }, - allocator, + &allocator, ))); } else { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } } @@ -463,7 +463,7 @@ pub fn create_repeater_create_stmt_with_track_expr<'a>( value: LiteralValue::Number(empty_const_index as f64), source_span: None, }, - allocator, + &allocator, ))); } } @@ -487,7 +487,7 @@ pub fn create_variable_decl_stmt_with_value<'a>( leading_comment: None, source_span: None, }, - allocator, + &allocator, )) } @@ -496,10 +496,10 @@ pub fn create_declare_let_stmt<'a>( allocator: &'a oxc_allocator::Allocator, slot: u32, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(slot as f64), source_span: None }, - allocator, + &allocator, ))); create_instruction_call_stmt(allocator, Identifiers::DECLARE_LET, args) } diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/defer.rs b/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/defer.rs index 5a6f272bb..7ce4c9013 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/defer.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/defer.rs @@ -36,24 +36,24 @@ pub fn create_defer_stmt<'a>( placeholder_config: Option, flags: Option, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // Slot index args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(slot as f64), source_span: None }, - allocator, + &allocator, ))); // Main slot if let Some(ms) = main_slot { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(ms as f64), source_span: None }, - allocator, + &allocator, ))); } else { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number((slot + 1) as f64), source_span: None }, - allocator, + &allocator, ))); } @@ -63,7 +63,7 @@ pub fn create_defer_stmt<'a>( } else { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } @@ -71,12 +71,12 @@ pub fn create_defer_stmt<'a>( if let Some(ls) = loading_slot { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(ls as f64), source_span: None }, - allocator, + &allocator, ))); } else { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } @@ -84,12 +84,12 @@ pub fn create_defer_stmt<'a>( if let Some(ps) = placeholder_slot { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(ps as f64), source_span: None }, - allocator, + &allocator, ))); } else { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } @@ -97,12 +97,12 @@ pub fn create_defer_stmt<'a>( if let Some(es) = error_slot { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(es as f64), source_span: None }, - allocator, + &allocator, ))); } else { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } @@ -110,12 +110,12 @@ pub fn create_defer_stmt<'a>( if let Some(config_idx) = loading_config { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(config_idx as f64), source_span: None }, - allocator, + &allocator, ))); } else { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } @@ -123,12 +123,12 @@ pub fn create_defer_stmt<'a>( if let Some(config_idx) = placeholder_config { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(config_idx as f64), source_span: None }, - allocator, + &allocator, ))); } else { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } @@ -142,20 +142,20 @@ pub fn create_defer_stmt<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(Identifiers::DEFER_ENABLE_TIMER_SCHEDULING), optional: false, source_span: None, }, - allocator, + &allocator, ))); } else { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } @@ -163,12 +163,12 @@ pub fn create_defer_stmt<'a>( if let Some(f) = flags { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(f as f64), source_span: None }, - allocator, + &allocator, ))); } else { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } @@ -203,7 +203,7 @@ pub fn create_defer_on_stmt<'a>( delay: Option, options: Option>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // Build arguments based on trigger kind, matching Angular's reify.ts behavior match trigger { @@ -215,7 +215,7 @@ pub fn create_defer_on_stmt<'a>( if let Some(d) = delay { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(d), source_span: None }, - allocator, + &allocator, ))); } } @@ -231,11 +231,11 @@ pub fn create_defer_on_stmt<'a>( args.push(match target_slot { Some(slot) => OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(slot as f64), source_span: None }, - allocator, + &allocator, )), None => OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), }); @@ -246,13 +246,13 @@ pub fn create_defer_on_stmt<'a>( value: LiteralValue::Number(view_steps as f64), source_span: None, }, - allocator, + &allocator, ))); } else if options.is_some() { // Need to push null placeholder if options follow args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } @@ -269,11 +269,11 @@ pub fn create_defer_on_stmt<'a>( args.push(match target_slot { Some(slot) => OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(slot as f64), source_span: None }, - allocator, + &allocator, )), None => OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, )), }); @@ -284,7 +284,7 @@ pub fn create_defer_on_stmt<'a>( value: LiteralValue::Number(view_steps as f64), source_span: None, }, - allocator, + &allocator, ))); } } @@ -360,7 +360,7 @@ pub fn create_defer_when_stmt<'a>( modifier: DeferOpModifierKind, condition: OutputExpression<'a>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(condition); let instruction = match modifier { diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/elements.rs b/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/elements.rs index 906cc4efb..e1e0b23de 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/elements.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/elements.rs @@ -21,16 +21,16 @@ pub fn create_element_args<'a>( attributes: Option, local_refs_index: Option, ) -> OxcVec<'a, OutputExpression<'a>> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // Slot index args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(slot as f64), source_span: None }, - allocator, + &allocator, ))); // Tag name args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(tag.clone()), source_span: None }, - allocator, + &allocator, ))); // If localRefIndex is present, we need both constIndex and localRefIndex if let Some(refs_idx) = local_refs_index { @@ -38,24 +38,24 @@ pub fn create_element_args<'a>( if let Some(attr_idx) = attributes { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(attr_idx as f64), source_span: None }, - allocator, + &allocator, ))); } else { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } // Push localRefIndex args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(refs_idx as f64), source_span: None }, - allocator, + &allocator, ))); } else if let Some(attr_idx) = attributes { // Only constIndex, no localRefIndex args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(attr_idx as f64), source_span: None }, - allocator, + &allocator, ))); } args @@ -87,7 +87,7 @@ pub fn create_element_stmt<'a>( /// Creates an ɵɵelementEnd() call statement. pub fn create_element_end_stmt<'a>(allocator: &'a oxc_allocator::Allocator) -> OutputStatement<'a> { - create_instruction_call_stmt(allocator, Identifiers::ELEMENT_END, OxcVec::new_in(allocator)) + create_instruction_call_stmt(allocator, Identifiers::ELEMENT_END, OxcVec::new_in(&allocator)) } // ============================================================================= @@ -130,7 +130,11 @@ pub fn create_dom_element_stmt<'a>( pub fn create_dom_element_end_stmt<'a>( allocator: &'a oxc_allocator::Allocator, ) -> OutputStatement<'a> { - create_instruction_call_stmt(allocator, Identifiers::DOM_ELEMENT_END, OxcVec::new_in(allocator)) + create_instruction_call_stmt( + allocator, + Identifiers::DOM_ELEMENT_END, + OxcVec::new_in(&allocator), + ) } /// Creates an ɵɵtext() call statement. @@ -143,10 +147,10 @@ pub fn create_text_stmt<'a>( slot: u32, initial_value: Option<&'a str>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(slot as f64), source_span: None }, - allocator, + &allocator, ))); // Add initial text value if present and non-empty @@ -154,7 +158,7 @@ pub fn create_text_stmt<'a>( if !value.is_empty() { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(value.into()), source_span: None }, - allocator, + &allocator, ))); } } @@ -183,7 +187,7 @@ pub fn create_template_stmt<'a>( local_refs_index: Option, ) -> OutputStatement<'a> { let args = create_template_args( - allocator, + &allocator, slot, fn_name, decls, @@ -209,26 +213,26 @@ fn create_template_args<'a>( attributes: Option, local_refs_index: Option, ) -> OxcVec<'a, OutputExpression<'a>> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // Slot index args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(slot as f64), source_span: None }, - allocator, + &allocator, ))); // Template function reference if let Some(name) = fn_name { args.push(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name, source_span: None }, - allocator, + &allocator, ))); } else { let placeholder_str = allocator.alloc_str(&format!("_r{slot}")); let placeholder = Ident::from(placeholder_str); args.push(OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: placeholder, source_span: None }, - allocator, + &allocator, ))); } @@ -236,26 +240,26 @@ fn create_template_args<'a>( let decl_count = decls.unwrap_or(0); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(decl_count as f64), source_span: None }, - allocator, + &allocator, ))); // Variable count let var_count = vars.unwrap_or(0); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(var_count as f64), source_span: None }, - allocator, + &allocator, ))); // Tag (string | null) if let Some(t) = tag { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(t.clone()), source_span: None }, - allocator, + &allocator, ))); } else { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } @@ -263,12 +267,12 @@ fn create_template_args<'a>( if let Some(attr_idx) = attributes { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(attr_idx as f64), source_span: None }, - allocator, + &allocator, ))); } else { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } @@ -276,7 +280,7 @@ fn create_template_args<'a>( if let Some(refs_idx) = local_refs_index { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(refs_idx as f64), source_span: None }, - allocator, + &allocator, ))); // Add templateRefExtractor: i0.ɵɵtemplateRefExtractor args.push(OutputExpression::ReadProp(Box::new_in( @@ -284,15 +288,15 @@ fn create_template_args<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(Identifiers::TEMPLATE_REF_EXTRACTOR), optional: false, source_span: None, }, - allocator, + &allocator, ))); } @@ -334,7 +338,7 @@ pub fn create_dom_template_stmt<'a>( local_refs_index: Option, ) -> OutputStatement<'a> { let args = create_template_args( - allocator, + &allocator, slot, fn_name, decls, @@ -356,11 +360,11 @@ fn create_container_args<'a>( attributes: Option, local_refs_index: Option, ) -> OxcVec<'a, OutputExpression<'a>> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // Slot index args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(slot as f64), source_span: None }, - allocator, + &allocator, ))); // If localRefIndex is present, we need both constIndex and localRefIndex if let Some(refs_idx) = local_refs_index { @@ -368,24 +372,24 @@ fn create_container_args<'a>( if let Some(attr_idx) = attributes { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(attr_idx as f64), source_span: None }, - allocator, + &allocator, ))); } else { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } // Push localRefIndex args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(refs_idx as f64), source_span: None }, - allocator, + &allocator, ))); } else if let Some(attr_idx) = attributes { // Only constIndex, no localRefIndex args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(attr_idx as f64), source_span: None }, - allocator, + &allocator, ))); } args @@ -407,9 +411,9 @@ pub fn create_container_end_stmt<'a>( allocator: &'a oxc_allocator::Allocator, ) -> OutputStatement<'a> { create_instruction_call_stmt( - allocator, + &allocator, Identifiers::ELEMENT_CONTAINER_END, - OxcVec::new_in(allocator), + OxcVec::new_in(&allocator), ) } @@ -461,9 +465,9 @@ pub fn create_dom_container_end_stmt<'a>( allocator: &'a oxc_allocator::Allocator, ) -> OutputStatement<'a> { create_instruction_call_stmt( - allocator, + &allocator, Identifiers::DOM_ELEMENT_CONTAINER_END, - OxcVec::new_in(allocator), + OxcVec::new_in(&allocator), ) } @@ -485,12 +489,12 @@ pub fn create_projection_stmt<'a>( fallback_decls: Option, fallback_vars: Option, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // First arg is always the slot args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(slot as f64), source_span: None }, - allocator, + &allocator, ))); // Only add additional args if needed (projectionSlotIndex !== 0 || attributes || fallback) @@ -501,7 +505,7 @@ pub fn create_projection_stmt<'a>( value: LiteralValue::Number(projection_slot_index as f64), source_span: None, }, - allocator, + &allocator, ))); // Add attributes if present @@ -515,14 +519,14 @@ pub fn create_projection_stmt<'a>( if args.len() == 2 { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } // Add fallback function name as variable reference args.push(OutputExpression::ReadVar(Box::new_in( crate::output::ast::ReadVarExpr { name: fn_name.into(), source_span: None }, - allocator, + &allocator, ))); // Add fallback decls @@ -531,7 +535,7 @@ pub fn create_projection_stmt<'a>( value: LiteralValue::Number(fallback_decls.unwrap_or(0) as f64), source_span: None, }, - allocator, + &allocator, ))); // Add fallback vars @@ -540,7 +544,7 @@ pub fn create_projection_stmt<'a>( value: LiteralValue::Number(fallback_vars.unwrap_or(0) as f64), source_span: None, }, - allocator, + &allocator, ))); } } @@ -558,5 +562,5 @@ pub fn create_namespace_stmt<'a>( crate::ir::enums::Namespace::Svg => Identifiers::NAMESPACE_SVG, crate::ir::enums::Namespace::Math => Identifiers::NAMESPACE_MATH_ML, }; - create_instruction_call_stmt(allocator, instruction, OxcVec::new_in(allocator)) + create_instruction_call_stmt(allocator, instruction, OxcVec::new_in(&allocator)) } diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/i18n.rs b/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/i18n.rs index 4822e972e..90af94585 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/i18n.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/i18n.rs @@ -21,26 +21,26 @@ pub fn create_i18n_start_stmt<'a>( message_index: Option, sub_template_index: Option, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // First arg: slot index args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(slot as f64), source_span: None }, - allocator, + &allocator, ))); // Second arg: message index (required) if let Some(msg_idx) = message_index { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(msg_idx as f64), source_span: None }, - allocator, + &allocator, ))); // Third arg: sub-template index (optional) if let Some(sub_idx) = sub_template_index { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(sub_idx as f64), source_span: None }, - allocator, + &allocator, ))); } } @@ -58,26 +58,26 @@ pub fn create_i18n_stmt<'a>( message_index: Option, sub_template_index: Option, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // First arg: slot index args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(slot as f64), source_span: None }, - allocator, + &allocator, ))); // Second arg: message index (required) if let Some(msg_idx) = message_index { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(msg_idx as f64), source_span: None }, - allocator, + &allocator, ))); // Third arg: sub-template index (optional) if let Some(sub_idx) = sub_template_index { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(sub_idx as f64), source_span: None }, - allocator, + &allocator, ))); } } @@ -87,7 +87,7 @@ pub fn create_i18n_stmt<'a>( /// Creates an ɵɵi18nEnd() call statement. pub fn create_i18n_end_stmt<'a>(allocator: &'a oxc_allocator::Allocator) -> OutputStatement<'a> { - create_instruction_call_stmt(allocator, Identifiers::I18N_END, OxcVec::new_in(allocator)) + create_instruction_call_stmt(allocator, Identifiers::I18N_END, OxcVec::new_in(&allocator)) } /// Creates an ɵɵi18nExp() call statement. @@ -95,7 +95,7 @@ pub fn create_i18n_exp_stmt<'a>( allocator: &'a oxc_allocator::Allocator, value: OutputExpression<'a>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(value); create_instruction_call_stmt(allocator, Identifiers::I18N_EXP, args) } @@ -105,10 +105,10 @@ pub fn create_i18n_apply_stmt<'a>( allocator: &'a oxc_allocator::Allocator, slot: u32, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(slot as f64), source_span: None }, - allocator, + &allocator, ))); create_instruction_call_stmt(allocator, Identifiers::I18N_APPLY, args) } @@ -125,18 +125,18 @@ pub fn create_i18n_attributes_stmt<'a>( slot: u32, attrs_config_index: u32, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // First arg: slot index args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(slot as f64), source_span: None }, - allocator, + &allocator, ))); // Second arg: attrs config index (index into consts array) args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(attrs_config_index as f64), source_span: None }, - allocator, + &allocator, ))); create_instruction_call_stmt(allocator, Identifiers::I18N_ATTRIBUTES, args) diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/misc.rs b/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/misc.rs index 47dcd33d6..5c013dbbe 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/misc.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/reify/statements/misc.rs @@ -62,15 +62,15 @@ pub fn create_listener_stmt_with_handler<'a>( handler_fn_name: Option<&Ident<'a>>, consumes_dollar_event: bool, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // Event name args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); // Handler function: function name($event) { ... } or function name() { ... } - let mut params = OxcVec::new_in(allocator); + let mut params = OxcVec::new_in(&allocator); if consumes_dollar_event { params.push(FnParam { name: Ident::from("$event") }); } @@ -82,7 +82,7 @@ pub fn create_listener_stmt_with_handler<'a>( statements: handler_stmts, source_span: None, }, - allocator, + &allocator, )); args.push(handler_fn); @@ -97,21 +97,21 @@ pub fn create_listener_stmt_with_handler<'a>( name: Ident::from("i0"), source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(target.resolver_instruction()), optional: false, source_span: None, }, - allocator, + &allocator, ))); } else if use_capture { // If we need use_capture but no event_target, add null as placeholder args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Null, source_span: None }, - allocator, + &allocator, ))); } @@ -119,7 +119,7 @@ pub fn create_listener_stmt_with_handler<'a>( if use_capture { args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(true), source_span: None }, - allocator, + &allocator, ))); } @@ -141,15 +141,15 @@ pub fn create_dom_listener_stmt_with_handler<'a>( handler_fn_name: Option<&Ident<'a>>, consumes_dollar_event: bool, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // Event name args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); // Handler function: function name($event) { ... } or function name() { ... } - let mut params = OxcVec::new_in(allocator); + let mut params = OxcVec::new_in(&allocator); if consumes_dollar_event { params.push(FnParam { name: Ident::from("$event") }); } @@ -161,7 +161,7 @@ pub fn create_dom_listener_stmt_with_handler<'a>( statements: handler_stmts, source_span: None, }, - allocator, + &allocator, )); args.push(handler_fn); @@ -176,15 +176,15 @@ pub fn create_dom_listener_stmt_with_handler<'a>( name: Ident::from("i0"), source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(target.resolver_instruction()), optional: false, source_span: None, }, - allocator, + &allocator, ))); } @@ -200,16 +200,16 @@ pub fn create_two_way_listener_stmt<'a>( handler_stmts: OxcVec<'a, OutputStatement<'a>>, handler_fn_name: Option<&Ident<'a>>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // Event name (typically "{property}Change") args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); // Handler function: function name($event) { ... } // Two-way listeners always consume $event since they need the new value - let mut params = OxcVec::new_in(allocator); + let mut params = OxcVec::new_in(&allocator); params.push(FnParam { name: Ident::from("$event") }); let handler_fn = OutputExpression::Function(Box::new_in( @@ -219,7 +219,7 @@ pub fn create_two_way_listener_stmt<'a>( statements: handler_stmts, source_span: None, }, - allocator, + &allocator, )); args.push(handler_fn); @@ -238,12 +238,12 @@ pub fn create_synthetic_host_listener_stmt<'a>( handler_fn_name: Option<&Ident<'a>>, consumes_dollar_event: bool, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); - let mut params = OxcVec::new_in(allocator); + let mut params = OxcVec::new_in(&allocator); if consumes_dollar_event { params.push(FnParam { name: Ident::from("$event") }); } @@ -254,7 +254,7 @@ pub fn create_synthetic_host_listener_stmt<'a>( statements: handler_stmts, source_span: None, }, - allocator, + &allocator, )); args.push(handler_fn); create_instruction_call_stmt(allocator, Identifiers::SYNTHETIC_HOST_LISTENER, args) @@ -276,7 +276,7 @@ pub fn create_animation_listener_stmt<'a>( handler_fn_name: Option<&Ident<'a>>, consumes_dollar_event: bool, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // Build the full event name: "@{name}.{phase}" // AnimationKind::Enter maps to "start", AnimationKind::Leave maps to "done" @@ -287,11 +287,11 @@ pub fn create_animation_listener_stmt<'a>( let full_name = allocator.alloc_str(&format!("@{}.{}", name.as_str(), phase_str)); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(Ident::from(full_name)), source_span: None }, - allocator, + &allocator, ))); // Handler function: function name($event) { ... } or function name() { ... } - let mut params = OxcVec::new_in(allocator); + let mut params = OxcVec::new_in(&allocator); if consumes_dollar_event { params.push(FnParam { name: Ident::from("$event") }); } @@ -303,7 +303,7 @@ pub fn create_animation_listener_stmt<'a>( statements: handler_stmts, source_span: None, }, - allocator, + &allocator, )); args.push(handler_fn); @@ -319,7 +319,7 @@ pub fn create_animation_string_stmt<'a>( animation_kind: AnimationKind, value: OutputExpression<'a>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(value); let instruction = match animation_kind { AnimationKind::Enter => Identifiers::ANIMATION_ENTER, @@ -337,13 +337,13 @@ pub fn create_animation_stmt<'a>( name: &Ident<'a>, value: OutputExpression<'a>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // Animation name with @ prefix let full_name = allocator.alloc_str(&format!("@{}", name.as_str())); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(Ident::from(full_name)), source_span: None }, - allocator, + &allocator, ))); args.push(value); @@ -370,17 +370,17 @@ pub fn create_animation_op_stmt<'a>( handler_stmts: OxcVec<'a, OutputStatement<'a>>, handler_fn_name: Option<&Ident<'a>>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); // Handler function: function name() { return expr; } let handler_fn = OutputExpression::Function(Box::new_in( FunctionExpr { name: handler_fn_name.cloned(), - params: OxcVec::new_in(allocator), + params: OxcVec::new_in(&allocator), statements: handler_stmts, source_span: None, }, - allocator, + &allocator, )); args.push(handler_fn); @@ -400,10 +400,10 @@ pub fn create_animation_binding_stmt<'a>( name: &Ident<'a>, value: OutputExpression<'a>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); args.push(value); create_instruction_call_stmt(allocator, Identifiers::SYNTHETIC_HOST_PROPERTY, args) @@ -415,7 +415,7 @@ pub fn create_animation_binding_stmt<'a>( /// value is written through the regular property instruction, and `ɵɵcontrol()` /// performs the form-control synchronization work separately. pub fn create_control_stmt<'a>(allocator: &'a oxc_allocator::Allocator) -> OutputStatement<'a> { - create_instruction_call_stmt(allocator, Identifiers::CONTROL, OxcVec::new_in(allocator)) + create_instruction_call_stmt(allocator, Identifiers::CONTROL, OxcVec::new_in(&allocator)) } /// Creates an ɵɵprojectionDef() call statement from a pre-built R3 def expression. @@ -426,7 +426,7 @@ pub fn create_projection_def_stmt_from_expr<'a>( allocator: &'a oxc_allocator::Allocator, def: Option<&OutputExpression<'a>>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); if let Some(def_expr) = def { args.push(def_expr.clone_in(allocator)); @@ -440,9 +440,9 @@ pub fn create_disable_bindings_stmt<'a>( allocator: &'a oxc_allocator::Allocator, ) -> OutputStatement<'a> { create_instruction_call_stmt( - allocator, + &allocator, Identifiers::DISABLE_BINDINGS, - OxcVec::new_in(allocator), + OxcVec::new_in(&allocator), ) } @@ -450,7 +450,11 @@ pub fn create_disable_bindings_stmt<'a>( pub fn create_enable_bindings_stmt<'a>( allocator: &'a oxc_allocator::Allocator, ) -> OutputStatement<'a> { - create_instruction_call_stmt(allocator, Identifiers::ENABLE_BINDINGS, OxcVec::new_in(allocator)) + create_instruction_call_stmt( + allocator, + Identifiers::ENABLE_BINDINGS, + OxcVec::new_in(&allocator), + ) } /// Creates an ɵɵpipe() call statement. @@ -459,14 +463,14 @@ pub fn create_pipe_stmt<'a>( slot: u32, name: &Ident<'a>, ) -> OutputStatement<'a> { - let mut args = OxcVec::new_in(allocator); + let mut args = OxcVec::new_in(&allocator); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Number(slot as f64), source_span: None }, - allocator, + &allocator, ))); args.push(OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::String(name.clone()), source_span: None }, - allocator, + &allocator, ))); create_instruction_call_stmt(allocator, Identifiers::PIPE, args) } diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/reify/utils.rs b/crates/oxc_angular_compiler/src/pipeline/phases/reify/utils.rs index f6b4b4d34..a573cf818 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/reify/utils.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/reify/utils.rs @@ -30,31 +30,31 @@ pub fn create_instruction_call_stmt<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(instruction), optional: false, source_span: None, }, - allocator, + &allocator, )); let invoke = OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(fn_expr, allocator), + fn_expr: Box::new_in(fn_expr, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )); OutputStatement::Expression(Box::new_in( ExpressionStatement { expr: invoke, source_span: None }, - allocator, + &allocator, )) } @@ -69,26 +69,26 @@ pub fn create_instruction_call_expr<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(instruction), optional: false, source_span: None, }, - allocator, + &allocator, )); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(fn_expr, allocator), + fn_expr: Box::new_in(fn_expr, &allocator), args, pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )) } diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/remove_illegal_let_references.rs b/crates/oxc_angular_compiler/src/pipeline/phases/remove_illegal_let_references.rs index 9793abd03..916f71ad0 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/remove_illegal_let_references.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/remove_illegal_let_references.rs @@ -115,9 +115,9 @@ pub fn remove_illegal_let_references(job: &mut ComponentCompilationJob<'_>) { source_span: AbsoluteSourceSpan::new(0, 0), value: LiteralValue::Undefined, }, - allocator, + &allocator, )); - *expr = IrExpression::Ast(Box::new_in(undefined_expr, allocator)); + *expr = IrExpression::Ast(Box::new_in(undefined_expr, &allocator)); } } }, diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/remove_safe_navigation_migration.rs b/crates/oxc_angular_compiler/src/pipeline/phases/remove_safe_navigation_migration.rs index 089086150..eca96fbe1 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/remove_safe_navigation_migration.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/remove_safe_navigation_migration.rs @@ -34,14 +34,14 @@ pub fn remove_safe_navigation_migration(job: &mut ComponentCompilationJob<'_>) { for op in view.create.iter_mut() { transform_expressions_in_create_op( op, - &|expr, _flags| convert_marker(expr, allocator), + &|expr, _flags| convert_marker(expr, &allocator), VisitorContextFlag::NONE, ); } for op in view.update.iter_mut() { transform_expressions_in_update_op( op, - &|expr, _flags| convert_marker(expr, allocator), + &|expr, _flags| convert_marker(expr, &allocator), VisitorContextFlag::NONE, ); } @@ -82,11 +82,11 @@ fn convert_marker<'a>(expr: &mut IrExpression<'a>, allocator: &'a oxc_allocator: // overwrite `*expr` below, so the placeholder left behind is never observed. let arg = std::mem::replace( &mut call.args[0], - IrExpression::Empty(ArenaBox::new_in(EmptyExpr { source_span: None }, allocator)), + IrExpression::Empty(ArenaBox::new_in(EmptyExpr { source_span: None }, &allocator)), ); *expr = IrExpression::SafeNavigationMigration(ArenaBox::new_in( - SafeNavigationMigrationExpr { expr: ArenaBox::new_in(arg, allocator), source_span }, - allocator, + SafeNavigationMigrationExpr { expr: ArenaBox::new_in(arg, &allocator), source_span }, + &allocator, )); } @@ -96,14 +96,14 @@ pub fn remove_safe_navigation_migration_for_host(job: &mut HostBindingCompilatio for op in job.root.create.iter_mut() { transform_expressions_in_create_op( op, - &|expr, _flags| convert_marker(expr, allocator), + &|expr, _flags| convert_marker(expr, &allocator), VisitorContextFlag::NONE, ); } for op in job.root.update.iter_mut() { transform_expressions_in_update_op( op, - &|expr, _flags| convert_marker(expr, allocator), + &|expr, _flags| convert_marker(expr, &allocator), VisitorContextFlag::NONE, ); } diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/resolve_contexts.rs b/crates/oxc_angular_compiler/src/pipeline/phases/resolve_contexts.rs index e04140ead..6d0142280 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/resolve_contexts.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/resolve_contexts.rs @@ -55,7 +55,7 @@ pub fn resolve_contexts(job: &mut ComponentCompilationJob<'_>) { // and the allocator keeps the data alive. let arrow_fn = unsafe { &mut **fn_ptr }; process_lexical_scope_update_vec( - allocator, + &allocator, view_xref, is_root, &mut arrow_fn.ops, @@ -111,7 +111,7 @@ fn process_lexical_scope_create<'a>( CreateOp::Listener(listener) => { // Process listener handler_ops and handler_expression with their own scope process_listener_handler_ops( - allocator, + &allocator, view_xref, is_root, &mut listener.handler_ops, @@ -122,7 +122,7 @@ fn process_lexical_scope_create<'a>( CreateOp::TwoWayListener(listener) => { // TwoWayListener has no handler_expression process_listener_handler_ops( - allocator, + &allocator, view_xref, is_root, &mut listener.handler_ops, @@ -133,7 +133,7 @@ fn process_lexical_scope_create<'a>( CreateOp::AnimationListener(listener) => { // AnimationListener has no handler_expression process_listener_handler_ops( - allocator, + &allocator, view_xref, is_root, &mut listener.handler_ops, @@ -144,7 +144,7 @@ fn process_lexical_scope_create<'a>( CreateOp::Animation(animation) => { // Animation has no handler_expression process_listener_handler_ops( - allocator, + &allocator, view_xref, is_root, &mut animation.handler_ops, @@ -159,7 +159,7 @@ fn process_lexical_scope_create<'a>( // if (op.trackByOps !== null) { processLexicalScope(view, op.trackByOps); } if let Some(ref mut track_by_ops) = repeater.track_by_ops { process_lexical_scope_update_vec( - allocator, + &allocator, view_xref, is_root, track_by_ops, @@ -375,7 +375,7 @@ fn transform_context_expr<'a>( // Ancestor view's context - replace with ReadVariableExpr *expr = IrExpression::ReadVariable(oxc_allocator::Box::new_in( ReadVariableExpr { xref: *var_xref, name: None, source_span: None }, - allocator, + &allocator, )); } None => { diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/resolve_i18n_element_placeholders.rs b/crates/oxc_angular_compiler/src/pipeline/phases/resolve_i18n_element_placeholders.rs index 87964004c..3d0258b30 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/resolve_i18n_element_placeholders.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/resolve_i18n_element_placeholders.rs @@ -400,7 +400,7 @@ fn resolve_placeholders_for_view<'a>( context_xref, start_name.as_str(), param_value, - allocator, + &allocator, ); } } @@ -431,7 +431,7 @@ fn resolve_placeholders_for_view<'a>( context_xref, close_name.as_str(), param_value, - allocator, + &allocator, ); } } @@ -463,7 +463,7 @@ fn resolve_placeholders_for_view<'a>( context_xref, start_name.as_str(), structural_value, - allocator, + &allocator, ); } @@ -480,7 +480,7 @@ fn resolve_placeholders_for_view<'a>( context_xref, start_name.as_str(), param_value, - allocator, + &allocator, ); } OpInfo::TemplateEnd { @@ -505,7 +505,7 @@ fn resolve_placeholders_for_view<'a>( context_xref, close_name.as_str(), param_value, - allocator, + &allocator, ); // If associated with structural directive, record it after @@ -520,7 +520,7 @@ fn resolve_placeholders_for_view<'a>( context_xref, close_name.as_str(), structural_value, - allocator, + &allocator, ); } } @@ -614,7 +614,7 @@ fn add_param_to_context<'a>( for op in job.root.create.iter_mut() { if let CreateOp::I18nContext(ctx) = op { if ctx.xref == context_xref { - add_to_params_map(&mut ctx.params, placeholder_atom, value, allocator); + add_to_params_map(&mut ctx.params, placeholder_atom, value, &allocator); return; } } @@ -627,7 +627,7 @@ fn add_param_to_context<'a>( for op in view.create.iter_mut() { if let CreateOp::I18nContext(ctx) = op { if ctx.xref == context_xref { - add_to_params_map(&mut ctx.params, placeholder_atom, value, allocator); + add_to_params_map(&mut ctx.params, placeholder_atom, value, &allocator); return; } } @@ -646,7 +646,7 @@ fn add_to_params_map<'a>( if let Some(values) = params.get_mut(&placeholder) { values.push(value); } else { - let mut values = oxc_allocator::Vec::new_in(allocator); + let mut values = oxc_allocator::Vec::new_in(&allocator); values.push(value); params.insert(placeholder, values); } diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/resolve_i18n_expression_placeholders.rs b/crates/oxc_angular_compiler/src/pipeline/phases/resolve_i18n_expression_placeholders.rs index 6b235ab92..f59431b4a 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/resolve_i18n_expression_placeholders.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/resolve_i18n_expression_placeholders.rs @@ -119,7 +119,7 @@ pub fn resolve_i18n_expression_placeholders(job: &mut ComponentCompilationJob<'_ if let Some(values) = params.get_mut(&placeholder_atom) { values.push(update.value); } else { - let mut values = oxc_allocator::Vec::new_in(allocator); + let mut values = oxc_allocator::Vec::new_in(&allocator); values.push(update.value); params.insert(placeholder_atom, values); } diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/resolve_names.rs b/crates/oxc_angular_compiler/src/pipeline/phases/resolve_names.rs index 394927a40..89d4534a5 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/resolve_names.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/resolve_names.rs @@ -62,8 +62,8 @@ pub fn resolve_names(job: &mut ComponentCompilationJob<'_>) { let expressions = unsafe { &*expression_store_ptr }; // Process create ops with their own scope (no update scope merged in) - process_lexical_scope_create(root_xref, &mut view.create, None, allocator, expressions); - process_lexical_scope_update(root_xref, &mut view.update, None, allocator, expressions); + process_lexical_scope_create(root_xref, &mut view.create, None, &allocator, expressions); + process_lexical_scope_update(root_xref, &mut view.update, None, &allocator, expressions); } // Verify no LexicalRead expressions remain after resolution. @@ -213,7 +213,7 @@ fn process_lexical_scope_create<'a>( &handler_scope, root_xref, current_saved_view.as_ref(), - allocator, + &allocator, expressions, ); }, @@ -227,7 +227,7 @@ fn process_lexical_scope_create<'a>( &handler_scope, root_xref, current_saved_view.as_ref(), - allocator, + &allocator, expressions, ); } @@ -245,7 +245,7 @@ fn process_lexical_scope_create<'a>( &handler_scope, root_xref, current_saved_view.as_ref(), - allocator, + &allocator, expressions, ); }, @@ -266,7 +266,7 @@ fn process_lexical_scope_create<'a>( &handler_scope, root_xref, current_saved_view.as_ref(), - allocator, + &allocator, expressions, ); }, @@ -287,7 +287,7 @@ fn process_lexical_scope_create<'a>( &handler_scope, root_xref, current_saved_view.as_ref(), - allocator, + &allocator, expressions, ); }, @@ -310,7 +310,7 @@ fn process_lexical_scope_create<'a>( &scope, root_xref, current_saved_view.as_ref(), - allocator, + &allocator, expressions, ); }, @@ -375,7 +375,7 @@ fn process_lexical_scope_update<'a>( &scope, root_xref, current_saved_view.as_ref(), - allocator, + &allocator, expressions, ); }, @@ -408,7 +408,7 @@ fn resolve_expression<'a>( // Leave name as None so the naming phase can assign the proper suffixed name *expr = IrExpression::ReadVariable(Box::new_in( ReadVariableExpr { xref, name: None, source_span: lexical.source_span }, - allocator, + &allocator, )); } else { // Not in scope - access from component context (root view) @@ -423,15 +423,15 @@ fn resolve_expression<'a>( receiver: Box::new_in( IrExpression::Context(Box::new_in( ContextExpr { view: root_xref, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: lexical.name.clone(), optional: false, source_span: lexical.source_span, }, - allocator, + &allocator, )); } } @@ -452,9 +452,9 @@ fn resolve_expression<'a>( name: None, source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, )); } } @@ -466,7 +466,7 @@ fn resolve_expression<'a>( // as ExpressionRef. This handles nested property reads like `todo.done` // where the receiver `todo` needs to be resolved to a variable. if let Some(resolved) = - resolve_angular_expression(ast_expr.as_ref(), scope, root_xref, allocator) + resolve_angular_expression(ast_expr.as_ref(), scope, root_xref, &allocator) { *expr = resolved; return; @@ -490,7 +490,7 @@ fn resolve_expression<'a>( // Leave name as None so the naming phase can assign the proper suffixed name *expr = IrExpression::ReadVariable(Box::new_in( ReadVariableExpr { xref, name: None, source_span }, - allocator, + &allocator, )); return; } @@ -515,15 +515,15 @@ fn resolve_expression<'a>( receiver: Box::new_in( IrExpression::Context(Box::new_in( ContextExpr { view: root_xref, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: name.clone(), optional: false, source_span, }, - allocator, + &allocator, )); return; } @@ -533,7 +533,7 @@ fn resolve_expression<'a>( if matches!(ast_expr.as_ref(), AngularExpression::ImplicitReceiver(_)) { *expr = IrExpression::Context(Box::new_in( ContextExpr { view: root_xref, source_span: None }, - allocator, + &allocator, )); } } @@ -544,7 +544,7 @@ fn resolve_expression<'a>( // Try to resolve the expression tree recursively if let Some(resolved) = - resolve_angular_expression(stored_expr, scope, root_xref, allocator) + resolve_angular_expression(stored_expr, scope, root_xref, &allocator) { *expr = resolved; } @@ -560,7 +560,7 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); } @@ -574,11 +574,11 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); for arg in call.args.iter_mut() { - resolve_expression(arg, scope, root_xref, saved_view, allocator, expressions); + resolve_expression(arg, scope, root_xref, saved_view, &allocator, expressions); } } @@ -588,7 +588,7 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); } @@ -599,7 +599,7 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); resolve_expression( @@ -607,7 +607,7 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); } @@ -618,7 +618,7 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); resolve_expression( @@ -626,7 +626,7 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); } @@ -640,7 +640,7 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); resolve_expression( @@ -648,7 +648,7 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); } @@ -659,7 +659,7 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); } @@ -673,7 +673,7 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); resolve_expression( @@ -681,7 +681,7 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); resolve_expression( @@ -689,7 +689,7 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); } @@ -701,7 +701,7 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); } @@ -713,7 +713,7 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); resolve_expression( @@ -721,7 +721,7 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); } @@ -733,11 +733,11 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); for arg in safe.args.iter_mut() { - resolve_expression(arg, scope, root_xref, saved_view, allocator, expressions); + resolve_expression(arg, scope, root_xref, saved_view, &allocator, expressions); } } @@ -748,7 +748,7 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); resolve_expression( @@ -756,7 +756,7 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); } @@ -764,28 +764,28 @@ fn resolve_expression<'a>( // Literal map (object literal) - resolve all values IrExpression::LiteralMap(map) => { for value in map.values.iter_mut() { - resolve_expression(value, scope, root_xref, saved_view, allocator, expressions); + resolve_expression(value, scope, root_xref, saved_view, &allocator, expressions); } } // Derived literal map (object literal with some resolved values) - resolve all values IrExpression::DerivedLiteralMap(map) => { for value in map.values.iter_mut() { - resolve_expression(value, scope, root_xref, saved_view, allocator, expressions); + resolve_expression(value, scope, root_xref, saved_view, &allocator, expressions); } } // Literal array - resolve all entries IrExpression::LiteralArray(arr) => { for elem in arr.elements.iter_mut() { - resolve_expression(elem, scope, root_xref, saved_view, allocator, expressions); + resolve_expression(elem, scope, root_xref, saved_view, &allocator, expressions); } } // Derived literal array - resolve all entries IrExpression::DerivedLiteralArray(arr) => { for entry in arr.entries.iter_mut() { - resolve_expression(entry, scope, root_xref, saved_view, allocator, expressions); + resolve_expression(entry, scope, root_xref, saved_view, &allocator, expressions); } } @@ -796,7 +796,7 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); } @@ -808,7 +808,7 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); } @@ -820,7 +820,7 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); } @@ -832,7 +832,7 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); } @@ -844,7 +844,7 @@ fn resolve_expression<'a>( scope, root_xref, saved_view, - allocator, + &allocator, expressions, ); } @@ -853,7 +853,7 @@ fn resolve_expression<'a>( // - resolve each inner expression so LexicalRead refs to @let vars and pipe args are resolved IrExpression::ResolvedTemplateLiteral(tl) => { for expr in tl.expressions.iter_mut() { - resolve_expression(expr, scope, root_xref, saved_view, allocator, expressions); + resolve_expression(expr, scope, root_xref, saved_view, &allocator, expressions); } } @@ -902,7 +902,7 @@ fn resolve_angular_expression<'a>( // Found in scope - return ReadVariable return Some(IrExpression::ReadVariable(Box::new_in( ReadVariableExpr { xref, name: None, source_span }, - allocator, + &allocator, ))); } } @@ -934,31 +934,31 @@ fn resolve_angular_expression<'a>( receiver: Box::new_in( IrExpression::Context(Box::new_in( ContextExpr { view: root_xref, source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: name.clone(), optional: false, source_span, }, - allocator, + &allocator, ))) } else { // This is a nested property read like item.name // Try to resolve the receiver first if let Some(resolved_receiver) = - resolve_angular_expression(&prop_read.receiver, scope, root_xref, allocator) + resolve_angular_expression(&prop_read.receiver, scope, root_xref, &allocator) { // Receiver was resolved - create ResolvedPropertyRead Some(IrExpression::ResolvedPropertyRead(Box::new_in( ResolvedPropertyReadExpr { - receiver: Box::new_in(resolved_receiver, allocator), + receiver: Box::new_in(resolved_receiver, &allocator), name: prop_read.name.clone(), optional: false, source_span: Some(prop_read.source_span.to_span()), }, - allocator, + &allocator, ))) } else { // Receiver couldn't be resolved - keep as-is @@ -971,30 +971,30 @@ fn resolve_angular_expression<'a>( // ImplicitReceiver by itself becomes Context Some(IrExpression::Context(Box::new_in( ContextExpr { view: root_xref, source_span: None }, - allocator, + &allocator, ))) } AngularExpression::Call(call) => { // Resolve the receiver let resolved_receiver = - resolve_angular_expression(&call.receiver, scope, root_xref, allocator); + resolve_angular_expression(&call.receiver, scope, root_xref, &allocator); // Resolve each argument - let mut resolved_args = oxc_allocator::Vec::new_in(allocator); + let mut resolved_args = oxc_allocator::Vec::new_in(&allocator); let mut any_arg_resolved = false; for arg in call.args.iter() { if let Some(resolved_arg) = - resolve_angular_expression(arg, scope, root_xref, allocator) + resolve_angular_expression(arg, scope, root_xref, &allocator) { resolved_args.push(resolved_arg); any_arg_resolved = true; } else { // Keep the original argument wrapped as Ast resolved_args.push(IrExpression::Ast(Box::new_in( - crate::ir::expression::clone_angular_expression(arg, allocator), - allocator, + crate::ir::expression::clone_angular_expression(arg, &allocator), + &allocator, ))); } } @@ -1004,19 +1004,19 @@ fn resolve_angular_expression<'a>( let receiver = resolved_receiver.unwrap_or_else(|| { // Keep original receiver wrapped as Ast IrExpression::Ast(Box::new_in( - crate::ir::expression::clone_angular_expression(&call.receiver, allocator), - allocator, + crate::ir::expression::clone_angular_expression(&call.receiver, &allocator), + &allocator, )) }); Some(IrExpression::ResolvedCall(Box::new_in( ResolvedCallExpr { - receiver: Box::new_in(receiver, allocator), + receiver: Box::new_in(receiver, &allocator), args: resolved_args, optional: false, source_span: Some(call.source_span.to_span()), }, - allocator, + &allocator, ))) } else { None @@ -1026,33 +1026,36 @@ fn resolve_angular_expression<'a>( AngularExpression::KeyedRead(keyed) => { // Resolve receiver for keyed reads like item[0] let resolved_receiver = - resolve_angular_expression(&keyed.receiver, scope, root_xref, allocator); + resolve_angular_expression(&keyed.receiver, scope, root_xref, &allocator); // Also try to resolve the key expression - let resolved_key = resolve_angular_expression(&keyed.key, scope, root_xref, allocator); + let resolved_key = resolve_angular_expression(&keyed.key, scope, root_xref, &allocator); if resolved_receiver.is_some() || resolved_key.is_some() { // At least one part was resolved, create a ResolvedKeyedRead let receiver = resolved_receiver.unwrap_or_else(|| { IrExpression::Ast(Box::new_in( - crate::ir::expression::clone_angular_expression(&keyed.receiver, allocator), - allocator, + crate::ir::expression::clone_angular_expression( + &keyed.receiver, + &allocator, + ), + &allocator, )) }); let key = resolved_key.unwrap_or_else(|| { IrExpression::Ast(Box::new_in( - crate::ir::expression::clone_angular_expression(&keyed.key, allocator), - allocator, + crate::ir::expression::clone_angular_expression(&keyed.key, &allocator), + &allocator, )) }); Some(IrExpression::ResolvedKeyedRead(Box::new_in( ResolvedKeyedReadExpr { - receiver: Box::new_in(receiver, allocator), - key: Box::new_in(key, allocator), + receiver: Box::new_in(receiver, &allocator), + key: Box::new_in(key, &allocator), optional: false, source_span: Some(keyed.source_span.to_span()), }, - allocator, + &allocator, ))) } else { None @@ -1062,15 +1065,15 @@ fn resolve_angular_expression<'a>( AngularExpression::SafePropertyRead(safe) => { // Resolve receiver for safe property reads like item?.name if let Some(resolved_receiver) = - resolve_angular_expression(&safe.receiver, scope, root_xref, allocator) + resolve_angular_expression(&safe.receiver, scope, root_xref, &allocator) { Some(IrExpression::ResolvedSafePropertyRead(Box::new_in( ResolvedSafePropertyReadExpr { - receiver: Box::new_in(resolved_receiver, allocator), + receiver: Box::new_in(resolved_receiver, &allocator), name: safe.name.clone(), source_span: Some(safe.source_span.to_span()), }, - allocator, + &allocator, ))) } else { None @@ -1081,35 +1084,35 @@ fn resolve_angular_expression<'a>( // Handle binary expressions, especially assignments in event handlers // like `todo.done = $event` let resolved_left = - resolve_angular_expression(&binary.left, scope, root_xref, allocator); + resolve_angular_expression(&binary.left, scope, root_xref, &allocator); let resolved_right = - resolve_angular_expression(&binary.right, scope, root_xref, allocator); + resolve_angular_expression(&binary.right, scope, root_xref, &allocator); if resolved_left.is_some() || resolved_right.is_some() { // At least one side was resolved, create a ResolvedBinary let left = resolved_left.unwrap_or_else(|| { // Wrap original left expression as Ast IrExpression::Ast(Box::new_in( - crate::ir::expression::clone_angular_expression(&binary.left, allocator), - allocator, + crate::ir::expression::clone_angular_expression(&binary.left, &allocator), + &allocator, )) }); let right = resolved_right.unwrap_or_else(|| { // Wrap original right expression as Ast IrExpression::Ast(Box::new_in( - crate::ir::expression::clone_angular_expression(&binary.right, allocator), - allocator, + crate::ir::expression::clone_angular_expression(&binary.right, &allocator), + &allocator, )) }); Some(IrExpression::ResolvedBinary(Box::new_in( crate::ir::expression::ResolvedBinaryExpr { operator: binary.operation, - left: Box::new_in(left, allocator), - right: Box::new_in(right, allocator), + left: Box::new_in(left, &allocator), + right: Box::new_in(right, &allocator), source_span: Some(binary.source_span.to_span()), }, - allocator, + &allocator, ))) } else { None @@ -1121,34 +1124,34 @@ fn resolve_angular_expression<'a>( // This is similar to ImplicitReceiver but explicit. Some(IrExpression::Context(Box::new_in( ContextExpr { view: root_xref, source_span: None }, - allocator, + &allocator, ))) } AngularExpression::TemplateLiteral(tl) => { // Handle template literal expressions like `class {{ item.name }}` // Need to resolve any variable references in the expressions - let mut resolved_exprs = oxc_allocator::Vec::new_in(allocator); + let mut resolved_exprs = oxc_allocator::Vec::new_in(&allocator); let mut any_resolved = false; for expr in tl.expressions.iter() { if let Some(resolved) = - resolve_angular_expression(expr, scope, root_xref, allocator) + resolve_angular_expression(expr, scope, root_xref, &allocator) { resolved_exprs.push(resolved); any_resolved = true; } else { // Keep the original expression wrapped as Ast resolved_exprs.push(IrExpression::Ast(Box::new_in( - crate::ir::expression::clone_angular_expression(expr, allocator), - allocator, + crate::ir::expression::clone_angular_expression(expr, &allocator), + &allocator, ))); } } if any_resolved { // Create a ResolvedTemplateLiteral with the resolved expressions - let mut elements = oxc_allocator::Vec::new_in(allocator); + let mut elements = oxc_allocator::Vec::new_in(&allocator); for elem in tl.elements.iter() { elements.push(crate::ir::expression::IrTemplateLiteralElement { text: elem.text.clone(), @@ -1162,7 +1165,7 @@ fn resolve_angular_expression<'a>( expressions: resolved_exprs, source_span: Some(tl.source_span.to_span()), }, - allocator, + &allocator, ))) } else { None @@ -1172,40 +1175,46 @@ fn resolve_angular_expression<'a>( AngularExpression::Conditional(cond) => { // Handle conditional (ternary) expressions let resolved_condition = - resolve_angular_expression(&cond.condition, scope, root_xref, allocator); + resolve_angular_expression(&cond.condition, scope, root_xref, &allocator); let resolved_true = - resolve_angular_expression(&cond.true_exp, scope, root_xref, allocator); + resolve_angular_expression(&cond.true_exp, scope, root_xref, &allocator); let resolved_false = - resolve_angular_expression(&cond.false_exp, scope, root_xref, allocator); + resolve_angular_expression(&cond.false_exp, scope, root_xref, &allocator); if resolved_condition.is_some() || resolved_true.is_some() || resolved_false.is_some() { let condition = resolved_condition.unwrap_or_else(|| { IrExpression::Ast(Box::new_in( - crate::ir::expression::clone_angular_expression(&cond.condition, allocator), - allocator, + crate::ir::expression::clone_angular_expression( + &cond.condition, + &allocator, + ), + &allocator, )) }); let true_expr = resolved_true.unwrap_or_else(|| { IrExpression::Ast(Box::new_in( - crate::ir::expression::clone_angular_expression(&cond.true_exp, allocator), - allocator, + crate::ir::expression::clone_angular_expression(&cond.true_exp, &allocator), + &allocator, )) }); let false_expr = resolved_false.unwrap_or_else(|| { IrExpression::Ast(Box::new_in( - crate::ir::expression::clone_angular_expression(&cond.false_exp, allocator), - allocator, + crate::ir::expression::clone_angular_expression( + &cond.false_exp, + &allocator, + ), + &allocator, )) }); Some(IrExpression::Ternary(Box::new_in( crate::ir::expression::TernaryExpr { - condition: Box::new_in(condition, allocator), - true_expr: Box::new_in(true_expr, allocator), - false_expr: Box::new_in(false_expr, allocator), + condition: Box::new_in(condition, &allocator), + true_expr: Box::new_in(true_expr, &allocator), + false_expr: Box::new_in(false_expr, &allocator), source_span: Some(cond.source_span.to_span()), }, - allocator, + &allocator, ))) } else { None @@ -1214,20 +1223,20 @@ fn resolve_angular_expression<'a>( AngularExpression::LiteralMap(map) => { // Handle object literals - need to resolve variable references in values - let mut resolved_values = oxc_allocator::Vec::new_in(allocator); + let mut resolved_values = oxc_allocator::Vec::new_in(&allocator); let mut any_resolved = false; for value in map.values.iter() { if let Some(resolved) = - resolve_angular_expression(value, scope, root_xref, allocator) + resolve_angular_expression(value, scope, root_xref, &allocator) { resolved_values.push(resolved); any_resolved = true; } else { // Keep the original value wrapped as Ast resolved_values.push(IrExpression::Ast(Box::new_in( - crate::ir::expression::clone_angular_expression(value, allocator), - allocator, + crate::ir::expression::clone_angular_expression(value, &allocator), + &allocator, ))); } } @@ -1235,9 +1244,9 @@ fn resolve_angular_expression<'a>( if any_resolved { use crate::ast::expression::LiteralMapKey; // Create a DerivedLiteralMap with the resolved values - let mut keys = oxc_allocator::Vec::new_in(allocator); - let mut quoted = oxc_allocator::Vec::new_in(allocator); - let mut spreads = oxc_allocator::Vec::new_in(allocator); + let mut keys = oxc_allocator::Vec::new_in(&allocator); + let mut quoted = oxc_allocator::Vec::new_in(&allocator); + let mut spreads = oxc_allocator::Vec::new_in(&allocator); for key in map.keys.iter() { match key { LiteralMapKey::Property(prop) => { @@ -1261,7 +1270,7 @@ fn resolve_angular_expression<'a>( spreads, source_span: Some(map.source_span.to_span()), }, - allocator, + &allocator, ))) } else { None @@ -1270,8 +1279,8 @@ fn resolve_angular_expression<'a>( AngularExpression::LiteralArray(arr) => { // Handle array literals - need to resolve variable references in entries - let mut resolved_entries = oxc_allocator::Vec::new_in(allocator); - let mut spreads = oxc_allocator::Vec::new_in(allocator); + let mut resolved_entries = oxc_allocator::Vec::new_in(&allocator); + let mut spreads = oxc_allocator::Vec::new_in(&allocator); let mut any_resolved = false; for entry in arr.expressions.iter() { @@ -1282,14 +1291,14 @@ fn resolve_angular_expression<'a>( entry }; if let Some(resolved) = - resolve_angular_expression(inner, scope, root_xref, allocator) + resolve_angular_expression(inner, scope, root_xref, &allocator) { resolved_entries.push(resolved); any_resolved = true; } else { resolved_entries.push(IrExpression::Ast(Box::new_in( - crate::ir::expression::clone_angular_expression(inner, allocator), - allocator, + crate::ir::expression::clone_angular_expression(inner, &allocator), + &allocator, ))); } spreads.push(is_spread); @@ -1302,7 +1311,7 @@ fn resolve_angular_expression<'a>( spreads, source_span: Some(arr.source_span.to_span()), }, - allocator, + &allocator, ))) } else { None @@ -1313,14 +1322,14 @@ fn resolve_angular_expression<'a>( // Handle prefix not expressions (!expr) - need to resolve variable references // in the operand. This is critical for expressions like `!bold` in listeners. if let Some(resolved) = - resolve_angular_expression(&prefix_not.expression, scope, root_xref, allocator) + resolve_angular_expression(&prefix_not.expression, scope, root_xref, &allocator) { Some(IrExpression::Not(Box::new_in( crate::ir::expression::NotExpr { - expr: Box::new_in(resolved, allocator), + expr: Box::new_in(resolved, &allocator), source_span: Some(prefix_not.source_span.to_span()), }, - allocator, + &allocator, ))) } else { None @@ -1330,7 +1339,7 @@ fn resolve_angular_expression<'a>( AngularExpression::Unary(unary) => { // Handle unary expressions (+expr or -expr) - need to resolve variable references if let Some(resolved) = - resolve_angular_expression(&unary.expr, scope, root_xref, allocator) + resolve_angular_expression(&unary.expr, scope, root_xref, &allocator) { Some(IrExpression::Unary(Box::new_in( crate::ir::expression::UnaryExpr { @@ -1342,10 +1351,10 @@ fn resolve_angular_expression<'a>( crate::ir::expression::IrUnaryOperator::Minus } }, - expr: Box::new_in(resolved, allocator), + expr: Box::new_in(resolved, &allocator), source_span: Some(unary.source_span.to_span()), }, - allocator, + &allocator, ))) } else { None @@ -1355,14 +1364,14 @@ fn resolve_angular_expression<'a>( AngularExpression::TypeofExpression(typeof_expr) => { // Handle typeof expressions - need to resolve variable references if let Some(resolved) = - resolve_angular_expression(&typeof_expr.expression, scope, root_xref, allocator) + resolve_angular_expression(&typeof_expr.expression, scope, root_xref, &allocator) { Some(IrExpression::Typeof(Box::new_in( crate::ir::expression::TypeofExpr { - expr: Box::new_in(resolved, allocator), + expr: Box::new_in(resolved, &allocator), source_span: Some(typeof_expr.source_span.to_span()), }, - allocator, + &allocator, ))) } else { None @@ -1372,14 +1381,14 @@ fn resolve_angular_expression<'a>( AngularExpression::VoidExpression(void_expr) => { // Handle void expressions - need to resolve variable references if let Some(resolved) = - resolve_angular_expression(&void_expr.expression, scope, root_xref, allocator) + resolve_angular_expression(&void_expr.expression, scope, root_xref, &allocator) { Some(IrExpression::Void(Box::new_in( crate::ir::expression::VoidExpr { - expr: Box::new_in(resolved, allocator), + expr: Box::new_in(resolved, &allocator), source_span: Some(void_expr.source_span.to_span()), }, - allocator, + &allocator, ))) } else { None @@ -1389,13 +1398,13 @@ fn resolve_angular_expression<'a>( AngularExpression::NonNullAssert(nna) => { // Handle non-null assertion expressions (expr!) - need to resolve variable references // NonNullAssert expressions are wrapped in Ast since IrExpression doesn't have this variant - resolve_angular_expression(&nna.expression, scope, root_xref, allocator) + resolve_angular_expression(&nna.expression, scope, root_xref, &allocator) } AngularExpression::ParenthesizedExpression(paren) => { // Handle parenthesized expressions - need to resolve variable references // within the inner expression - resolve_angular_expression(&paren.expression, scope, root_xref, allocator) + resolve_angular_expression(&paren.expression, scope, root_xref, &allocator) } AngularExpression::Chain(chain) => { @@ -1403,7 +1412,7 @@ fn resolve_angular_expression<'a>( // Chain is not directly supported in IrExpression, so we need to handle it specially let mut any_resolved = false; for expr in chain.expressions.iter() { - if resolve_angular_expression(expr, scope, root_xref, allocator).is_some() { + if resolve_angular_expression(expr, scope, root_xref, &allocator).is_some() { any_resolved = true; break; } @@ -1423,21 +1432,22 @@ fn resolve_angular_expression<'a>( AngularExpression::SafeCall(safe_call) => { // Handle safe function calls (fn?.()) - need to resolve receiver and arguments let resolved_receiver = - resolve_angular_expression(&safe_call.receiver, scope, root_xref, allocator); + resolve_angular_expression(&safe_call.receiver, scope, root_xref, &allocator); - let mut resolved_args = oxc_allocator::Vec::new_in(allocator); + let mut resolved_args = oxc_allocator::Vec::new_in(&allocator); let mut any_arg_resolved = false; for arg in safe_call.args.iter() { - if let Some(resolved) = resolve_angular_expression(arg, scope, root_xref, allocator) + if let Some(resolved) = + resolve_angular_expression(arg, scope, root_xref, &allocator) { resolved_args.push(resolved); any_arg_resolved = true; } else { // Keep the original argument wrapped as Ast resolved_args.push(IrExpression::Ast(Box::new_in( - crate::ir::expression::clone_angular_expression(arg, allocator), - allocator, + crate::ir::expression::clone_angular_expression(arg, &allocator), + &allocator, ))); } } @@ -1447,19 +1457,19 @@ fn resolve_angular_expression<'a>( IrExpression::Ast(Box::new_in( crate::ir::expression::clone_angular_expression( &safe_call.receiver, - allocator, + &allocator, ), - allocator, + &allocator, )) }); Some(IrExpression::SafeInvokeFunction(Box::new_in( crate::ir::expression::SafeInvokeFunctionExpr { - receiver: Box::new_in(receiver, allocator), + receiver: Box::new_in(receiver, &allocator), args: resolved_args, source_span: Some(safe_call.source_span.to_span()), }, - allocator, + &allocator, ))) } else { None @@ -1469,34 +1479,37 @@ fn resolve_angular_expression<'a>( AngularExpression::SafeKeyedRead(safe_keyed) => { // Handle safe keyed read (obj?.[key]) - need to resolve receiver and key let resolved_receiver = - resolve_angular_expression(&safe_keyed.receiver, scope, root_xref, allocator); + resolve_angular_expression(&safe_keyed.receiver, scope, root_xref, &allocator); let resolved_key = - resolve_angular_expression(&safe_keyed.key, scope, root_xref, allocator); + resolve_angular_expression(&safe_keyed.key, scope, root_xref, &allocator); if resolved_receiver.is_some() || resolved_key.is_some() { let receiver = resolved_receiver.unwrap_or_else(|| { IrExpression::Ast(Box::new_in( crate::ir::expression::clone_angular_expression( &safe_keyed.receiver, - allocator, + &allocator, ), - allocator, + &allocator, )) }); let key = resolved_key.unwrap_or_else(|| { IrExpression::Ast(Box::new_in( - crate::ir::expression::clone_angular_expression(&safe_keyed.key, allocator), - allocator, + crate::ir::expression::clone_angular_expression( + &safe_keyed.key, + &allocator, + ), + &allocator, )) }); Some(IrExpression::SafeKeyedRead(Box::new_in( crate::ir::expression::SafeKeyedReadExpr { - receiver: Box::new_in(receiver, allocator), - index: Box::new_in(key, allocator), + receiver: Box::new_in(receiver, &allocator), + index: Box::new_in(key, &allocator), source_span: Some(safe_keyed.source_span.to_span()), }, - allocator, + &allocator, ))) } else { None @@ -1520,8 +1533,8 @@ pub fn resolve_names_for_host(job: &mut HostBindingCompilationJob<'_>) { let expressions = unsafe { &*expression_store_ptr }; // Process create ops with their own scope (no update scope merged in) - process_lexical_scope_create(root_xref, &mut job.root.create, None, allocator, expressions); - process_lexical_scope_update(root_xref, &mut job.root.update, None, allocator, expressions); + process_lexical_scope_create(root_xref, &mut job.root.create, None, &allocator, expressions); + process_lexical_scope_update(root_xref, &mut job.root.update, None, &allocator, expressions); // Verify no LexicalRead expressions remain after resolution. verify_no_lexical_reads_remain_for_host(job); diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/save_restore_view.rs b/crates/oxc_angular_compiler/src/pipeline/phases/save_restore_view.rs index da92271b5..f66e5d135 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/save_restore_view.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/save_restore_view.rs @@ -182,7 +182,7 @@ fn process_arrow_functions_in_view( // The target is o.variable(expr.currentViewName) where currentViewName is 'view' let view_var_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("view"), source_span: None }, - allocator, + &allocator, )); let restore_var = UpdateOp::Variable(UpdateVariableOp { @@ -194,14 +194,14 @@ fn process_arrow_functions_in_view( IrExpression::RestoreView(Box::new_in( RestoreViewExpr { view: RestoreViewTarget::Dynamic(Box::new_in( - IrExpression::OutputExpr(Box::new_in(view_var_expr, allocator)), - allocator, + IrExpression::OutputExpr(Box::new_in(view_var_expr, &allocator)), + &allocator, )), source_span: None, }, - allocator, + &allocator, )), - allocator, + &allocator, ), flags: VariableFlags::NONE, view: Some(view_xref), @@ -329,7 +329,7 @@ fn process_view_listeners(job: &mut ComponentCompilationJob<'_>, view_xref: Xref CreateOp::Listener(listener) => { if let Some(var_xref) = needs_restore { add_restore_view_to_listener( - allocator, + &allocator, &mut listener.handler_ops, &mut listener.handler_expression, var_xref, @@ -341,7 +341,7 @@ fn process_view_listeners(job: &mut ComponentCompilationJob<'_>, view_xref: Xref if let Some(var_xref) = needs_restore { // TwoWayListener doesn't have handler_expression, only handler_ops add_restore_view_ops_only( - allocator, + &allocator, &mut listener.handler_ops, var_xref, view_xref, @@ -352,7 +352,7 @@ fn process_view_listeners(job: &mut ComponentCompilationJob<'_>, view_xref: Xref if let Some(var_xref) = needs_restore { // Animation doesn't have handler_expression, only handler_ops add_restore_view_ops_only( - allocator, + &allocator, &mut animation.handler_ops, var_xref, view_xref, @@ -363,7 +363,7 @@ fn process_view_listeners(job: &mut ComponentCompilationJob<'_>, view_xref: Xref if let Some(var_xref) = needs_restore { // AnimationListener doesn't have handler_expression, only handler_ops add_restore_view_ops_only( - allocator, + &allocator, &mut listener.handler_ops, var_xref, view_xref, @@ -399,9 +399,9 @@ fn add_restore_view_ops_only<'a>( initializer: Box::new_in( IrExpression::RestoreView(Box::new_in( RestoreViewExpr { view: RestoreViewTarget::Static(view_xref), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), flags: VariableFlags::NONE, view: Some(view_xref), @@ -439,9 +439,9 @@ fn add_restore_view_to_listener<'a>( initializer: Box::new_in( IrExpression::RestoreView(Box::new_in( RestoreViewExpr { view: RestoreViewTarget::Static(view_xref), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), flags: VariableFlags::NONE, view: Some(view_xref), @@ -457,10 +457,10 @@ fn add_restore_view_to_listener<'a>( let cloned_expr = expr.clone_in(allocator); *handler_expression = Some(Box::new_in( IrExpression::ResetView(Box::new_in( - ResetViewExpr { expr: Box::new_in(cloned_expr, allocator), source_span: None }, - allocator, + ResetViewExpr { expr: Box::new_in(cloned_expr, &allocator), source_span: None }, + &allocator, )), - allocator, + &allocator, )); } } @@ -515,9 +515,9 @@ fn create_saved_view_variable<'a>( initializer: Box::new_in( IrExpression::GetCurrentView(Box::new_in( GetCurrentViewExpr { source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), flags: VariableFlags::NONE, view: Some(view_xref), @@ -554,17 +554,17 @@ fn wrap_return_statements_in_reset_view<'a>( // Wrap the inner IR expression in ResetView let reset_expr = IrExpression::ResetView(Box::new_in( ResetViewExpr { - expr: Box::new_in(wrapped.node.clone_in(allocator), allocator), + expr: Box::new_in(wrapped.node.clone_in(allocator), &allocator), source_span: None, }, - allocator, + &allocator, )); OutputExpression::WrappedIrNode(Box::new_in( WrappedIrExpr { - node: Box::new_in(reset_expr, allocator), + node: Box::new_in(reset_expr, &allocator), source_span: wrapped.source_span, }, - allocator, + &allocator, )) } _ => { @@ -581,7 +581,7 @@ fn wrap_return_statements_in_reset_view<'a>( // Replace the return statement with the wrapped version stmt_op.statement = OutputStatement::Return(Box::new_in( ReturnStatement { value: wrapped_reset, source_span: ret_stmt.source_span }, - allocator, + &allocator, )); } } diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/store_let_optimization.rs b/crates/oxc_angular_compiler/src/pipeline/phases/store_let_optimization.rs index c59471e7f..2cfa32216 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/store_let_optimization.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/store_let_optimization.rs @@ -121,7 +121,7 @@ fn transform_store_let_exprs_in_view( // Transform expressions in each update op for op in view.update.iter_mut() { transform_store_let_in_update_op( - allocator, + &allocator, op, let_used_externally, declare_lets_to_remove, @@ -139,7 +139,7 @@ fn transform_store_let_in_update_op<'a>( match op { UpdateOp::Variable(var) => { transform_store_let_in_expr( - allocator, + &allocator, &mut var.initializer, let_used_externally, declare_lets_to_remove, @@ -147,7 +147,7 @@ fn transform_store_let_in_update_op<'a>( } UpdateOp::Property(prop) => { transform_store_let_in_expr( - allocator, + &allocator, &mut prop.expression, let_used_externally, declare_lets_to_remove, @@ -155,7 +155,7 @@ fn transform_store_let_in_update_op<'a>( } UpdateOp::StyleProp(style) => { transform_store_let_in_expr( - allocator, + &allocator, &mut style.expression, let_used_externally, declare_lets_to_remove, @@ -163,7 +163,7 @@ fn transform_store_let_in_update_op<'a>( } UpdateOp::ClassProp(class) => { transform_store_let_in_expr( - allocator, + &allocator, &mut class.expression, let_used_externally, declare_lets_to_remove, @@ -171,7 +171,7 @@ fn transform_store_let_in_update_op<'a>( } UpdateOp::Attribute(attr) => { transform_store_let_in_expr( - allocator, + &allocator, &mut attr.expression, let_used_externally, declare_lets_to_remove, @@ -179,7 +179,7 @@ fn transform_store_let_in_update_op<'a>( } UpdateOp::InterpolateText(text) => { transform_store_let_in_expr( - allocator, + &allocator, &mut text.interpolation, let_used_externally, declare_lets_to_remove, @@ -188,7 +188,7 @@ fn transform_store_let_in_update_op<'a>( UpdateOp::Conditional(cond) => { if let Some(ref mut test) = cond.test { transform_store_let_in_expr( - allocator, + &allocator, test, let_used_externally, declare_lets_to_remove, @@ -197,7 +197,7 @@ fn transform_store_let_in_update_op<'a>( for condition in cond.conditions.iter_mut() { if let Some(ref mut expr) = condition.expr { transform_store_let_in_expr( - allocator, + &allocator, expr, let_used_externally, declare_lets_to_remove, @@ -206,7 +206,7 @@ fn transform_store_let_in_update_op<'a>( } if let Some(ref mut processed) = cond.processed { transform_store_let_in_expr( - allocator, + &allocator, processed, let_used_externally, declare_lets_to_remove, @@ -214,7 +214,7 @@ fn transform_store_let_in_update_op<'a>( } if let Some(ref mut ctx_val) = cond.context_value { transform_store_let_in_expr( - allocator, + &allocator, ctx_val, let_used_externally, declare_lets_to_remove, @@ -249,7 +249,7 @@ fn transform_store_let_in_expr<'a>( // Continue transforming the replaced value transform_store_let_in_expr( - allocator, + &allocator, expr, let_used_externally, declare_lets_to_remove, @@ -285,7 +285,7 @@ fn transform_store_let_in_expr_value<'a>( // Continue transforming the replaced value transform_store_let_in_expr_value( - allocator, + &allocator, expr, let_used_externally, declare_lets_to_remove, @@ -308,7 +308,7 @@ fn transform_nested_expressions<'a>( match expr.as_mut() { IrExpression::SafeNavigationMigration(m) => { transform_store_let_in_expr_value( - allocator, + &allocator, &mut m.expr, let_used_externally, declare_lets_to_remove, @@ -317,7 +317,7 @@ fn transform_nested_expressions<'a>( IrExpression::PureFunction(pf) => { if let Some(ref mut body) = pf.body { transform_store_let_in_expr( - allocator, + &allocator, body, let_used_externally, declare_lets_to_remove, @@ -325,7 +325,7 @@ fn transform_nested_expressions<'a>( } if let Some(ref mut fn_ref) = pf.fn_ref { transform_store_let_in_expr( - allocator, + &allocator, fn_ref, let_used_externally, declare_lets_to_remove, @@ -333,7 +333,7 @@ fn transform_nested_expressions<'a>( } for arg in pf.args.iter_mut() { transform_store_let_in_expr_value( - allocator, + &allocator, arg, let_used_externally, declare_lets_to_remove, @@ -343,7 +343,7 @@ fn transform_nested_expressions<'a>( IrExpression::Interpolation(interp) => { for expr in interp.expressions.iter_mut() { transform_store_let_in_expr_value( - allocator, + &allocator, expr, let_used_externally, declare_lets_to_remove, @@ -353,7 +353,7 @@ fn transform_nested_expressions<'a>( IrExpression::PipeBinding(pb) => { for arg in pb.args.iter_mut() { transform_store_let_in_expr_value( - allocator, + &allocator, arg, let_used_externally, declare_lets_to_remove, @@ -362,7 +362,7 @@ fn transform_nested_expressions<'a>( } IrExpression::PipeBindingVariadic(pbv) => { transform_store_let_in_expr( - allocator, + &allocator, &mut pbv.args, let_used_externally, declare_lets_to_remove, @@ -370,7 +370,7 @@ fn transform_nested_expressions<'a>( } IrExpression::SafePropertyRead(spr) => { transform_store_let_in_expr( - allocator, + &allocator, &mut spr.receiver, let_used_externally, declare_lets_to_remove, @@ -378,13 +378,13 @@ fn transform_nested_expressions<'a>( } IrExpression::SafeKeyedRead(skr) => { transform_store_let_in_expr( - allocator, + &allocator, &mut skr.receiver, let_used_externally, declare_lets_to_remove, ); transform_store_let_in_expr( - allocator, + &allocator, &mut skr.index, let_used_externally, declare_lets_to_remove, @@ -392,14 +392,14 @@ fn transform_nested_expressions<'a>( } IrExpression::SafeInvokeFunction(sif) => { transform_store_let_in_expr( - allocator, + &allocator, &mut sif.receiver, let_used_externally, declare_lets_to_remove, ); for arg in sif.args.iter_mut() { transform_store_let_in_expr_value( - allocator, + &allocator, arg, let_used_externally, declare_lets_to_remove, @@ -408,13 +408,13 @@ fn transform_nested_expressions<'a>( } IrExpression::SafeTernary(st) => { transform_store_let_in_expr( - allocator, + &allocator, &mut st.guard, let_used_externally, declare_lets_to_remove, ); transform_store_let_in_expr( - allocator, + &allocator, &mut st.expr, let_used_externally, declare_lets_to_remove, @@ -422,19 +422,19 @@ fn transform_nested_expressions<'a>( } IrExpression::Ternary(t) => { transform_store_let_in_expr( - allocator, + &allocator, &mut t.condition, let_used_externally, declare_lets_to_remove, ); transform_store_let_in_expr( - allocator, + &allocator, &mut t.true_expr, let_used_externally, declare_lets_to_remove, ); transform_store_let_in_expr( - allocator, + &allocator, &mut t.false_expr, let_used_externally, declare_lets_to_remove, @@ -442,7 +442,7 @@ fn transform_nested_expressions<'a>( } IrExpression::AssignTemporary(at) => { transform_store_let_in_expr( - allocator, + &allocator, &mut at.expr, let_used_externally, declare_lets_to_remove, @@ -451,7 +451,7 @@ fn transform_nested_expressions<'a>( IrExpression::ConditionalCase(cc) => { if let Some(ref mut e) = cc.expr { transform_store_let_in_expr( - allocator, + &allocator, e, let_used_externally, declare_lets_to_remove, @@ -460,7 +460,7 @@ fn transform_nested_expressions<'a>( } IrExpression::ConstCollected(cc) => { transform_store_let_in_expr( - allocator, + &allocator, &mut cc.expr, let_used_externally, declare_lets_to_remove, @@ -468,13 +468,13 @@ fn transform_nested_expressions<'a>( } IrExpression::TwoWayBindingSet(twb) => { transform_store_let_in_expr( - allocator, + &allocator, &mut twb.target, let_used_externally, declare_lets_to_remove, ); transform_store_let_in_expr( - allocator, + &allocator, &mut twb.value, let_used_externally, declare_lets_to_remove, @@ -483,7 +483,7 @@ fn transform_nested_expressions<'a>( IrExpression::StoreLet(sl) => { // If we get here, this StoreLet is used externally, but still transform its value transform_store_let_in_expr( - allocator, + &allocator, &mut sl.value, let_used_externally, declare_lets_to_remove, @@ -491,13 +491,13 @@ fn transform_nested_expressions<'a>( } IrExpression::Binary(binary) => { transform_store_let_in_expr( - allocator, + &allocator, &mut binary.lhs, let_used_externally, declare_lets_to_remove, ); transform_store_let_in_expr( - allocator, + &allocator, &mut binary.rhs, let_used_externally, declare_lets_to_remove, @@ -505,7 +505,7 @@ fn transform_nested_expressions<'a>( } IrExpression::ResolvedPropertyRead(rpr) => { transform_store_let_in_expr( - allocator, + &allocator, &mut rpr.receiver, let_used_externally, declare_lets_to_remove, @@ -513,13 +513,13 @@ fn transform_nested_expressions<'a>( } IrExpression::ResolvedBinary(rb) => { transform_store_let_in_expr( - allocator, + &allocator, &mut rb.left, let_used_externally, declare_lets_to_remove, ); transform_store_let_in_expr( - allocator, + &allocator, &mut rb.right, let_used_externally, declare_lets_to_remove, @@ -527,14 +527,14 @@ fn transform_nested_expressions<'a>( } IrExpression::ResolvedCall(rc) => { transform_store_let_in_expr( - allocator, + &allocator, &mut rc.receiver, let_used_externally, declare_lets_to_remove, ); for arg in rc.args.iter_mut() { transform_store_let_in_expr_value( - allocator, + &allocator, arg, let_used_externally, declare_lets_to_remove, @@ -543,13 +543,13 @@ fn transform_nested_expressions<'a>( } IrExpression::ResolvedKeyedRead(rkr) => { transform_store_let_in_expr( - allocator, + &allocator, &mut rkr.receiver, let_used_externally, declare_lets_to_remove, ); transform_store_let_in_expr( - allocator, + &allocator, &mut rkr.key, let_used_externally, declare_lets_to_remove, @@ -557,7 +557,7 @@ fn transform_nested_expressions<'a>( } IrExpression::ResolvedSafePropertyRead(rspr) => { transform_store_let_in_expr( - allocator, + &allocator, &mut rspr.receiver, let_used_externally, declare_lets_to_remove, @@ -566,7 +566,7 @@ fn transform_nested_expressions<'a>( IrExpression::RestoreView(rv) => { if let crate::ir::expression::RestoreViewTarget::Dynamic(ref mut inner) = rv.view { transform_store_let_in_expr( - allocator, + &allocator, inner, let_used_externally, declare_lets_to_remove, @@ -575,7 +575,7 @@ fn transform_nested_expressions<'a>( } IrExpression::ResetView(rv) => { transform_store_let_in_expr( - allocator, + &allocator, &mut rv.expr, let_used_externally, declare_lets_to_remove, @@ -584,7 +584,7 @@ fn transform_nested_expressions<'a>( IrExpression::DerivedLiteralArray(arr) => { for entry in arr.entries.iter_mut() { transform_store_let_in_expr_value( - allocator, + &allocator, entry, let_used_externally, declare_lets_to_remove, @@ -594,7 +594,7 @@ fn transform_nested_expressions<'a>( IrExpression::DerivedLiteralMap(map) => { for value in map.values.iter_mut() { transform_store_let_in_expr_value( - allocator, + &allocator, value, let_used_externally, declare_lets_to_remove, @@ -622,7 +622,7 @@ fn transform_nested_expressions<'a>( IrExpression::LiteralArray(arr) => { for elem in arr.elements.iter_mut() { transform_store_let_in_expr_value( - allocator, + &allocator, elem, let_used_externally, declare_lets_to_remove, @@ -633,7 +633,7 @@ fn transform_nested_expressions<'a>( IrExpression::LiteralMap(map) => { for value in map.values.iter_mut() { transform_store_let_in_expr_value( - allocator, + &allocator, value, let_used_externally, declare_lets_to_remove, @@ -642,7 +642,7 @@ fn transform_nested_expressions<'a>( } IrExpression::Not(n) => { transform_store_let_in_expr( - allocator, + &allocator, &mut n.expr, let_used_externally, declare_lets_to_remove, @@ -650,7 +650,7 @@ fn transform_nested_expressions<'a>( } IrExpression::Unary(u) => { transform_store_let_in_expr( - allocator, + &allocator, &mut u.expr, let_used_externally, declare_lets_to_remove, @@ -658,7 +658,7 @@ fn transform_nested_expressions<'a>( } IrExpression::Typeof(t) => { transform_store_let_in_expr( - allocator, + &allocator, &mut t.expr, let_used_externally, declare_lets_to_remove, @@ -666,7 +666,7 @@ fn transform_nested_expressions<'a>( } IrExpression::Void(v) => { transform_store_let_in_expr( - allocator, + &allocator, &mut v.expr, let_used_externally, declare_lets_to_remove, @@ -675,7 +675,7 @@ fn transform_nested_expressions<'a>( IrExpression::ResolvedTemplateLiteral(rtl) => { for e in rtl.expressions.iter_mut() { transform_store_let_in_expr_value( - allocator, + &allocator, e, let_used_externally, declare_lets_to_remove, @@ -685,7 +685,7 @@ fn transform_nested_expressions<'a>( IrExpression::ArrowFunction(arrow_fn) => { transform_store_let_in_expr_value( - allocator, + &allocator, &mut arrow_fn.body, let_used_externally, declare_lets_to_remove, @@ -693,7 +693,7 @@ fn transform_nested_expressions<'a>( } IrExpression::Parenthesized(paren) => { transform_store_let_in_expr_value( - allocator, + &allocator, &mut paren.expr, let_used_externally, declare_lets_to_remove, @@ -712,7 +712,7 @@ fn transform_nested_in_expr_value<'a>( match expr { IrExpression::SafeNavigationMigration(m) => { transform_store_let_in_expr_value( - allocator, + &allocator, &mut m.expr, let_used_externally, declare_lets_to_remove, @@ -721,7 +721,7 @@ fn transform_nested_in_expr_value<'a>( IrExpression::PureFunction(pf) => { if let Some(ref mut body) = pf.body { transform_store_let_in_expr( - allocator, + &allocator, body, let_used_externally, declare_lets_to_remove, @@ -729,7 +729,7 @@ fn transform_nested_in_expr_value<'a>( } if let Some(ref mut fn_ref) = pf.fn_ref { transform_store_let_in_expr( - allocator, + &allocator, fn_ref, let_used_externally, declare_lets_to_remove, @@ -737,7 +737,7 @@ fn transform_nested_in_expr_value<'a>( } for arg in pf.args.iter_mut() { transform_store_let_in_expr_value( - allocator, + &allocator, arg, let_used_externally, declare_lets_to_remove, @@ -747,7 +747,7 @@ fn transform_nested_in_expr_value<'a>( IrExpression::Interpolation(interp) => { for expr in interp.expressions.iter_mut() { transform_store_let_in_expr_value( - allocator, + &allocator, expr, let_used_externally, declare_lets_to_remove, @@ -757,7 +757,7 @@ fn transform_nested_in_expr_value<'a>( IrExpression::PipeBinding(pb) => { for arg in pb.args.iter_mut() { transform_store_let_in_expr_value( - allocator, + &allocator, arg, let_used_externally, declare_lets_to_remove, @@ -766,7 +766,7 @@ fn transform_nested_in_expr_value<'a>( } IrExpression::PipeBindingVariadic(pbv) => { transform_store_let_in_expr( - allocator, + &allocator, &mut pbv.args, let_used_externally, declare_lets_to_remove, @@ -774,7 +774,7 @@ fn transform_nested_in_expr_value<'a>( } IrExpression::SafePropertyRead(spr) => { transform_store_let_in_expr( - allocator, + &allocator, &mut spr.receiver, let_used_externally, declare_lets_to_remove, @@ -782,13 +782,13 @@ fn transform_nested_in_expr_value<'a>( } IrExpression::SafeKeyedRead(skr) => { transform_store_let_in_expr( - allocator, + &allocator, &mut skr.receiver, let_used_externally, declare_lets_to_remove, ); transform_store_let_in_expr( - allocator, + &allocator, &mut skr.index, let_used_externally, declare_lets_to_remove, @@ -796,14 +796,14 @@ fn transform_nested_in_expr_value<'a>( } IrExpression::SafeInvokeFunction(sif) => { transform_store_let_in_expr( - allocator, + &allocator, &mut sif.receiver, let_used_externally, declare_lets_to_remove, ); for arg in sif.args.iter_mut() { transform_store_let_in_expr_value( - allocator, + &allocator, arg, let_used_externally, declare_lets_to_remove, @@ -812,13 +812,13 @@ fn transform_nested_in_expr_value<'a>( } IrExpression::SafeTernary(st) => { transform_store_let_in_expr( - allocator, + &allocator, &mut st.guard, let_used_externally, declare_lets_to_remove, ); transform_store_let_in_expr( - allocator, + &allocator, &mut st.expr, let_used_externally, declare_lets_to_remove, @@ -826,19 +826,19 @@ fn transform_nested_in_expr_value<'a>( } IrExpression::Ternary(t) => { transform_store_let_in_expr( - allocator, + &allocator, &mut t.condition, let_used_externally, declare_lets_to_remove, ); transform_store_let_in_expr( - allocator, + &allocator, &mut t.true_expr, let_used_externally, declare_lets_to_remove, ); transform_store_let_in_expr( - allocator, + &allocator, &mut t.false_expr, let_used_externally, declare_lets_to_remove, @@ -846,7 +846,7 @@ fn transform_nested_in_expr_value<'a>( } IrExpression::AssignTemporary(at) => { transform_store_let_in_expr( - allocator, + &allocator, &mut at.expr, let_used_externally, declare_lets_to_remove, @@ -855,7 +855,7 @@ fn transform_nested_in_expr_value<'a>( IrExpression::ConditionalCase(cc) => { if let Some(ref mut e) = cc.expr { transform_store_let_in_expr( - allocator, + &allocator, e, let_used_externally, declare_lets_to_remove, @@ -864,7 +864,7 @@ fn transform_nested_in_expr_value<'a>( } IrExpression::ConstCollected(cc) => { transform_store_let_in_expr( - allocator, + &allocator, &mut cc.expr, let_used_externally, declare_lets_to_remove, @@ -872,13 +872,13 @@ fn transform_nested_in_expr_value<'a>( } IrExpression::TwoWayBindingSet(twb) => { transform_store_let_in_expr( - allocator, + &allocator, &mut twb.target, let_used_externally, declare_lets_to_remove, ); transform_store_let_in_expr( - allocator, + &allocator, &mut twb.value, let_used_externally, declare_lets_to_remove, @@ -887,7 +887,7 @@ fn transform_nested_in_expr_value<'a>( IrExpression::StoreLet(sl) => { // If we get here, this StoreLet is used externally, but still transform its value transform_store_let_in_expr( - allocator, + &allocator, &mut sl.value, let_used_externally, declare_lets_to_remove, @@ -895,13 +895,13 @@ fn transform_nested_in_expr_value<'a>( } IrExpression::Binary(binary) => { transform_store_let_in_expr( - allocator, + &allocator, &mut binary.lhs, let_used_externally, declare_lets_to_remove, ); transform_store_let_in_expr( - allocator, + &allocator, &mut binary.rhs, let_used_externally, declare_lets_to_remove, @@ -909,7 +909,7 @@ fn transform_nested_in_expr_value<'a>( } IrExpression::ResolvedPropertyRead(rpr) => { transform_store_let_in_expr( - allocator, + &allocator, &mut rpr.receiver, let_used_externally, declare_lets_to_remove, @@ -917,13 +917,13 @@ fn transform_nested_in_expr_value<'a>( } IrExpression::ResolvedBinary(rb) => { transform_store_let_in_expr( - allocator, + &allocator, &mut rb.left, let_used_externally, declare_lets_to_remove, ); transform_store_let_in_expr( - allocator, + &allocator, &mut rb.right, let_used_externally, declare_lets_to_remove, @@ -931,14 +931,14 @@ fn transform_nested_in_expr_value<'a>( } IrExpression::ResolvedCall(rc) => { transform_store_let_in_expr( - allocator, + &allocator, &mut rc.receiver, let_used_externally, declare_lets_to_remove, ); for arg in rc.args.iter_mut() { transform_store_let_in_expr_value( - allocator, + &allocator, arg, let_used_externally, declare_lets_to_remove, @@ -947,13 +947,13 @@ fn transform_nested_in_expr_value<'a>( } IrExpression::ResolvedKeyedRead(rkr) => { transform_store_let_in_expr( - allocator, + &allocator, &mut rkr.receiver, let_used_externally, declare_lets_to_remove, ); transform_store_let_in_expr( - allocator, + &allocator, &mut rkr.key, let_used_externally, declare_lets_to_remove, @@ -961,7 +961,7 @@ fn transform_nested_in_expr_value<'a>( } IrExpression::ResolvedSafePropertyRead(rspr) => { transform_store_let_in_expr( - allocator, + &allocator, &mut rspr.receiver, let_used_externally, declare_lets_to_remove, @@ -970,7 +970,7 @@ fn transform_nested_in_expr_value<'a>( IrExpression::RestoreView(rv) => { if let crate::ir::expression::RestoreViewTarget::Dynamic(ref mut inner) = rv.view { transform_store_let_in_expr( - allocator, + &allocator, inner, let_used_externally, declare_lets_to_remove, @@ -979,7 +979,7 @@ fn transform_nested_in_expr_value<'a>( } IrExpression::ResetView(rv) => { transform_store_let_in_expr( - allocator, + &allocator, &mut rv.expr, let_used_externally, declare_lets_to_remove, @@ -988,7 +988,7 @@ fn transform_nested_in_expr_value<'a>( IrExpression::DerivedLiteralArray(arr) => { for entry in arr.entries.iter_mut() { transform_store_let_in_expr_value( - allocator, + &allocator, entry, let_used_externally, declare_lets_to_remove, @@ -998,7 +998,7 @@ fn transform_nested_in_expr_value<'a>( IrExpression::DerivedLiteralMap(map) => { for value in map.values.iter_mut() { transform_store_let_in_expr_value( - allocator, + &allocator, value, let_used_externally, declare_lets_to_remove, @@ -1008,7 +1008,7 @@ fn transform_nested_in_expr_value<'a>( IrExpression::LiteralArray(arr) => { for elem in arr.elements.iter_mut() { transform_store_let_in_expr_value( - allocator, + &allocator, elem, let_used_externally, declare_lets_to_remove, @@ -1018,7 +1018,7 @@ fn transform_nested_in_expr_value<'a>( IrExpression::LiteralMap(map) => { for value in map.values.iter_mut() { transform_store_let_in_expr_value( - allocator, + &allocator, value, let_used_externally, declare_lets_to_remove, @@ -1044,7 +1044,7 @@ fn transform_nested_in_expr_value<'a>( | IrExpression::ReadVariable(_) => {} IrExpression::Not(n) => { transform_store_let_in_expr_value( - allocator, + &allocator, n.expr.as_mut(), let_used_externally, declare_lets_to_remove, @@ -1052,7 +1052,7 @@ fn transform_nested_in_expr_value<'a>( } IrExpression::Unary(u) => { transform_store_let_in_expr_value( - allocator, + &allocator, u.expr.as_mut(), let_used_externally, declare_lets_to_remove, @@ -1060,7 +1060,7 @@ fn transform_nested_in_expr_value<'a>( } IrExpression::Typeof(t) => { transform_store_let_in_expr_value( - allocator, + &allocator, t.expr.as_mut(), let_used_externally, declare_lets_to_remove, @@ -1068,7 +1068,7 @@ fn transform_nested_in_expr_value<'a>( } IrExpression::Void(v) => { transform_store_let_in_expr_value( - allocator, + &allocator, v.expr.as_mut(), let_used_externally, declare_lets_to_remove, @@ -1077,7 +1077,7 @@ fn transform_nested_in_expr_value<'a>( IrExpression::ResolvedTemplateLiteral(rtl) => { for e in rtl.expressions.iter_mut() { transform_store_let_in_expr_value( - allocator, + &allocator, e, let_used_externally, declare_lets_to_remove, @@ -1087,7 +1087,7 @@ fn transform_nested_in_expr_value<'a>( IrExpression::ArrowFunction(arrow_fn) => { transform_store_let_in_expr_value( - allocator, + &allocator, &mut arrow_fn.body, let_used_externally, declare_lets_to_remove, @@ -1095,7 +1095,7 @@ fn transform_nested_in_expr_value<'a>( } IrExpression::Parenthesized(paren) => { transform_store_let_in_expr_value( - allocator, + &allocator, &mut paren.expr, let_used_externally, declare_lets_to_remove, diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/strip_nonrequired_parentheses.rs b/crates/oxc_angular_compiler/src/pipeline/phases/strip_nonrequired_parentheses.rs index 222712c40..288365c86 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/strip_nonrequired_parentheses.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/strip_nonrequired_parentheses.rs @@ -54,7 +54,7 @@ pub fn strip_nonrequired_parentheses(job: &mut ComponentCompilationJob<'_>) { transform_expressions_in_create_op( op, &|expr, _flags| { - strip_parens_in_expression(expr, &required_parens, allocator); + strip_parens_in_expression(expr, &required_parens, &allocator); }, VisitorContextFlag::NONE, ); @@ -63,7 +63,7 @@ pub fn strip_nonrequired_parentheses(job: &mut ComponentCompilationJob<'_>) { transform_expressions_in_update_op( op, &|expr, _flags| { - strip_parens_in_expression(expr, &required_parens, allocator); + strip_parens_in_expression(expr, &required_parens, &allocator); }, VisitorContextFlag::NONE, ); @@ -613,8 +613,8 @@ fn strip_parens_in_expression<'a>( // We need to unwrap the AST parentheses // This is tricky because we need to clone the inner expression let inner_cloned = - crate::ir::expression::clone_angular_expression(&paren.expression, allocator); - *expr = IrExpression::Ast(ArenaBox::new_in(inner_cloned, allocator)); + crate::ir::expression::clone_angular_expression(&paren.expression, &allocator); + *expr = IrExpression::Ast(ArenaBox::new_in(inner_cloned, &allocator)); } } } @@ -641,7 +641,7 @@ pub fn strip_nonrequired_parentheses_for_host(job: &mut HostBindingCompilationJo transform_expressions_in_create_op( op, &|expr, _flags| { - strip_parens_in_expression(expr, &required_parens, allocator); + strip_parens_in_expression(expr, &required_parens, &allocator); }, VisitorContextFlag::NONE, ); @@ -650,7 +650,7 @@ pub fn strip_nonrequired_parentheses_for_host(job: &mut HostBindingCompilationJo transform_expressions_in_update_op( op, &|expr, _flags| { - strip_parens_in_expression(expr, &required_parens, allocator); + strip_parens_in_expression(expr, &required_parens, &allocator); }, VisitorContextFlag::NONE, ); diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/style_binding_specialization.rs b/crates/oxc_angular_compiler/src/pipeline/phases/style_binding_specialization.rs index cb07579e6..0b1ac2ea9 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/style_binding_specialization.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/style_binding_specialization.rs @@ -28,11 +28,11 @@ pub fn specialize_style_bindings(job: &mut ComponentCompilationJob<'_>) { let allocator = job.allocator; // Process root view - specialize_in_view(&mut job.root.update, allocator); + specialize_in_view(&mut job.root.update, &allocator); // Process embedded views for view in job.views.values_mut() { - specialize_in_view(&mut view.update, allocator); + specialize_in_view(&mut view.update, &allocator); } } @@ -42,9 +42,9 @@ fn create_placeholder_expression<'a>( ) -> Box<'a, IrExpression<'a>> { let empty_expr = AngularExpression::Empty(Box::new_in( EmptyExpr { span: ParseSpan::new(0, 0), source_span: AbsoluteSourceSpan::new(0, 0) }, - allocator, + &allocator, )); - Box::new_in(IrExpression::Ast(Box::new_in(empty_expr, allocator)), allocator) + Box::new_in(IrExpression::Ast(Box::new_in(empty_expr, &allocator)), &allocator) } /// Specializes style/class bindings within a single view's update list. @@ -148,5 +148,5 @@ fn specialize_in_view<'a>( /// Host version - only processes the root unit (no embedded views). pub fn specialize_style_bindings_for_host(job: &mut HostBindingCompilationJob<'_>) { let allocator = job.allocator; - specialize_in_view(&mut job.root.update, allocator); + specialize_in_view(&mut job.root.update, &allocator); } diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/temporary_variables.rs b/crates/oxc_angular_compiler/src/pipeline/phases/temporary_variables.rs index bbfbd2efd..becb984bc 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/temporary_variables.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/temporary_variables.rs @@ -64,10 +64,10 @@ pub fn generate_temporary_variables(job: &mut ComponentCompilationJob<'_>) { // Process all views - both create and update ops (matching TypeScript behavior) for view in job.all_views_mut() { - let mut create_stmts = generate_temporaries_for_create(&mut view.create, allocator); + let mut create_stmts = generate_temporaries_for_create(&mut view.create, &allocator); view.create.prepend(&mut create_stmts); - let mut update_stmts = generate_temporaries_for_update(&mut view.update, allocator); + let mut update_stmts = generate_temporaries_for_update(&mut view.update, &allocator); view.update.prepend(&mut update_stmts); } } @@ -111,7 +111,7 @@ fn generate_temporaries_for_create<'a>( if flags.contains(VisitorContextFlag::IN_CHILD_OPERATION) { return; } - assign_temp_names(expr, &tracker, allocator); + assign_temp_names(expr, &tracker, &allocator); }, VisitorContextFlag::NONE, ); @@ -141,26 +141,26 @@ fn generate_temporaries_for_create<'a>( let mut handler_stmts = generate_temporaries_for_handler_ops_with_expression( &mut listener.handler_ops, &mut listener.handler_expression, - allocator, + &allocator, ); - prepend_update_ops(&mut listener.handler_ops, &mut handler_stmts, allocator); + prepend_update_ops(&mut listener.handler_ops, &mut handler_stmts, &allocator); } CreateOp::AnimationListener(listener) => { let mut handler_stmts = - generate_temporaries_for_handler_ops(&mut listener.handler_ops, allocator); - prepend_update_ops(&mut listener.handler_ops, &mut handler_stmts, allocator); + generate_temporaries_for_handler_ops(&mut listener.handler_ops, &allocator); + prepend_update_ops(&mut listener.handler_ops, &mut handler_stmts, &allocator); } CreateOp::TwoWayListener(listener) => { let mut handler_stmts = - generate_temporaries_for_handler_ops(&mut listener.handler_ops, allocator); - prepend_update_ops(&mut listener.handler_ops, &mut handler_stmts, allocator); + generate_temporaries_for_handler_ops(&mut listener.handler_ops, &allocator); + prepend_update_ops(&mut listener.handler_ops, &mut handler_stmts, &allocator); } CreateOp::RepeaterCreate(repeater) => { // Process track_by_ops if present if let Some(track_by_ops) = &mut repeater.track_by_ops { let mut track_stmts = - generate_temporaries_for_handler_ops(track_by_ops, allocator); - prepend_update_ops(track_by_ops, &mut track_stmts, allocator); + generate_temporaries_for_handler_ops(track_by_ops, &allocator); + prepend_update_ops(track_by_ops, &mut track_stmts, &allocator); } } _ => {} @@ -207,7 +207,7 @@ fn generate_temporaries_for_handler_ops<'a>( if flags.contains(VisitorContextFlag::IN_CHILD_OPERATION) { return; } - assign_temp_names(expr, &tracker, allocator); + assign_temp_names(expr, &tracker, &allocator); }, VisitorContextFlag::NONE, ); @@ -245,7 +245,7 @@ fn generate_temporaries_for_handler_ops_with_expression<'a>( allocator: &'a Allocator, ) -> Vec> { // First, process handler_ops exactly like generate_temporaries_for_handler_ops - let mut generated_statements = generate_temporaries_for_handler_ops(ops, allocator); + let mut generated_statements = generate_temporaries_for_handler_ops(ops, &allocator); // Then process handler_expression once, with op_count = ops.len(). // In Angular TS, the return expression is the last entry in handlerOps, @@ -277,7 +277,7 @@ fn generate_temporaries_for_handler_ops_with_expression<'a>( if flags.contains(VisitorContextFlag::IN_CHILD_OPERATION) { return; } - assign_temp_names(expr, &tracker, allocator); + assign_temp_names(expr, &tracker, &allocator); }, VisitorContextFlag::NONE, ); @@ -308,7 +308,7 @@ fn prepend_update_ops<'a>( } // Create a new vec with capacity for both stmts and ops - let mut new_ops = oxc_allocator::Vec::with_capacity_in(stmts.len() + ops.len(), allocator); + let mut new_ops = oxc_allocator::Vec::with_capacity_in(stmts.len() + ops.len(), &allocator); // Add statement ops first (prepend) for stmt in stmts.drain(..) { @@ -360,7 +360,7 @@ fn generate_temporaries_for_update<'a>( if flags.contains(VisitorContextFlag::IN_CHILD_OPERATION) { return; } - assign_temp_names(expr, &tracker, allocator); + assign_temp_names(expr, &tracker, &allocator); }, VisitorContextFlag::NONE, ); @@ -394,7 +394,7 @@ fn create_declare_var_statement<'a>(allocator: &'a Allocator, name: &str) -> Out leading_comment: None, source_span: None, }, - allocator, + &allocator, )) } @@ -426,114 +426,114 @@ fn assign_temp_names<'a>( } // Recursively process nested expressions IrExpression::SafeNavigationMigration(m) => { - assign_temp_names(&mut m.expr, tracker, allocator); + assign_temp_names(&mut m.expr, tracker, &allocator); } IrExpression::SafeTernary(st) => { - assign_temp_names(&mut st.guard, tracker, allocator); - assign_temp_names(&mut st.expr, tracker, allocator); + assign_temp_names(&mut st.guard, tracker, &allocator); + assign_temp_names(&mut st.expr, tracker, &allocator); } IrExpression::Ternary(t) => { - assign_temp_names(&mut t.condition, tracker, allocator); - assign_temp_names(&mut t.true_expr, tracker, allocator); - assign_temp_names(&mut t.false_expr, tracker, allocator); + assign_temp_names(&mut t.condition, tracker, &allocator); + assign_temp_names(&mut t.true_expr, tracker, &allocator); + assign_temp_names(&mut t.false_expr, tracker, &allocator); } IrExpression::SafePropertyRead(sp) => { - assign_temp_names(&mut sp.receiver, tracker, allocator); + assign_temp_names(&mut sp.receiver, tracker, &allocator); } IrExpression::SafeKeyedRead(sk) => { - assign_temp_names(&mut sk.receiver, tracker, allocator); - assign_temp_names(&mut sk.index, tracker, allocator); + assign_temp_names(&mut sk.receiver, tracker, &allocator); + assign_temp_names(&mut sk.index, tracker, &allocator); } IrExpression::SafeInvokeFunction(sf) => { - assign_temp_names(&mut sf.receiver, tracker, allocator); + assign_temp_names(&mut sf.receiver, tracker, &allocator); for arg in sf.args.iter_mut() { - assign_temp_names(arg, tracker, allocator); + assign_temp_names(arg, tracker, &allocator); } } IrExpression::PipeBinding(pb) => { for arg in pb.args.iter_mut() { - assign_temp_names(arg, tracker, allocator); + assign_temp_names(arg, tracker, &allocator); } } IrExpression::PipeBindingVariadic(pbv) => { - assign_temp_names(&mut pbv.args, tracker, allocator); + assign_temp_names(&mut pbv.args, tracker, &allocator); } IrExpression::PureFunction(pf) => { for arg in pf.args.iter_mut() { - assign_temp_names(arg, tracker, allocator); + assign_temp_names(arg, tracker, &allocator); } } IrExpression::Interpolation(i) => { for e in i.expressions.iter_mut() { - assign_temp_names(e, tracker, allocator); + assign_temp_names(e, tracker, &allocator); } } IrExpression::RestoreView(rv) => { use crate::ir::expression::RestoreViewTarget; if let RestoreViewTarget::Dynamic(e) = &mut rv.view { - assign_temp_names(e, tracker, allocator); + assign_temp_names(e, tracker, &allocator); } } IrExpression::ResetView(rv) => { - assign_temp_names(&mut rv.expr, tracker, allocator); + assign_temp_names(&mut rv.expr, tracker, &allocator); } IrExpression::ConditionalCase(cc) => { if let Some(e) = &mut cc.expr { - assign_temp_names(e, tracker, allocator); + assign_temp_names(e, tracker, &allocator); } } IrExpression::TwoWayBindingSet(tbs) => { - assign_temp_names(&mut tbs.target, tracker, allocator); - assign_temp_names(&mut tbs.value, tracker, allocator); + assign_temp_names(&mut tbs.target, tracker, &allocator); + assign_temp_names(&mut tbs.value, tracker, &allocator); } IrExpression::StoreLet(sl) => { - assign_temp_names(&mut sl.value, tracker, allocator); + assign_temp_names(&mut sl.value, tracker, &allocator); } IrExpression::ConstCollected(cc) => { - assign_temp_names(&mut cc.expr, tracker, allocator); + assign_temp_names(&mut cc.expr, tracker, &allocator); } IrExpression::Binary(binary) => { - assign_temp_names(&mut binary.lhs, tracker, allocator); - assign_temp_names(&mut binary.rhs, tracker, allocator); + assign_temp_names(&mut binary.lhs, tracker, &allocator); + assign_temp_names(&mut binary.rhs, tracker, &allocator); } IrExpression::ResolvedPropertyRead(rpr) => { - assign_temp_names(&mut rpr.receiver, tracker, allocator); + assign_temp_names(&mut rpr.receiver, tracker, &allocator); } IrExpression::ResolvedBinary(rb) => { - assign_temp_names(&mut rb.left, tracker, allocator); - assign_temp_names(&mut rb.right, tracker, allocator); + assign_temp_names(&mut rb.left, tracker, &allocator); + assign_temp_names(&mut rb.right, tracker, &allocator); } IrExpression::ResolvedCall(rc) => { - assign_temp_names(&mut rc.receiver, tracker, allocator); + assign_temp_names(&mut rc.receiver, tracker, &allocator); for arg in rc.args.iter_mut() { - assign_temp_names(arg, tracker, allocator); + assign_temp_names(arg, tracker, &allocator); } } IrExpression::ResolvedKeyedRead(rkr) => { - assign_temp_names(&mut rkr.receiver, tracker, allocator); - assign_temp_names(&mut rkr.key, tracker, allocator); + assign_temp_names(&mut rkr.receiver, tracker, &allocator); + assign_temp_names(&mut rkr.key, tracker, &allocator); } IrExpression::ResolvedSafePropertyRead(rspr) => { - assign_temp_names(&mut rspr.receiver, tracker, allocator); + assign_temp_names(&mut rspr.receiver, tracker, &allocator); } IrExpression::DerivedLiteralArray(arr) => { for entry in arr.entries.iter_mut() { - assign_temp_names(entry, tracker, allocator); + assign_temp_names(entry, tracker, &allocator); } } IrExpression::DerivedLiteralMap(map) => { for value in map.values.iter_mut() { - assign_temp_names(value, tracker, allocator); + assign_temp_names(value, tracker, &allocator); } } IrExpression::LiteralArray(arr) => { for elem in arr.elements.iter_mut() { - assign_temp_names(elem, tracker, allocator); + assign_temp_names(elem, tracker, &allocator); } } IrExpression::LiteralMap(map) => { for value in map.values.iter_mut() { - assign_temp_names(value, tracker, allocator); + assign_temp_names(value, tracker, &allocator); } } // Leaf expressions - no nested expressions @@ -557,28 +557,28 @@ fn assign_temp_names<'a>( // AssignTemporary/ReadTemporary - those only exist at the IR level } IrExpression::Not(n) => { - assign_temp_names(&mut n.expr, tracker, allocator); + assign_temp_names(&mut n.expr, tracker, &allocator); } IrExpression::Unary(u) => { - assign_temp_names(&mut u.expr, tracker, allocator); + assign_temp_names(&mut u.expr, tracker, &allocator); } IrExpression::Typeof(t) => { - assign_temp_names(&mut t.expr, tracker, allocator); + assign_temp_names(&mut t.expr, tracker, &allocator); } IrExpression::Void(v) => { - assign_temp_names(&mut v.expr, tracker, allocator); + assign_temp_names(&mut v.expr, tracker, &allocator); } IrExpression::ResolvedTemplateLiteral(rtl) => { for e in rtl.expressions.iter_mut() { - assign_temp_names(e, tracker, allocator); + assign_temp_names(e, tracker, &allocator); } } IrExpression::ArrowFunction(arrow_fn) => { - assign_temp_names(&mut arrow_fn.body, tracker, allocator); + assign_temp_names(&mut arrow_fn.body, tracker, &allocator); } IrExpression::Parenthesized(paren) => { - assign_temp_names(&mut paren.expr, tracker, allocator); + assign_temp_names(&mut paren.expr, tracker, &allocator); } } } @@ -669,9 +669,9 @@ impl TempVarTracker { pub fn generate_temporary_variables_for_host(job: &mut HostBindingCompilationJob<'_>) { let allocator = job.allocator; - let mut create_stmts = generate_temporaries_for_create(&mut job.root.create, allocator); + let mut create_stmts = generate_temporaries_for_create(&mut job.root.create, &allocator); job.root.create.prepend(&mut create_stmts); - let mut update_stmts = generate_temporaries_for_update(&mut job.root.update, allocator); + let mut update_stmts = generate_temporaries_for_update(&mut job.root.update, &allocator); job.root.update.prepend(&mut update_stmts); } diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/track_fn_optimization.rs b/crates/oxc_angular_compiler/src/pipeline/phases/track_fn_optimization.rs index 740d6ad8f..474d0e000 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/track_fn_optimization.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/track_fn_optimization.rs @@ -114,7 +114,7 @@ fn optimize_track_expression<'a>( found_context.set(true); *expr = IrExpression::TrackContext(oxc_allocator::Box::new_in( TrackContextExpr { view: ctx.view, source_span: None }, - allocator, + &allocator, )); } }, @@ -135,21 +135,21 @@ fn optimize_track_expression<'a>( // We wrap the IR expression in WrappedIrNode so it will be resolved during reify let track_output = OutputExpression::WrappedIrNode(oxc_allocator::Box::new_in( WrappedIrExpr { - node: oxc_allocator::Box::new_in(rep.track.clone_in(allocator), allocator), + node: oxc_allocator::Box::new_in(rep.track.clone_in(allocator), &allocator), source_span: None, }, - allocator, + &allocator, )); let return_stmt = OutputStatement::Return(oxc_allocator::Box::new_in( ReturnStatement { value: track_output, source_span: None }, - allocator, + &allocator, )); let statement_op = UpdateOp::Statement(StatementOp { base: UpdateOpBase::default(), statement: return_stmt }); - let mut track_by_ops = oxc_allocator::Vec::new_in(allocator); + let mut track_by_ops = oxc_allocator::Vec::new_in(&allocator); track_by_ops.push(statement_op); rep.track_by_ops = Some(track_by_ops); } @@ -312,34 +312,34 @@ mod tests { ) -> IrExpression<'a> { let ctx = IrExpression::Context(oxc_allocator::Box::new_in( ContextExpr { view: context_view, source_span: None }, - alloc, + &alloc, )); let prop_read = IrExpression::ResolvedPropertyRead(oxc_allocator::Box::new_in( ResolvedPropertyReadExpr { - receiver: oxc_allocator::Box::new_in(ctx, alloc), + receiver: oxc_allocator::Box::new_in(ctx, &alloc), name: Ident::from(method_name), optional: false, source_span: None, }, - alloc, + &alloc, )); let index_arg = IrExpression::OutputExpr(oxc_allocator::Box::new_in( OutputExpression::ReadVar(oxc_allocator::Box::new_in( ReadVarExpr { name: Ident::from("$index"), source_span: None }, - alloc, + &alloc, )), - alloc, + &alloc, )); - let mut args = oxc_allocator::Vec::new_in(alloc); + let mut args = oxc_allocator::Vec::new_in(&alloc); args.push(index_arg); IrExpression::ResolvedCall(oxc_allocator::Box::new_in( ResolvedCallExpr { - receiver: oxc_allocator::Box::new_in(prop_read, alloc), + receiver: oxc_allocator::Box::new_in(prop_read, &alloc), args, optional: false, source_span: None, }, - alloc, + &alloc, )) } diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/track_variables.rs b/crates/oxc_angular_compiler/src/pipeline/phases/track_variables.rs index 6c0ce8382..2aef95ba7 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/track_variables.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/track_variables.rs @@ -48,7 +48,7 @@ pub fn generate_track_variables(job: &mut ComponentCompilationJob<'_>) { // SAFETY: We're only reading from expression_store, not modifying it let expressions = unsafe { &*expression_store_ptr }; transform_track_expression( - allocator, + &allocator, &mut rep.track, &index_names, implicit_name.as_ref(), @@ -81,9 +81,9 @@ fn transform_track_expression<'a>( *inner_expr = IrExpression::OutputExpr(Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("$index"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, )); return; } @@ -95,9 +95,9 @@ fn transform_track_expression<'a>( *inner_expr = IrExpression::OutputExpr(Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("$item"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, )); return; } @@ -108,9 +108,9 @@ fn transform_track_expression<'a>( *inner_expr = IrExpression::OutputExpr(Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("$item"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, )); return; } @@ -120,7 +120,7 @@ fn transform_track_expression<'a>( if let IrExpression::Ast(ast_expr) = inner_expr { // Try to transform the entire AST expression, handling nested property reads if let Some(transformed) = transform_angular_expression_for_track( - allocator, + &allocator, ast_expr.as_ref(), &index_names_clone, implicit_name_clone.as_ref(), @@ -135,7 +135,7 @@ fn transform_track_expression<'a>( let stored_expr = expressions.get(*id); // Try to transform the stored expression, handling nested property reads if let Some(transformed) = transform_angular_expression_for_track( - allocator, + &allocator, stored_expr, &index_names_clone, implicit_name_clone.as_ref(), @@ -172,9 +172,9 @@ fn transform_angular_expression_for_track<'a>( return Some(IrExpression::OutputExpr(Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("$index"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ))); } @@ -184,9 +184,9 @@ fn transform_angular_expression_for_track<'a>( return Some(IrExpression::OutputExpr(Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("$item"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ))); } } @@ -196,9 +196,9 @@ fn transform_angular_expression_for_track<'a>( return Some(IrExpression::OutputExpr(Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("$item"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ))); } @@ -209,7 +209,7 @@ fn transform_angular_expression_for_track<'a>( AngularExpression::PropertyRead(prop_read) => { // Try to transform the receiver if let Some(transformed_receiver) = transform_angular_expression_for_track( - allocator, + &allocator, &prop_read.receiver, index_names, implicit_name, @@ -217,12 +217,12 @@ fn transform_angular_expression_for_track<'a>( // Build a resolved property read with the transformed receiver return Some(IrExpression::ResolvedPropertyRead(Box::new_in( ResolvedPropertyReadExpr { - receiver: Box::new_in(transformed_receiver, allocator), + receiver: Box::new_in(transformed_receiver, &allocator), name: prop_read.name.clone(), optional: false, source_span: None, }, - allocator, + &allocator, ))); } None diff --git a/crates/oxc_angular_compiler/src/pipeline/phases/variable_optimization.rs b/crates/oxc_angular_compiler/src/pipeline/phases/variable_optimization.rs index 3bf95efb7..22649574f 100644 --- a/crates/oxc_angular_compiler/src/pipeline/phases/variable_optimization.rs +++ b/crates/oxc_angular_compiler/src/pipeline/phases/variable_optimization.rs @@ -474,9 +474,9 @@ fn inline_always_inline_variables(job: &mut ComponentCompilationJob<'_>) { for view_xref in view_xrefs { // Process update ops - inline_always_inline_in_op_list_update(job, view_xref, allocator); + inline_always_inline_in_op_list_update(job, view_xref, &allocator); // Process create ops - inline_always_inline_in_op_list_create(job, view_xref, allocator); + inline_always_inline_in_op_list_create(job, view_xref, &allocator); // Process listener handler_ops and repeater trackByOps // Per TypeScript's variable_optimization.ts lines 36-47: // for (const op of unit.create) { @@ -486,7 +486,7 @@ fn inline_always_inline_variables(job: &mut ComponentCompilationJob<'_>) { // inlineAlwaysInlineVariables(op.trackByOps); // } // } - inline_always_inline_in_listener_handler_ops(job, view_xref, allocator); + inline_always_inline_in_listener_handler_ops(job, view_xref, &allocator); } } @@ -513,33 +513,33 @@ fn inline_always_inline_in_listener_handler_ops<'a>( inline_always_inline_in_handler_ops_and_expr( &mut listener.handler_ops, listener.handler_expression.as_mut(), - allocator, + &allocator, ); } CreateOp::TwoWayListener(listener) => { inline_always_inline_in_handler_ops_and_expr( &mut listener.handler_ops, None, // TwoWayListener doesn't have handler_expression - allocator, + &allocator, ); } CreateOp::AnimationListener(listener) => { inline_always_inline_in_handler_ops_and_expr( &mut listener.handler_ops, None, // AnimationListener doesn't have handler_expression - allocator, + &allocator, ); } CreateOp::Animation(animation) => { inline_always_inline_in_handler_ops_and_expr( &mut animation.handler_ops, None, // Animation doesn't have handler_expression - allocator, + &allocator, ); } CreateOp::RepeaterCreate(repeater) => { if let Some(track_by_ops) = &mut repeater.track_by_ops { - inline_always_inline_in_handler_ops_and_expr(track_by_ops, None, allocator); + inline_always_inline_in_handler_ops_and_expr(track_by_ops, None, &allocator); } } _ => {} @@ -574,7 +574,7 @@ fn inline_always_inline_in_handler_ops_and_expr<'a>( // Second pass: inline the variables into all expressions in handler_ops for op in handler_ops.iter_mut() { - transform_expressions_in_update_op(op, allocator, |expr| { + transform_expressions_in_update_op(op, &allocator, |expr| { if let IrExpression::ReadVariable(read_var) = expr { if let Some(initializer) = always_inline_vars.get(&read_var.xref) { return Some(initializer.clone_in(allocator)); @@ -586,7 +586,7 @@ fn inline_always_inline_in_handler_ops_and_expr<'a>( // Also inline into handler_expression (the return value expression) if let Some(expr) = handler_expression { - inline_into_expression(expr.as_mut(), &always_inline_vars, allocator); + inline_into_expression(expr.as_mut(), &always_inline_vars, &allocator); } // Third pass: remove the inlined variable declarations @@ -687,7 +687,7 @@ fn inline_always_inline_in_op_list_update<'a>( }; for op in view.update.iter_mut() { - transform_expressions_in_update_op(op, allocator, |expr| { + transform_expressions_in_update_op(op, &allocator, |expr| { if let IrExpression::ReadVariable(read_var) = expr { if let Some(initializer) = always_inline_vars.get(&read_var.xref) { return Some(initializer.clone_in(allocator)); @@ -780,7 +780,7 @@ fn inline_always_inline_in_op_list_create<'a>( }; for op in view.create.iter_mut() { - transform_expressions_in_create_op(op, allocator, |expr| { + transform_expressions_in_create_op(op, &allocator, |expr| { if let IrExpression::ReadVariable(read_var) = expr { if let Some(initializer) = always_inline_vars.get(&read_var.xref) { return Some(initializer.clone_in(allocator)); @@ -848,7 +848,7 @@ fn inline_identifier_ctx_variables(job: &mut ComponentCompilationJob<'_>) { std::iter::once(job.root.xref).chain(job.views.keys().copied()).collect(); for view_xref in view_xrefs { - inline_identifier_ctx_vars_in_update_ops(job, view_xref, allocator); + inline_identifier_ctx_vars_in_update_ops(job, view_xref, &allocator); } } @@ -953,7 +953,7 @@ fn inline_identifier_ctx_vars_in_update_ops<'a>( }; for op in view.update.iter_mut() { - transform_expressions_in_update_op(op, allocator, |expr| { + transform_expressions_in_update_op(op, &allocator, |expr| { if let IrExpression::ReadVariable(read_var) = expr { if let Some(initializer) = single_use_ctx_vars.get(&read_var.xref) { return Some(initializer.clone_in(allocator)); @@ -1014,7 +1014,7 @@ fn inline_context_variables_into_variable_ops(job: &mut ComponentCompilationJob< std::iter::once(job.root.xref).chain(job.views.keys().copied()).collect(); for view_xref in view_xrefs { - inline_context_vars_in_view_update_ops(job, view_xref, allocator); + inline_context_vars_in_view_update_ops(job, view_xref, &allocator); } } @@ -1169,7 +1169,7 @@ fn inline_context_vars_in_view_update_ops<'a>( for op in view.update.iter_mut() { if let UpdateOp::Variable(var) = op { // Only transform Variable ops - transform_expression_in_place(&mut var.initializer, allocator, |expr| { + transform_expression_in_place(&mut var.initializer, &allocator, |expr| { if let IrExpression::ReadVariable(read) = expr { if to_inline.contains(&read.xref) { if let Some(initializer) = context_vars.get(&read.xref) { @@ -1220,7 +1220,7 @@ fn transform_expression_in_place<'a, F>( ) where F: FnMut(&IrExpression<'a>) -> Option>, { - let new_expr = transform_expression(expr.as_ref(), allocator, &mut transform); + let new_expr = transform_expression(expr.as_ref(), &allocator, &mut transform); **expr = new_expr; } @@ -1696,10 +1696,10 @@ fn optimize_arrow_function_ops<'a>(job: &mut ComponentCompilationJob<'a>) { // Step 1: Optimize variables in the arrow function's ops // (No handler_expression for arrow functions) - optimize_handler_ops(&mut func.ops, None, allocator, &mut local_diagnostics); + optimize_handler_ops(&mut func.ops, None, &allocator, &mut local_diagnostics); // Step 2: Apply save/restore view optimization - optimize_save_restore_view(&mut func.ops, &mut None, allocator); + optimize_save_restore_view(&mut func.ops, &mut None, &allocator); } } @@ -1740,43 +1740,43 @@ fn optimize_listener_handler_ops<'a>(job: &mut ComponentCompilationJob<'a>) { optimize_handler_ops( &mut listener.handler_ops, listener.handler_expression.as_ref().map(|e| e.as_ref()), - allocator, + &allocator, &mut local_diagnostics, ); optimize_save_restore_view( &mut listener.handler_ops, &mut listener.handler_expression, - allocator, + &allocator, ); } CreateOp::TwoWayListener(listener) => { optimize_handler_ops( &mut listener.handler_ops, None, - allocator, + &allocator, &mut local_diagnostics, ); - optimize_save_restore_view(&mut listener.handler_ops, &mut None, allocator); + optimize_save_restore_view(&mut listener.handler_ops, &mut None, &allocator); } CreateOp::AnimationListener(listener) => { optimize_handler_ops( &mut listener.handler_ops, None, - allocator, + &allocator, &mut local_diagnostics, ); - optimize_save_restore_view(&mut listener.handler_ops, &mut None, allocator); + optimize_save_restore_view(&mut listener.handler_ops, &mut None, &allocator); } CreateOp::Animation(animation) => { optimize_handler_ops( &mut animation.handler_ops, None, - allocator, + &allocator, &mut local_diagnostics, ); // Per Angular's variable_optimization.ts lines 61-66, // Animation handlers also get optimizeSaveRestoreView. - optimize_save_restore_view(&mut animation.handler_ops, &mut None, allocator); + optimize_save_restore_view(&mut animation.handler_ops, &mut None, &allocator); } _ => {} } @@ -1807,7 +1807,7 @@ fn optimize_handler_ops<'a>( // Step 1: Remove unused variables (loop until stable) loop { let changed = - optimize_handler_ops_once(handler_ops, handler_expression, allocator, diagnostics); + optimize_handler_ops_once(handler_ops, handler_expression, &allocator, diagnostics); if !changed { break; } @@ -1816,7 +1816,7 @@ fn optimize_handler_ops<'a>( // Step 2: Inline context variables (nextContext()) into other variable ops. // Per TypeScript's allowConservativeInlining (lines 536-538): // "Context can only be inlined into other variables." - inline_context_vars_in_handler_ops(handler_ops, handler_expression, allocator, diagnostics); + inline_context_vars_in_handler_ops(handler_ops, handler_expression, &allocator, diagnostics); } /// After variables have been optimized in nested ops (e.g. handlers or functions), we may end up @@ -1871,7 +1871,7 @@ fn optimize_save_restore_view<'a>( // Remove the restoreView op handler_ops.clear(); // Unwrap the ResetView from handler_expression - *handler_expression = Some(OxcBox::new_in(inner_expr, allocator)); + *handler_expression = Some(OxcBox::new_in(inner_expr, &allocator)); } return; } @@ -1953,14 +1953,14 @@ fn optimize_save_restore_view<'a>( ReturnStatement { value: OutputExpression::WrappedIrNode(oxc_allocator::Box::new_in( WrappedIrExpr { - node: oxc_allocator::Box::new_in(inner_expr, allocator), + node: oxc_allocator::Box::new_in(inner_expr, &allocator), source_span: None, }, - allocator, + &allocator, )), source_span: None, }, - allocator, + &allocator, )), }); @@ -2091,7 +2091,7 @@ fn optimize_handler_ops_once<'a>( // We need to rebuild the handler_ops vector since we can't easily mutate in place // and also need to replace some ops with statement ops let mut new_ops: OxcVec<'a, UpdateOp<'a>> = - OxcVec::with_capacity_in(handler_ops.len(), allocator); + OxcVec::with_capacity_in(handler_ops.len(), &allocator); for (idx, op) in handler_ops.iter().enumerate() { match &actions[idx] { @@ -2111,18 +2111,18 @@ fn optimize_handler_ops_once<'a>( let wrapped = WrappedIrExpr { node: oxc_allocator::Box::new_in( var.initializer.clone_in(allocator), - allocator, + &allocator, ), source_span: None, }; let expr_stmt = OutputStatement::Expression(oxc_allocator::Box::new_in( ExpressionStatement { expr: OutputExpression::WrappedIrNode(oxc_allocator::Box::new_in( - wrapped, allocator, + wrapped, &allocator, )), source_span: None, }, - allocator, + &allocator, )); new_ops.push(UpdateOp::Statement(StatementOp { base: UpdateOpBase::default(), @@ -2159,17 +2159,17 @@ fn optimize_handler_ops_once<'a>( for idx in &convert_indices { if let UpdateOp::Variable(var) = &handler_ops[*idx] { let wrapped = WrappedIrExpr { - node: oxc_allocator::Box::new_in(var.initializer.clone_in(allocator), allocator), + node: oxc_allocator::Box::new_in(var.initializer.clone_in(allocator), &allocator), source_span: None, }; let expr_stmt = OutputStatement::Expression(oxc_allocator::Box::new_in( ExpressionStatement { expr: OutputExpression::WrappedIrNode(oxc_allocator::Box::new_in( - wrapped, allocator, + wrapped, &allocator, )), source_span: None, }, - allocator, + &allocator, )); statement_replacements.insert( *idx, @@ -2183,7 +2183,7 @@ fn optimize_handler_ops_once<'a>( // Now rebuild the ops vector let mut result_ops: OxcVec<'a, UpdateOp<'a>> = - OxcVec::with_capacity_in(handler_ops.len(), allocator); + OxcVec::with_capacity_in(handler_ops.len(), &allocator); for (idx, op) in handler_ops.iter().enumerate() { if remove_indices.contains(&idx) { @@ -2193,7 +2193,7 @@ fn optimize_handler_ops_once<'a>( result_ops.push(replacement); } else { // Clone the original op - result_ops.push(clone_update_op(op, allocator, diagnostics)); + result_ops.push(clone_update_op(op, &allocator, diagnostics)); } } @@ -2215,14 +2215,17 @@ fn clone_update_op<'a>( xref: var.xref, kind: var.kind, name: var.name.clone(), - initializer: oxc_allocator::Box::new_in(var.initializer.clone_in(allocator), allocator), + initializer: oxc_allocator::Box::new_in( + var.initializer.clone_in(allocator), + &allocator, + ), flags: var.flags, view: var.view, local: var.local, }), UpdateOp::Statement(stmt) => UpdateOp::Statement(StatementOp { base: UpdateOpBase::default(), - statement: clone_statement_with_ir_nodes(&stmt.statement, allocator), + statement: clone_statement_with_ir_nodes(&stmt.statement, &allocator), }), // For other op types that might appear in handler_ops, we'd need to clone them too. // This shouldn't happen in practice for handler_ops but we handle it gracefully @@ -2243,12 +2246,12 @@ fn clone_update_op<'a>( value: crate::output::ast::LiteralValue::Undefined, source_span: None, }, - allocator, + &allocator, ), ), source_span: None, }, - allocator, + &allocator, ), ), }) @@ -2267,21 +2270,21 @@ fn clone_statement_with_ir_nodes<'a>( OutputStatement::Expression(expr_stmt) => { OutputStatement::Expression(oxc_allocator::Box::new_in( ExpressionStatement { - expr: clone_expr_with_ir_nodes(&expr_stmt.expr, allocator), + expr: clone_expr_with_ir_nodes(&expr_stmt.expr, &allocator), source_span: expr_stmt.source_span, }, - allocator, + &allocator, )) } OutputStatement::Return(ret_stmt) => OutputStatement::Return(oxc_allocator::Box::new_in( crate::output::ast::ReturnStatement { - value: clone_expr_with_ir_nodes(&ret_stmt.value, allocator), + value: clone_expr_with_ir_nodes(&ret_stmt.value, &allocator), source_span: ret_stmt.source_span, }, - allocator, + &allocator, )), // For other statement types, use the standard clone - _ => crate::output::ast::clone_output_statement(stmt, allocator), + _ => crate::output::ast::clone_output_statement(stmt, &allocator), } } @@ -2295,10 +2298,10 @@ fn clone_expr_with_ir_nodes<'a>( // Clone the wrapped IR expression OutputExpression::WrappedIrNode(oxc_allocator::Box::new_in( WrappedIrExpr { - node: oxc_allocator::Box::new_in(wrapped.node.clone_in(allocator), allocator), + node: oxc_allocator::Box::new_in(wrapped.node.clone_in(allocator), &allocator), source_span: wrapped.source_span, }, - allocator, + &allocator, )) } // For other expression types, use the standard clone @@ -2732,18 +2735,18 @@ fn convert_variables_to_statements( let wrapped = WrappedIrExpr { node: oxc_allocator::Box::new_in( var.initializer.clone_in(allocator), - allocator, + &allocator, ), source_span: None, }; let expr_stmt = OutputStatement::Expression(oxc_allocator::Box::new_in( ExpressionStatement { expr: OutputExpression::WrappedIrNode(oxc_allocator::Box::new_in( - wrapped, allocator, + wrapped, &allocator, )), source_span: None, }, - allocator, + &allocator, )); let statement_op = UpdateOp::Statement(StatementOp { base: UpdateOpBase::default(), @@ -2844,91 +2847,91 @@ fn transform_expressions_in_update_op<'a, F>( { match op { UpdateOp::Variable(var) => { - let new_expr = transform_expression(&var.initializer, allocator, &mut transform); + let new_expr = transform_expression(&var.initializer, &allocator, &mut transform); *var.initializer = new_expr; } UpdateOp::Property(prop) => { - let new_expr = transform_expression(&prop.expression, allocator, &mut transform); + let new_expr = transform_expression(&prop.expression, &allocator, &mut transform); *prop.expression = new_expr; } UpdateOp::StyleProp(style) => { - let new_expr = transform_expression(&style.expression, allocator, &mut transform); + let new_expr = transform_expression(&style.expression, &allocator, &mut transform); *style.expression = new_expr; } UpdateOp::ClassProp(class) => { - let new_expr = transform_expression(&class.expression, allocator, &mut transform); + let new_expr = transform_expression(&class.expression, &allocator, &mut transform); *class.expression = new_expr; } UpdateOp::StyleMap(style) => { - let new_expr = transform_expression(&style.expression, allocator, &mut transform); + let new_expr = transform_expression(&style.expression, &allocator, &mut transform); *style.expression = new_expr; } UpdateOp::ClassMap(class) => { - let new_expr = transform_expression(&class.expression, allocator, &mut transform); + let new_expr = transform_expression(&class.expression, &allocator, &mut transform); *class.expression = new_expr; } UpdateOp::Attribute(attr) => { - let new_expr = transform_expression(&attr.expression, allocator, &mut transform); + let new_expr = transform_expression(&attr.expression, &allocator, &mut transform); *attr.expression = new_expr; } UpdateOp::DomProperty(dom) => { - let new_expr = transform_expression(&dom.expression, allocator, &mut transform); + let new_expr = transform_expression(&dom.expression, &allocator, &mut transform); *dom.expression = new_expr; } UpdateOp::TwoWayProperty(two_way) => { - let new_expr = transform_expression(&two_way.expression, allocator, &mut transform); + let new_expr = transform_expression(&two_way.expression, &allocator, &mut transform); *two_way.expression = new_expr; } UpdateOp::Binding(binding) => { - let new_expr = transform_expression(&binding.expression, allocator, &mut transform); + let new_expr = transform_expression(&binding.expression, &allocator, &mut transform); *binding.expression = new_expr; } UpdateOp::InterpolateText(text) => { - let new_expr = transform_expression(&text.interpolation, allocator, &mut transform); + let new_expr = transform_expression(&text.interpolation, &allocator, &mut transform); *text.interpolation = new_expr; } UpdateOp::StoreLet(store) => { - let new_expr = transform_expression(&store.value, allocator, &mut transform); + let new_expr = transform_expression(&store.value, &allocator, &mut transform); *store.value = new_expr; } UpdateOp::Conditional(cond) => { if let Some(ref test) = cond.test { - let new_expr = transform_expression(test, allocator, &mut transform); - cond.test = Some(OxcBox::new_in(new_expr, allocator)); + let new_expr = transform_expression(test, &allocator, &mut transform); + cond.test = Some(OxcBox::new_in(new_expr, &allocator)); } for condition in cond.conditions.iter_mut() { if let Some(ref expr) = condition.expr { - let new_expr = transform_expression(expr, allocator, &mut transform); - condition.expr = Some(OxcBox::new_in(new_expr, allocator)); + let new_expr = transform_expression(expr, &allocator, &mut transform); + condition.expr = Some(OxcBox::new_in(new_expr, &allocator)); } } if let Some(ref processed) = cond.processed { - let new_expr = transform_expression(processed, allocator, &mut transform); - cond.processed = Some(OxcBox::new_in(new_expr, allocator)); + let new_expr = transform_expression(processed, &allocator, &mut transform); + cond.processed = Some(OxcBox::new_in(new_expr, &allocator)); } if let Some(ref ctx_val) = cond.context_value { - let new_expr = transform_expression(ctx_val, allocator, &mut transform); - cond.context_value = Some(OxcBox::new_in(new_expr, allocator)); + let new_expr = transform_expression(ctx_val, &allocator, &mut transform); + cond.context_value = Some(OxcBox::new_in(new_expr, &allocator)); } } UpdateOp::Repeater(rep) => { - let new_expr = transform_expression(&rep.collection, allocator, &mut transform); + let new_expr = transform_expression(&rep.collection, &allocator, &mut transform); *rep.collection = new_expr; } UpdateOp::AnimationBinding(anim) => { - let new_expr = transform_expression(&anim.expression, allocator, &mut transform); + let new_expr = transform_expression(&anim.expression, &allocator, &mut transform); *anim.expression = new_expr; } UpdateOp::Control(ctrl) => { - let new_expr = transform_expression(&ctrl.expression, allocator, &mut transform); + let new_expr = transform_expression(&ctrl.expression, &allocator, &mut transform); *ctrl.expression = new_expr; } UpdateOp::I18nExpression(i18n) => { - let new_expr = transform_expression(&i18n.expression, allocator, &mut transform); + let new_expr = transform_expression(&i18n.expression, &allocator, &mut transform); *i18n.expression = new_expr; } UpdateOp::DeferWhen(defer_when) => { - let new_expr = transform_expression(&defer_when.condition, allocator, &mut transform); + let new_expr = transform_expression(&defer_when.condition, &allocator, &mut transform); *defer_when.condition = new_expr; } UpdateOp::Statement(stmt) => { @@ -2936,7 +2939,7 @@ fn transform_expressions_in_update_op<'a, F>( // (e.g., TwoWayBindingSetExpr in two-way listener handlers) transform_expressions_in_output_statement( &mut stmt.statement, - allocator, + &allocator, &mut transform, ); } @@ -2959,27 +2962,27 @@ fn transform_expressions_in_output_statement<'a, F>( match stmt { OutputStatement::Expression(expr_stmt) => { - transform_expressions_in_output_expression(&mut expr_stmt.expr, allocator, transform); + transform_expressions_in_output_expression(&mut expr_stmt.expr, &allocator, transform); } OutputStatement::Return(ret_stmt) => { - transform_expressions_in_output_expression(&mut ret_stmt.value, allocator, transform); + transform_expressions_in_output_expression(&mut ret_stmt.value, &allocator, transform); } OutputStatement::DeclareVar(decl) => { if let Some(ref mut value) = decl.value { - transform_expressions_in_output_expression(value, allocator, transform); + transform_expressions_in_output_expression(value, &allocator, transform); } } OutputStatement::If(if_stmt) => { transform_expressions_in_output_expression( &mut if_stmt.condition, - allocator, + &allocator, transform, ); for stmt in if_stmt.true_case.iter_mut() { - transform_expressions_in_output_statement(stmt, allocator, transform); + transform_expressions_in_output_statement(stmt, &allocator, transform); } for stmt in if_stmt.false_case.iter_mut() { - transform_expressions_in_output_statement(stmt, allocator, transform); + transform_expressions_in_output_statement(stmt, &allocator, transform); } } OutputStatement::DeclareFunction(_) => { @@ -3002,97 +3005,97 @@ fn transform_expressions_in_output_expression<'a, F>( match expr { OutputExpression::WrappedIrNode(wrapped) => { // This is the key case: transform the wrapped IR expression - let new_expr = transform_expression(&wrapped.node, allocator, transform); + let new_expr = transform_expression(&wrapped.node, &allocator, transform); *wrapped.node = new_expr; } OutputExpression::Conditional(cond) => { - transform_expressions_in_output_expression(&mut cond.condition, allocator, transform); - transform_expressions_in_output_expression(&mut cond.true_case, allocator, transform); + transform_expressions_in_output_expression(&mut cond.condition, &allocator, transform); + transform_expressions_in_output_expression(&mut cond.true_case, &allocator, transform); if let Some(ref mut false_case) = cond.false_case { - transform_expressions_in_output_expression(false_case, allocator, transform); + transform_expressions_in_output_expression(false_case, &allocator, transform); } } OutputExpression::BinaryOperator(bin) => { - transform_expressions_in_output_expression(&mut bin.lhs, allocator, transform); - transform_expressions_in_output_expression(&mut bin.rhs, allocator, transform); + transform_expressions_in_output_expression(&mut bin.lhs, &allocator, transform); + transform_expressions_in_output_expression(&mut bin.rhs, &allocator, transform); } OutputExpression::UnaryOperator(un) => { - transform_expressions_in_output_expression(&mut un.expr, allocator, transform); + transform_expressions_in_output_expression(&mut un.expr, &allocator, transform); } OutputExpression::Not(not) => { - transform_expressions_in_output_expression(&mut not.condition, allocator, transform); + transform_expressions_in_output_expression(&mut not.condition, &allocator, transform); } OutputExpression::ReadProp(member) => { - transform_expressions_in_output_expression(&mut member.receiver, allocator, transform); + transform_expressions_in_output_expression(&mut member.receiver, &allocator, transform); } OutputExpression::ReadKey(idx) => { - transform_expressions_in_output_expression(&mut idx.receiver, allocator, transform); - transform_expressions_in_output_expression(&mut idx.index, allocator, transform); + transform_expressions_in_output_expression(&mut idx.receiver, &allocator, transform); + transform_expressions_in_output_expression(&mut idx.index, &allocator, transform); } OutputExpression::InvokeFunction(call) => { - transform_expressions_in_output_expression(&mut call.fn_expr, allocator, transform); + transform_expressions_in_output_expression(&mut call.fn_expr, &allocator, transform); for arg in call.args.iter_mut() { - transform_expressions_in_output_expression(arg, allocator, transform); + transform_expressions_in_output_expression(arg, &allocator, transform); } } OutputExpression::Instantiate(inst) => { - transform_expressions_in_output_expression(&mut inst.class_expr, allocator, transform); + transform_expressions_in_output_expression(&mut inst.class_expr, &allocator, transform); for arg in inst.args.iter_mut() { - transform_expressions_in_output_expression(arg, allocator, transform); + transform_expressions_in_output_expression(arg, &allocator, transform); } } OutputExpression::ArrowFunction(arrow) => match &mut arrow.body { crate::output::ast::ArrowFunctionBody::Expression(body_expr) => { - transform_expressions_in_output_expression(body_expr, allocator, transform); + transform_expressions_in_output_expression(body_expr, &allocator, transform); } crate::output::ast::ArrowFunctionBody::Statements(stmts) => { for stmt in stmts.iter_mut() { - transform_expressions_in_output_statement(stmt, allocator, transform); + transform_expressions_in_output_statement(stmt, &allocator, transform); } } }, OutputExpression::Function(func) => { for stmt in func.statements.iter_mut() { - transform_expressions_in_output_statement(stmt, allocator, transform); + transform_expressions_in_output_statement(stmt, &allocator, transform); } } OutputExpression::LiteralArray(arr) => { for elem in arr.entries.iter_mut() { - transform_expressions_in_output_expression(elem, allocator, transform); + transform_expressions_in_output_expression(elem, &allocator, transform); } } OutputExpression::LiteralMap(map) => { for entry in map.entries.iter_mut() { - transform_expressions_in_output_expression(&mut entry.value, allocator, transform); + transform_expressions_in_output_expression(&mut entry.value, &allocator, transform); } } OutputExpression::Parenthesized(paren) => { - transform_expressions_in_output_expression(&mut paren.expr, allocator, transform); + transform_expressions_in_output_expression(&mut paren.expr, &allocator, transform); } OutputExpression::Comma(comma) => { for expr in comma.parts.iter_mut() { - transform_expressions_in_output_expression(expr, allocator, transform); + transform_expressions_in_output_expression(expr, &allocator, transform); } } OutputExpression::TaggedTemplateLiteral(tagged) => { - transform_expressions_in_output_expression(&mut tagged.tag, allocator, transform); + transform_expressions_in_output_expression(&mut tagged.tag, &allocator, transform); for expr in tagged.template.expressions.iter_mut() { - transform_expressions_in_output_expression(expr, allocator, transform); + transform_expressions_in_output_expression(expr, &allocator, transform); } } OutputExpression::TemplateLiteral(template) => { for expr in template.expressions.iter_mut() { - transform_expressions_in_output_expression(expr, allocator, transform); + transform_expressions_in_output_expression(expr, &allocator, transform); } } OutputExpression::Typeof(type_of) => { - transform_expressions_in_output_expression(&mut type_of.expr, allocator, transform); + transform_expressions_in_output_expression(&mut type_of.expr, &allocator, transform); } OutputExpression::Void(void_expr) => { - transform_expressions_in_output_expression(&mut void_expr.expr, allocator, transform); + transform_expressions_in_output_expression(&mut void_expr.expr, &allocator, transform); } OutputExpression::SpreadElement(spread) => { - transform_expressions_in_output_expression(&mut spread.expr, allocator, transform); + transform_expressions_in_output_expression(&mut spread.expr, &allocator, transform); } // Leaf expressions with no sub-expressions to transform OutputExpression::Literal(_) @@ -3116,53 +3119,53 @@ fn transform_expressions_in_create_op<'a, F>( { match op { CreateOp::Variable(var) => { - let new_expr = transform_expression(&var.initializer, allocator, &mut transform); + let new_expr = transform_expression(&var.initializer, &allocator, &mut transform); *var.initializer = new_expr; } CreateOp::Listener(listener) => { for handler_op in listener.handler_ops.iter_mut() { - transform_expressions_in_update_op(handler_op, allocator, &mut transform); + transform_expressions_in_update_op(handler_op, &allocator, &mut transform); } if let Some(ref handler_expr) = listener.handler_expression { - let new_expr = transform_expression(handler_expr, allocator, &mut transform); - listener.handler_expression = Some(OxcBox::new_in(new_expr, allocator)); + let new_expr = transform_expression(handler_expr, &allocator, &mut transform); + listener.handler_expression = Some(OxcBox::new_in(new_expr, &allocator)); } } CreateOp::TwoWayListener(listener) => { for handler_op in listener.handler_ops.iter_mut() { - transform_expressions_in_update_op(handler_op, allocator, &mut transform); + transform_expressions_in_update_op(handler_op, &allocator, &mut transform); } } CreateOp::AnimationListener(listener) => { for handler_op in listener.handler_ops.iter_mut() { - transform_expressions_in_update_op(handler_op, allocator, &mut transform); + transform_expressions_in_update_op(handler_op, &allocator, &mut transform); } } CreateOp::Animation(animation) => { for handler_op in animation.handler_ops.iter_mut() { - transform_expressions_in_update_op(handler_op, allocator, &mut transform); + transform_expressions_in_update_op(handler_op, &allocator, &mut transform); } } CreateOp::RepeaterCreate(rep) => { - let new_expr = transform_expression(&rep.track, allocator, &mut transform); + let new_expr = transform_expression(&rep.track, &allocator, &mut transform); *rep.track = new_expr; // Also transform track_by_ops if present if let Some(ref mut track_by_ops) = rep.track_by_ops { for track_op in track_by_ops.iter_mut() { - transform_expressions_in_update_op(track_op, allocator, &mut transform); + transform_expressions_in_update_op(track_op, &allocator, &mut transform); } } } CreateOp::ExtractedAttribute(attr) => { if let Some(ref value) = attr.value { - let new_expr = transform_expression(value, allocator, &mut transform); - attr.value = Some(OxcBox::new_in(new_expr, allocator)); + let new_expr = transform_expression(value, &allocator, &mut transform); + attr.value = Some(OxcBox::new_in(new_expr, &allocator)); } } CreateOp::DeferOn(defer_on) => { if let Some(ref options) = defer_on.options { - let new_expr = transform_expression(options, allocator, &mut transform); - defer_on.options = Some(OxcBox::new_in(new_expr, allocator)); + let new_expr = transform_expression(options, &allocator, &mut transform); + defer_on.options = Some(OxcBox::new_in(new_expr, &allocator)); } } _ => {} @@ -3210,27 +3213,25 @@ where IrExpression::SafeNavigationMigration(OxcBox::new_in( SafeNavigationMigrationExpr { expr: OxcBox::new_in( - transform_expression(&m.expr, allocator, transform), - allocator, + transform_expression(&m.expr, &allocator, transform), + &allocator, ), source_span: m.source_span, }, - allocator, + &allocator, )) } IrExpression::PureFunction(pf) => { use crate::ir::expression::PureFunctionExpr; - let body = pf - .body - .as_ref() - .map(|b| OxcBox::new_in(transform_expression(b, allocator, transform), allocator)); - let fn_ref = pf - .fn_ref - .as_ref() - .map(|f| OxcBox::new_in(transform_expression(f, allocator, transform), allocator)); - let mut args = OxcVec::with_capacity_in(pf.args.len(), allocator); + let body = pf.body.as_ref().map(|b| { + OxcBox::new_in(transform_expression(b, &allocator, transform), &allocator) + }); + let fn_ref = pf.fn_ref.as_ref().map(|f| { + OxcBox::new_in(transform_expression(f, &allocator, transform), &allocator) + }); + let mut args = OxcVec::with_capacity_in(pf.args.len(), &allocator); for arg in pf.args.iter() { - args.push(transform_expression(arg, allocator, transform)); + args.push(transform_expression(arg, &allocator, transform)); } IrExpression::PureFunction(OxcBox::new_in( PureFunctionExpr { @@ -3240,21 +3241,21 @@ where var_offset: pf.var_offset, source_span: pf.source_span, }, - allocator, + &allocator, )) } IrExpression::Interpolation(interp) => { use crate::ir::expression::Interpolation; - let mut strings = OxcVec::with_capacity_in(interp.strings.len(), allocator); + let mut strings = OxcVec::with_capacity_in(interp.strings.len(), &allocator); for s in interp.strings.iter() { strings.push(s.clone()); } - let mut expressions = OxcVec::with_capacity_in(interp.expressions.len(), allocator); + let mut expressions = OxcVec::with_capacity_in(interp.expressions.len(), &allocator); for e in interp.expressions.iter() { - expressions.push(transform_expression(e, allocator, transform)); + expressions.push(transform_expression(e, &allocator, transform)); } let mut i18n_placeholders = - OxcVec::with_capacity_in(interp.i18n_placeholders.len(), allocator); + OxcVec::with_capacity_in(interp.i18n_placeholders.len(), &allocator); for ph in interp.i18n_placeholders.iter() { i18n_placeholders.push(ph.clone()); } @@ -3265,7 +3266,7 @@ where i18n_placeholders, source_span: interp.source_span, }, - allocator, + &allocator, )) } IrExpression::RestoreView(rv) => { @@ -3273,13 +3274,13 @@ where let view = match &rv.view { RestoreViewTarget::Static(xref) => RestoreViewTarget::Static(*xref), RestoreViewTarget::Dynamic(inner) => RestoreViewTarget::Dynamic(OxcBox::new_in( - transform_expression(inner, allocator, transform), - allocator, + transform_expression(inner, &allocator, transform), + &allocator, )), }; IrExpression::RestoreView(OxcBox::new_in( RestoreViewExpr { view, source_span: rv.source_span }, - allocator, + &allocator, )) } IrExpression::ResetView(rv) => { @@ -3287,19 +3288,19 @@ where IrExpression::ResetView(OxcBox::new_in( ResetViewExpr { expr: OxcBox::new_in( - transform_expression(&rv.expr, allocator, transform), - allocator, + transform_expression(&rv.expr, &allocator, transform), + &allocator, ), source_span: rv.source_span, }, - allocator, + &allocator, )) } IrExpression::PipeBinding(pb) => { use crate::ir::expression::PipeBindingExpr; - let mut args = OxcVec::with_capacity_in(pb.args.len(), allocator); + let mut args = OxcVec::with_capacity_in(pb.args.len(), &allocator); for arg in pb.args.iter() { - args.push(transform_expression(arg, allocator, transform)); + args.push(transform_expression(arg, &allocator, transform)); } IrExpression::PipeBinding(OxcBox::new_in( PipeBindingExpr { @@ -3310,7 +3311,7 @@ where var_offset: pb.var_offset, source_span: pb.source_span, }, - allocator, + &allocator, )) } IrExpression::PipeBindingVariadic(pbv) => { @@ -3321,14 +3322,14 @@ where target_slot: pbv.target_slot, name: pbv.name.clone(), args: OxcBox::new_in( - transform_expression(&pbv.args, allocator, transform), - allocator, + transform_expression(&pbv.args, &allocator, transform), + &allocator, ), num_args: pbv.num_args, var_offset: pbv.var_offset, source_span: pbv.source_span, }, - allocator, + &allocator, )) } IrExpression::SafePropertyRead(spr) => { @@ -3336,13 +3337,13 @@ where IrExpression::SafePropertyRead(OxcBox::new_in( SafePropertyReadExpr { receiver: OxcBox::new_in( - transform_expression(&spr.receiver, allocator, transform), - allocator, + transform_expression(&spr.receiver, &allocator, transform), + &allocator, ), name: spr.name.clone(), source_span: spr.source_span, }, - allocator, + &allocator, )) } IrExpression::SafeKeyedRead(skr) => { @@ -3350,34 +3351,34 @@ where IrExpression::SafeKeyedRead(OxcBox::new_in( SafeKeyedReadExpr { receiver: OxcBox::new_in( - transform_expression(&skr.receiver, allocator, transform), - allocator, + transform_expression(&skr.receiver, &allocator, transform), + &allocator, ), index: OxcBox::new_in( - transform_expression(&skr.index, allocator, transform), - allocator, + transform_expression(&skr.index, &allocator, transform), + &allocator, ), source_span: skr.source_span, }, - allocator, + &allocator, )) } IrExpression::SafeInvokeFunction(sif) => { use crate::ir::expression::SafeInvokeFunctionExpr; - let mut args = OxcVec::with_capacity_in(sif.args.len(), allocator); + let mut args = OxcVec::with_capacity_in(sif.args.len(), &allocator); for arg in sif.args.iter() { - args.push(transform_expression(arg, allocator, transform)); + args.push(transform_expression(arg, &allocator, transform)); } IrExpression::SafeInvokeFunction(OxcBox::new_in( SafeInvokeFunctionExpr { receiver: OxcBox::new_in( - transform_expression(&sif.receiver, allocator, transform), - allocator, + transform_expression(&sif.receiver, &allocator, transform), + &allocator, ), args, source_span: sif.source_span, }, - allocator, + &allocator, )) } IrExpression::SafeTernary(st) => { @@ -3385,16 +3386,16 @@ where IrExpression::SafeTernary(OxcBox::new_in( SafeTernaryExpr { guard: OxcBox::new_in( - transform_expression(&st.guard, allocator, transform), - allocator, + transform_expression(&st.guard, &allocator, transform), + &allocator, ), expr: OxcBox::new_in( - transform_expression(&st.expr, allocator, transform), - allocator, + transform_expression(&st.expr, &allocator, transform), + &allocator, ), source_span: st.source_span, }, - allocator, + &allocator, )) } IrExpression::Ternary(t) => { @@ -3402,20 +3403,20 @@ where IrExpression::Ternary(OxcBox::new_in( TernaryExpr { condition: OxcBox::new_in( - transform_expression(&t.condition, allocator, transform), - allocator, + transform_expression(&t.condition, &allocator, transform), + &allocator, ), true_expr: OxcBox::new_in( - transform_expression(&t.true_expr, allocator, transform), - allocator, + transform_expression(&t.true_expr, &allocator, transform), + &allocator, ), false_expr: OxcBox::new_in( - transform_expression(&t.false_expr, allocator, transform), - allocator, + transform_expression(&t.false_expr, &allocator, transform), + &allocator, ), source_span: t.source_span, }, - allocator, + &allocator, )) } IrExpression::AssignTemporary(at) => { @@ -3423,14 +3424,14 @@ where IrExpression::AssignTemporary(OxcBox::new_in( AssignTemporaryExpr { expr: OxcBox::new_in( - transform_expression(&at.expr, allocator, transform), - allocator, + transform_expression(&at.expr, &allocator, transform), + &allocator, ), xref: at.xref, name: at.name.clone(), source_span: at.source_span, }, - allocator, + &allocator, )) } IrExpression::ConditionalCase(cc) => { @@ -3438,14 +3439,14 @@ where IrExpression::ConditionalCase(OxcBox::new_in( ConditionalCaseExpr { expr: cc.expr.as_ref().map(|e| { - OxcBox::new_in(transform_expression(e, allocator, transform), allocator) + OxcBox::new_in(transform_expression(e, &allocator, transform), &allocator) }), target: cc.target, target_slot: cc.target_slot, alias: cc.alias.clone(), source_span: cc.source_span, }, - allocator, + &allocator, )) } IrExpression::ConstCollected(cc) => { @@ -3453,12 +3454,12 @@ where IrExpression::ConstCollected(OxcBox::new_in( ConstCollectedExpr { expr: OxcBox::new_in( - transform_expression(&cc.expr, allocator, transform), - allocator, + transform_expression(&cc.expr, &allocator, transform), + &allocator, ), source_span: cc.source_span, }, - allocator, + &allocator, )) } IrExpression::TwoWayBindingSet(twb) => { @@ -3466,16 +3467,16 @@ where IrExpression::TwoWayBindingSet(OxcBox::new_in( TwoWayBindingSetExpr { target: OxcBox::new_in( - transform_expression(&twb.target, allocator, transform), - allocator, + transform_expression(&twb.target, &allocator, transform), + &allocator, ), value: OxcBox::new_in( - transform_expression(&twb.value, allocator, transform), - allocator, + transform_expression(&twb.value, &allocator, transform), + &allocator, ), source_span: twb.source_span, }, - allocator, + &allocator, )) } IrExpression::StoreLet(sl) => { @@ -3484,13 +3485,13 @@ where StoreLetExpr { target: sl.target, value: OxcBox::new_in( - transform_expression(&sl.value, allocator, transform), - allocator, + transform_expression(&sl.value, &allocator, transform), + &allocator, ), var_offset: sl.var_offset, source_span: sl.source_span, }, - allocator, + &allocator, )) } IrExpression::Binary(binary) => { @@ -3499,16 +3500,16 @@ where BinaryExpr { operator: binary.operator, lhs: OxcBox::new_in( - transform_expression(&binary.lhs, allocator, transform), - allocator, + transform_expression(&binary.lhs, &allocator, transform), + &allocator, ), rhs: OxcBox::new_in( - transform_expression(&binary.rhs, allocator, transform), - allocator, + transform_expression(&binary.rhs, &allocator, transform), + &allocator, ), source_span: binary.source_span, }, - allocator, + &allocator, )) } IrExpression::ResolvedPropertyRead(rpr) => { @@ -3516,14 +3517,14 @@ where IrExpression::ResolvedPropertyRead(OxcBox::new_in( ResolvedPropertyReadExpr { receiver: OxcBox::new_in( - transform_expression(&rpr.receiver, allocator, transform), - allocator, + transform_expression(&rpr.receiver, &allocator, transform), + &allocator, ), name: rpr.name.clone(), optional: rpr.optional, source_span: rpr.source_span, }, - allocator, + &allocator, )) } IrExpression::ResolvedBinary(rb) => { @@ -3532,35 +3533,35 @@ where ResolvedBinaryExpr { operator: rb.operator, left: OxcBox::new_in( - transform_expression(&rb.left, allocator, transform), - allocator, + transform_expression(&rb.left, &allocator, transform), + &allocator, ), right: OxcBox::new_in( - transform_expression(&rb.right, allocator, transform), - allocator, + transform_expression(&rb.right, &allocator, transform), + &allocator, ), source_span: rb.source_span, }, - allocator, + &allocator, )) } IrExpression::ResolvedCall(rc) => { use crate::ir::expression::ResolvedCallExpr; - let mut args = OxcVec::with_capacity_in(rc.args.len(), allocator); + let mut args = OxcVec::with_capacity_in(rc.args.len(), &allocator); for arg in rc.args.iter() { - args.push(transform_expression(arg, allocator, transform)); + args.push(transform_expression(arg, &allocator, transform)); } IrExpression::ResolvedCall(OxcBox::new_in( ResolvedCallExpr { receiver: OxcBox::new_in( - transform_expression(&rc.receiver, allocator, transform), - allocator, + transform_expression(&rc.receiver, &allocator, transform), + &allocator, ), args, optional: rc.optional, source_span: rc.source_span, }, - allocator, + &allocator, )) } IrExpression::ResolvedKeyedRead(rkr) => { @@ -3568,17 +3569,17 @@ where IrExpression::ResolvedKeyedRead(OxcBox::new_in( ResolvedKeyedReadExpr { receiver: OxcBox::new_in( - transform_expression(&rkr.receiver, allocator, transform), - allocator, + transform_expression(&rkr.receiver, &allocator, transform), + &allocator, ), key: OxcBox::new_in( - transform_expression(&rkr.key, allocator, transform), - allocator, + transform_expression(&rkr.key, &allocator, transform), + &allocator, ), optional: rkr.optional, source_span: rkr.source_span, }, - allocator, + &allocator, )) } IrExpression::ResolvedSafePropertyRead(rspr) => { @@ -3586,45 +3587,45 @@ where IrExpression::ResolvedSafePropertyRead(OxcBox::new_in( ResolvedSafePropertyReadExpr { receiver: OxcBox::new_in( - transform_expression(&rspr.receiver, allocator, transform), - allocator, + transform_expression(&rspr.receiver, &allocator, transform), + &allocator, ), name: rspr.name.clone(), source_span: rspr.source_span, }, - allocator, + &allocator, )) } IrExpression::DerivedLiteralArray(arr) => { use crate::ir::expression::DerivedLiteralArrayExpr; - let mut entries = OxcVec::with_capacity_in(arr.entries.len(), allocator); + let mut entries = OxcVec::with_capacity_in(arr.entries.len(), &allocator); for entry in arr.entries.iter() { - entries.push(transform_expression(entry, allocator, transform)); + entries.push(transform_expression(entry, &allocator, transform)); } - let mut spreads = OxcVec::with_capacity_in(arr.spreads.len(), allocator); + let mut spreads = OxcVec::with_capacity_in(arr.spreads.len(), &allocator); for s in arr.spreads.iter() { spreads.push(*s); } IrExpression::DerivedLiteralArray(OxcBox::new_in( DerivedLiteralArrayExpr { entries, spreads, source_span: arr.source_span }, - allocator, + &allocator, )) } IrExpression::DerivedLiteralMap(map) => { use crate::ir::expression::DerivedLiteralMapExpr; - let mut keys = OxcVec::with_capacity_in(map.keys.len(), allocator); + let mut keys = OxcVec::with_capacity_in(map.keys.len(), &allocator); for key in map.keys.iter() { keys.push(key.clone()); } - let mut values = OxcVec::with_capacity_in(map.values.len(), allocator); + let mut values = OxcVec::with_capacity_in(map.values.len(), &allocator); for value in map.values.iter() { - values.push(transform_expression(value, allocator, transform)); + values.push(transform_expression(value, &allocator, transform)); } - let mut quoted = OxcVec::with_capacity_in(map.quoted.len(), allocator); + let mut quoted = OxcVec::with_capacity_in(map.quoted.len(), &allocator); for q in map.quoted.iter() { quoted.push(*q); } - let mut spreads = OxcVec::with_capacity_in(map.spreads.len(), allocator); + let mut spreads = OxcVec::with_capacity_in(map.spreads.len(), &allocator); for s in map.spreads.iter() { spreads.push(*s); } @@ -3636,45 +3637,45 @@ where spreads, source_span: map.source_span, }, - allocator, + &allocator, )) } IrExpression::LiteralArray(arr) => { use crate::ir::expression::IrLiteralArrayExpr; - let mut elements = OxcVec::with_capacity_in(arr.elements.len(), allocator); + let mut elements = OxcVec::with_capacity_in(arr.elements.len(), &allocator); for elem in arr.elements.iter() { - elements.push(transform_expression(elem, allocator, transform)); + elements.push(transform_expression(elem, &allocator, transform)); } - let mut spreads = OxcVec::with_capacity_in(arr.spreads.len(), allocator); + let mut spreads = OxcVec::with_capacity_in(arr.spreads.len(), &allocator); for s in arr.spreads.iter() { spreads.push(*s); } IrExpression::LiteralArray(OxcBox::new_in( IrLiteralArrayExpr { elements, spreads, source_span: arr.source_span }, - allocator, + &allocator, )) } IrExpression::LiteralMap(map) => { use crate::ir::expression::IrLiteralMapExpr; - let mut keys = OxcVec::with_capacity_in(map.keys.len(), allocator); + let mut keys = OxcVec::with_capacity_in(map.keys.len(), &allocator); for key in map.keys.iter() { keys.push(key.clone()); } - let mut values = OxcVec::with_capacity_in(map.values.len(), allocator); + let mut values = OxcVec::with_capacity_in(map.values.len(), &allocator); for value in map.values.iter() { - values.push(transform_expression(value, allocator, transform)); + values.push(transform_expression(value, &allocator, transform)); } - let mut quoted = OxcVec::with_capacity_in(map.quoted.len(), allocator); + let mut quoted = OxcVec::with_capacity_in(map.quoted.len(), &allocator); for q in map.quoted.iter() { quoted.push(*q); } - let mut spreads = OxcVec::with_capacity_in(map.spreads.len(), allocator); + let mut spreads = OxcVec::with_capacity_in(map.spreads.len(), &allocator); for s in map.spreads.iter() { spreads.push(*s); } IrExpression::LiteralMap(OxcBox::new_in( IrLiteralMapExpr { keys, values, quoted, spreads, source_span: map.source_span }, - allocator, + &allocator, )) } IrExpression::Not(n) => { @@ -3682,12 +3683,12 @@ where IrExpression::Not(OxcBox::new_in( NotExpr { expr: OxcBox::new_in( - transform_expression(&n.expr, allocator, transform), - allocator, + transform_expression(&n.expr, &allocator, transform), + &allocator, ), source_span: n.source_span, }, - allocator, + &allocator, )) } IrExpression::Unary(u) => { @@ -3696,12 +3697,12 @@ where UnaryExpr { operator: u.operator, expr: OxcBox::new_in( - transform_expression(&u.expr, allocator, transform), - allocator, + transform_expression(&u.expr, &allocator, transform), + &allocator, ), source_span: u.source_span, }, - allocator, + &allocator, )) } IrExpression::Typeof(t) => { @@ -3709,12 +3710,12 @@ where IrExpression::Typeof(OxcBox::new_in( TypeofExpr { expr: OxcBox::new_in( - transform_expression(&t.expr, allocator, transform), - allocator, + transform_expression(&t.expr, &allocator, transform), + &allocator, ), source_span: t.source_span, }, - allocator, + &allocator, )) } IrExpression::Void(v) => { @@ -3722,30 +3723,30 @@ where IrExpression::Void(OxcBox::new_in( VoidExpr { expr: OxcBox::new_in( - transform_expression(&v.expr, allocator, transform), - allocator, + transform_expression(&v.expr, &allocator, transform), + &allocator, ), source_span: v.source_span, }, - allocator, + &allocator, )) } IrExpression::ResolvedTemplateLiteral(rtl) => { use crate::ir::expression::{IrTemplateLiteralElement, ResolvedTemplateLiteralExpr}; - let mut elements = OxcVec::with_capacity_in(rtl.elements.len(), allocator); + let mut elements = OxcVec::with_capacity_in(rtl.elements.len(), &allocator); for elem in rtl.elements.iter() { elements.push(IrTemplateLiteralElement { text: elem.text.clone(), source_span: elem.source_span, }); } - let mut expressions = OxcVec::with_capacity_in(rtl.expressions.len(), allocator); + let mut expressions = OxcVec::with_capacity_in(rtl.expressions.len(), &allocator); for e in rtl.expressions.iter() { - expressions.push(transform_expression(e, allocator, transform)); + expressions.push(transform_expression(e, &allocator, transform)); } IrExpression::ResolvedTemplateLiteral(OxcBox::new_in( ResolvedTemplateLiteralExpr { elements, expressions, source_span: rtl.source_span }, - allocator, + &allocator, )) } @@ -3753,23 +3754,23 @@ where use crate::ir::expression::ArrowFunctionExpr; use crate::output::ast::FnParam; - let mut params = OxcVec::with_capacity_in(arrow_fn.params.len(), allocator); + let mut params = OxcVec::with_capacity_in(arrow_fn.params.len(), &allocator); for param in arrow_fn.params.iter() { params.push(FnParam { name: param.name.clone() }); } - let body = transform_expression(&arrow_fn.body, allocator, transform); + let body = transform_expression(&arrow_fn.body, &allocator, transform); IrExpression::ArrowFunction(OxcBox::new_in( ArrowFunctionExpr { params, - body: OxcBox::new_in(body, allocator), + body: OxcBox::new_in(body, &allocator), // ops are not transformed as they are transient data - ops: OxcVec::new_in(allocator), + ops: OxcVec::new_in(&allocator), var_offset: arrow_fn.var_offset, source_span: arrow_fn.source_span, }, - allocator, + &allocator, )) } IrExpression::Parenthesized(paren) => { @@ -3777,12 +3778,12 @@ where IrExpression::Parenthesized(OxcBox::new_in( IrParenthesizedExpr { expr: OxcBox::new_in( - transform_expression(&paren.expr, allocator, transform), - allocator, + transform_expression(&paren.expr, &allocator, transform), + &allocator, ), source_span: paren.source_span, }, - allocator, + &allocator, )) } } @@ -3916,7 +3917,7 @@ fn inline_context_vars_in_handler_ops<'a>( continue; } // Transform the initializer - transform_expression_in_place(&mut var.initializer, allocator, |expr| { + transform_expression_in_place(&mut var.initializer, &allocator, |expr| { if let IrExpression::ReadVariable(read) = expr { if to_inline.contains(&read.xref) { if let Some(initializer) = context_vars.get(&read.xref) { @@ -3932,7 +3933,7 @@ fn inline_context_vars_in_handler_ops<'a>( // Third pass: remove the inlined context variable declarations // Build a new vector without the inlined variables let mut new_ops: OxcVec<'a, UpdateOp<'a>> = - OxcVec::with_capacity_in(handler_ops.len(), allocator); + OxcVec::with_capacity_in(handler_ops.len(), &allocator); for op in handler_ops.iter() { if let UpdateOp::Variable(var) = op { if to_inline.contains(&var.xref) { @@ -3940,7 +3941,7 @@ fn inline_context_vars_in_handler_ops<'a>( continue; } } - new_ops.push(clone_update_op(op, allocator, diagnostics)); + new_ops.push(clone_update_op(op, &allocator, diagnostics)); } *handler_ops = new_ops; diff --git a/crates/oxc_angular_compiler/src/pipeline/selector.rs b/crates/oxc_angular_compiler/src/pipeline/selector.rs index 5a757a9c1..c00ea2349 100644 --- a/crates/oxc_angular_compiler/src/pipeline/selector.rs +++ b/crates/oxc_angular_compiler/src/pipeline/selector.rs @@ -435,7 +435,7 @@ pub fn r3_selector_to_output_expr<'a>( allocator: &'a Allocator, elements: &[R3SelectorElement], ) -> OxcVec<'a, OutputExpression<'a>> { - let mut result = OxcVec::with_capacity_in(elements.len(), allocator); + let mut result = OxcVec::with_capacity_in(elements.len(), &allocator); for element in elements { match element { R3SelectorElement::String(s) => { @@ -444,13 +444,13 @@ pub fn r3_selector_to_output_expr<'a>( value: LiteralValue::String(Ident::from(allocator.alloc_str(s))), source_span: None, }, - allocator, + &allocator, ))); } R3SelectorElement::Flag(f) => { result.push(OutputExpression::Literal(oxc_allocator::Box::new_in( LiteralExpr { value: LiteralValue::Number(*f as f64), source_span: None }, - allocator, + &allocator, ))); } } diff --git a/crates/oxc_angular_compiler/src/service/compiler.rs b/crates/oxc_angular_compiler/src/service/compiler.rs index 07c034d67..5dde42d73 100644 --- a/crates/oxc_angular_compiler/src/service/compiler.rs +++ b/crates/oxc_angular_compiler/src/service/compiler.rs @@ -65,12 +65,12 @@ fn create_factory_delegation<'a>( ) -> OutputExpression<'a> { OutputExpression::ReadProp(Box::new_in( ReadPropExpr { - receiver: Box::new_in(type_expr.clone_in(allocator), allocator), + receiver: Box::new_in(type_expr.clone_in(allocator), &allocator), name: Ident::from("ɵfac"), optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -79,28 +79,28 @@ fn create_factory_arrow<'a>( allocator: &'a Allocator, factory: &OutputExpression<'a>, ) -> OutputExpression<'a> { - let params = Vec::new_in(allocator); + let params = Vec::new_in(&allocator); let factory_call = OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(factory.clone_in(allocator), allocator), - args: Vec::new_in(allocator), + fn_expr: Box::new_in(factory.clone_in(allocator), &allocator), + args: Vec::new_in(&allocator), pure: false, optional: false, source_span: None, }, - allocator, + &allocator, )); - let mut body = Vec::new_in(allocator); + let mut body = Vec::new_in(&allocator); body.push(OutputStatement::Return(Box::new_in( ReturnStatement { value: factory_call, source_span: None }, - allocator, + &allocator, ))); OutputExpression::Function(Box::new_in( FunctionExpr { name: None, params, statements: body, source_span: None }, - allocator, + &allocator, )) } @@ -109,7 +109,7 @@ fn build_definition_map<'a>( metadata: &R3ServiceMetadata<'a>, factory_expr: OutputExpression<'a>, ) -> Vec<'a, LiteralMapEntry<'a>> { - let mut entries = Vec::new_in(allocator); + let mut entries = Vec::new_in(&allocator); entries.push(LiteralMapEntry::new( Ident::from("token"), @@ -126,7 +126,7 @@ fn build_definition_map<'a>( Ident::from("autoProvided"), OutputExpression::Literal(Box::new_in( LiteralExpr { value: LiteralValue::Boolean(false), source_span: None }, - allocator, + &allocator, )), false, )); @@ -145,34 +145,34 @@ fn create_define_service_call<'a>( receiver: Box::new_in( OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("i0"), source_span: None }, - allocator, + &allocator, )), - allocator, + &allocator, ), name: Ident::from(Identifiers::DEFINE_SERVICE), optional: false, source_span: None, }, - allocator, + &allocator, )); let map_expr = OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries: definition_map, source_span: None }, - allocator, + &allocator, )); - let mut args = Vec::new_in(allocator); + let mut args = Vec::new_in(&allocator); args.push(map_expr); OutputExpression::InvokeFunction(Box::new_in( InvokeFunctionExpr { - fn_expr: Box::new_in(define_service_fn, allocator), + fn_expr: Box::new_in(define_service_fn, &allocator), args, pure: true, optional: false, source_span: None, }, - allocator, + &allocator, )) } @@ -184,7 +184,7 @@ mod tests { fn make_type_expr<'a>(allocator: &'a Allocator, name: &'static str) -> OutputExpression<'a> { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(name), source_span: None }, - allocator, + &allocator, )) } @@ -253,7 +253,7 @@ mod tests { let allocator = Allocator::default(); let factory_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("makeService"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3ServiceMetadata { name: Ident::from("MyService"), diff --git a/crates/oxc_angular_compiler/src/service/decorator.rs b/crates/oxc_angular_compiler/src/service/decorator.rs index d8d935762..3b708bea2 100644 --- a/crates/oxc_angular_compiler/src/service/decorator.rs +++ b/crates/oxc_angular_compiler/src/service/decorator.rs @@ -118,7 +118,7 @@ impl<'a> ServiceMetadata<'a> { ) -> R3ServiceMetadata<'a> { let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: self.class_name.clone(), source_span: None }, - allocator, + &allocator, )); let factory = self.factory.and_then(|src| parse_factory_expression(allocator, src)); diff --git a/crates/oxc_angular_compiler/src/service/definition.rs b/crates/oxc_angular_compiler/src/service/definition.rs index 24a910ae9..e9e0e3020 100644 --- a/crates/oxc_angular_compiler/src/service/definition.rs +++ b/crates/oxc_angular_compiler/src/service/definition.rs @@ -64,7 +64,7 @@ fn generate_fac_definition<'a>( type_expr: metadata.r#type.clone_in(allocator), type_decl: metadata.r#type.clone_in(allocator), type_argument_count: metadata.type_argument_count, - deps: R3FactoryDeps::Valid(OxcVec::new_in(allocator)), + deps: R3FactoryDeps::Valid(OxcVec::new_in(&allocator)), target: FactoryTarget::Service, }); @@ -85,7 +85,7 @@ mod tests { let allocator = Allocator::default(); let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("MyService"), source_span: None }, - &allocator, + &&allocator, )); let metadata = R3ServiceMetadata { name: Ident::from("MyService"), diff --git a/crates/oxc_angular_compiler/src/transform/control_flow.rs b/crates/oxc_angular_compiler/src/transform/control_flow.rs index ca44ce4dc..8370a99b6 100644 --- a/crates/oxc_angular_compiler/src/transform/control_flow.rs +++ b/crates/oxc_angular_compiler/src/transform/control_flow.rs @@ -214,7 +214,7 @@ pub fn parse_conditional_params<'a>( // Parse the condition expression // For conditional blocks, the expression is the full first parameter, so offset is 0 let expression = Some(parse_expression_to_ast_with_source( - allocator, + &allocator, binding_parser, expr_str, first_param.span, @@ -395,7 +395,7 @@ pub fn parse_for_loop_parameters<'a>( let raw_expression_alloc = allocator.alloc_str(raw_expression_str); let expression_offset = expr_str.rfind(raw_expression_str).map(|pos| pos as u32).unwrap_or(0); let expression = parse_expression_to_ast_with_source( - allocator, + &allocator, binding_parser, raw_expression_alloc, expression_param.span, @@ -423,7 +423,7 @@ pub fn parse_for_loop_parameters<'a>( param_str.rfind(track_expr_str).map(|pos| pos as u32).unwrap_or(0); let track_expression = parse_expression_to_ast_with_source( - allocator, + &allocator, binding_parser, track_expr_str, param.span, @@ -457,7 +457,7 @@ pub fn parse_for_loop_parameters<'a>( param.span.start + let_prefix + let_assignments.len() as u32, ); parse_let_parameter( - allocator, + &allocator, let_assignments, assignments_span, &item_name_owned, @@ -599,7 +599,7 @@ fn create_default_context_variables<'a>( allocator: &'a Allocator, block_start_span: Span, ) -> Vec<'a, R3Variable<'a>> { - let mut vars = Vec::with_capacity_in(ALLOWED_FOR_LOOP_LET_VARIABLES.len(), allocator); + let mut vars = Vec::with_capacity_in(ALLOWED_FOR_LOOP_LET_VARIABLES.len(), &allocator); // Empty span at the end of the block start - both start and end are the same position let empty_span = Span::new(block_start_span.end, block_start_span.end); @@ -639,7 +639,7 @@ fn create_empty_ast_with_source<'a>(allocator: &'a Allocator, span: Span) -> AST span: ParseSpan { start: span.start, end: span.end }, source_span: AbsoluteSourceSpan::new(span.start, span.end), }, - allocator, + &allocator, )), source: None, location: Ident::from(""), @@ -892,7 +892,7 @@ pub fn parse_defer_triggers<'a>( // Reference: r3_deferred_blocks.ts lines 279-295 if is_when_pattern(expr) { parse_when_trigger_from_expr( - allocator, + &allocator, binding_parser, expr, span, @@ -903,7 +903,7 @@ pub fn parse_defer_triggers<'a>( ); } else if is_on_pattern(expr) { parse_on_trigger_from_expr( - allocator, + &allocator, expr, span, None, @@ -915,7 +915,7 @@ pub fn parse_defer_triggers<'a>( } else if is_prefetch_when_pattern(expr) { let prefetch_span = Some(Span::new(span.start, span.start + 8)); // "prefetch" parse_when_trigger_from_expr( - allocator, + &allocator, binding_parser, expr, span, @@ -927,7 +927,7 @@ pub fn parse_defer_triggers<'a>( } else if is_prefetch_on_pattern(expr) { let prefetch_span = Some(Span::new(span.start, span.start + 8)); // "prefetch" parse_on_trigger_from_expr( - allocator, + &allocator, expr, span, prefetch_span, @@ -939,7 +939,7 @@ pub fn parse_defer_triggers<'a>( } else if is_hydrate_when_pattern(expr) { let hydrate_span = Some(Span::new(span.start, span.start + 7)); // "hydrate" parse_when_trigger_from_expr( - allocator, + &allocator, binding_parser, expr, span, @@ -951,7 +951,7 @@ pub fn parse_defer_triggers<'a>( } else if is_hydrate_on_pattern(expr) { let hydrate_span = Some(Span::new(span.start, span.start + 7)); // "hydrate" parse_on_trigger_from_expr( - allocator, + &allocator, expr, span, None, @@ -1047,7 +1047,7 @@ fn parse_when_trigger_from_expr<'a>( // (including prefetch/hydrate/when keywords) to the end let full_source_span = span; parse_when_trigger( - allocator, + &allocator, binding_parser, condition_str, Span::new(span.start + start_idx as u32, span.end), @@ -1090,7 +1090,7 @@ fn parse_on_trigger_from_expr<'a>( // The full span starts from the beginning (including prefetch/hydrate/on keywords) let full_source_span_start = span.start; parse_on_triggers( - allocator, + &allocator, triggers_str, triggers_span, full_source_span_start, @@ -1254,7 +1254,7 @@ fn parse_on_triggers<'a>( // Parse individual trigger parse_single_on_trigger( - allocator, + &allocator, trigger_part, trigger_span, source_span, @@ -1600,8 +1600,8 @@ fn extract_viewport_trigger_and_options<'a>( let LiteralMap { span: map_span, source_span: map_source_span, keys, values } = map.unbox(); // Second pass: filter out the trigger key - let mut filtered_keys = Vec::new_in(allocator); - let mut filtered_values = Vec::new_in(allocator); + let mut filtered_keys = Vec::new_in(&allocator); + let mut filtered_values = Vec::new_in(&allocator); for (idx, (key, value)) in keys.into_iter().zip(values.into_iter()).enumerate() { if idx != trigger_idx { @@ -1632,7 +1632,7 @@ fn extract_viewport_trigger_and_options<'a>( keys: filtered_keys, values: filtered_values, }, - allocator, + &allocator, ))); ViewportTriggerResult { reference: trigger_ref, options, errors } diff --git a/crates/oxc_angular_compiler/src/transform/html_to_r3.rs b/crates/oxc_angular_compiler/src/transform/html_to_r3.rs index e5743d71c..f4a139475 100644 --- a/crates/oxc_angular_compiler/src/transform/html_to_r3.rs +++ b/crates/oxc_angular_compiler/src/transform/html_to_r3.rs @@ -176,16 +176,16 @@ impl<'a> HtmlToR3Transform<'a> { /// Creates a new HTML to R3 transformer. pub fn new(allocator: &'a Allocator, source_text: &'a str, options: TransformOptions) -> Self { let comment_nodes = - if options.collect_comment_nodes { Some(Vec::new_in(allocator)) } else { None }; + if options.collect_comment_nodes { Some(Vec::new_in(&allocator)) } else { None }; Self { allocator, source_text, binding_parser: BindingParser::new(allocator), errors: std::vec::Vec::new(), - styles: Vec::new_in(allocator), - style_urls: Vec::new_in(allocator), - ng_content_selectors: Vec::new_in(allocator), + styles: Vec::new_in(&allocator), + style_urls: Vec::new_in(&allocator), + ng_content_selectors: Vec::new_in(&allocator), comment_nodes, processed_nodes: FxHashSet::default(), namespace_stack: std::vec::Vec::new(), @@ -221,7 +221,7 @@ impl<'a> HtmlToR3Transform<'a> { /// Visits a list of sibling nodes, handling connected blocks. fn visit_siblings(&mut self, siblings: &[HtmlNode<'a>]) -> Vec<'a, R3Node<'a>> { - let mut result = Vec::new_in(self.allocator); + let mut result = Vec::new_in(&self.allocator); for (index, node) in siblings.iter().enumerate() { // Skip nodes that were already processed as connected blocks @@ -286,9 +286,9 @@ impl<'a> HtmlToR3Transform<'a> { }; // Reconstruct the @let text with semicolon let reconstructed = format!("@let {} = {};", decl.name.as_str(), value_text); - let text_value = Ident::from_in(reconstructed.as_str(), self.allocator); + let text_value = Ident::from_in(reconstructed.as_str(), &self.allocator); let r3_text = R3Text { value: text_value, source_span: decl.span }; - return Some(R3Node::Text(Box::new_in(r3_text, self.allocator))); + return Some(R3Node::Text(Box::new_in(r3_text, &self.allocator))); } self.visit_let_declaration(decl) } @@ -415,7 +415,7 @@ impl<'a> HtmlToR3Transform<'a> { // Element has its own i18n attribute - parse it as a Message with message string let instance_id = self.allocate_i18n_message_instance_id(); Some(parse_i18n_meta_with_message( - self.allocator, + &self.allocator, attr.value.as_str(), instance_id, &i18n_message_string, @@ -482,7 +482,7 @@ impl<'a> HtmlToR3Transform<'a> { // However, i18n/i18n-* attributes are excluded because Angular's I18nMetaVisitor // strips them from element.attrs before r3_template_transform runs. let mut content_attributes: Vec<'a, R3TextAttribute<'a>> = - Vec::with_capacity_in(element.attrs.len(), self.allocator); + Vec::with_capacity_in(element.attrs.len(), &self.allocator); for attr in &element.attrs { let name = attr.name.as_str(); if name == "i18n" || name.starts_with("i18n-") { @@ -508,7 +508,7 @@ impl<'a> HtmlToR3Transform<'a> { end_source_span: element.end_span, i18n: None, }; - let mut result = R3Node::Content(Box::new_in(content, self.allocator)); + let mut result = R3Node::Content(Box::new_in(content, &self.allocator)); // Wrap in template if has structural directive (*ngIf, etc.) // Reference: r3_template_transform.ts lines 266-277 @@ -528,7 +528,7 @@ impl<'a> HtmlToR3Transform<'a> { inputs, outputs, directives, - template_attrs: Vec::new_in(self.allocator), + template_attrs: Vec::new_in(&self.allocator), children, references, variables, @@ -538,7 +538,7 @@ impl<'a> HtmlToR3Transform<'a> { end_source_span: element.end_span, i18n: i18n_meta, }; - let mut result = R3Node::Template(Box::new_in(template, self.allocator)); + let mut result = R3Node::Template(Box::new_in(template, &self.allocator)); // Wrap in another template if has structural directive (*ngIf, etc.) if let Some(template_attr_info) = template_attr { @@ -589,11 +589,11 @@ impl<'a> HtmlToR3Transform<'a> { (None, Some(tag)) => Some(*tag), (Some(prefix), None) => { // Has prefix but no tag name - use "ng-component" as default - Some(Ident::from_in(&format!(":{prefix}:ng-component"), self.allocator)) + Some(Ident::from_in(&format!(":{prefix}:ng-component"), &self.allocator)) } (Some(prefix), Some(tag)) => { // Both prefix and tag name: ":prefix:tag_name" - Some(Ident::from_in(&format!(":{prefix}:{tag}"), self.allocator)) + Some(Ident::from_in(&format!(":{prefix}:{tag}"), &self.allocator)) } }; @@ -601,11 +601,11 @@ impl<'a> HtmlToR3Transform<'a> { let full_name = match &tag_name { Some(tag) if tag.starts_with(':') => { // Namespace format: "MyComp:svg:rect" (tag_name already has :prefix:) - Ident::from_in(&format!("{}{}", element.name, tag), self.allocator) + Ident::from_in(&format!("{}{}", element.name, tag), &self.allocator) } Some(tag) => { // Simple format: "MyComp:div" - Ident::from_in(&format!("{}:{}", element.name, tag), self.allocator) + Ident::from_in(&format!("{}:{}", element.name, tag), &self.allocator) } None => element.name, }; @@ -627,7 +627,7 @@ impl<'a> HtmlToR3Transform<'a> { end_source_span: element.end_span, i18n: i18n_meta, }; - R3Node::Component(Box::new_in(r3_component, self.allocator)) + R3Node::Component(Box::new_in(r3_component, &self.allocator)) } else { // Regular element let r3_element = R3Element { @@ -645,7 +645,7 @@ impl<'a> HtmlToR3Transform<'a> { is_void: self.is_void_element(element.name.as_str()), i18n: i18n_meta, }; - R3Node::Element(Box::new_in(r3_element, self.allocator)) + R3Node::Element(Box::new_in(r3_element, &self.allocator)) }; // Wrap in template if has structural directive @@ -731,7 +731,7 @@ impl<'a> HtmlToR3Transform<'a> { end_source_span: component.end_span, i18n: None, }; - let mut result = R3Node::Component(Box::new_in(r3_component, self.allocator)); + let mut result = R3Node::Component(Box::new_in(r3_component, &self.allocator)); // Wrap in template if has structural directive if let Some(template_attr_info) = template_attr { @@ -808,7 +808,7 @@ impl<'a> HtmlToR3Transform<'a> { && Self::namespace_from_prefix(prefix).is_some() { let qualified = format!(":{prefix}:{local}"); - return Ident::from_in(&qualified, self.allocator); + return Ident::from_in(&qualified, &self.allocator); } let ns = match namespace { @@ -817,7 +817,7 @@ impl<'a> HtmlToR3Transform<'a> { ElementNamespace::Html => return name, }; let qualified = format!(":{ns}:{name_str}"); - Ident::from_in(&qualified, self.allocator) + Ident::from_in(&qualified, &self.allocator) } /// Transforms HTML directives to R3 directives. @@ -827,7 +827,7 @@ impl<'a> HtmlToR3Transform<'a> { html_directives: &[HtmlDirective<'a>], element_name: &str, ) -> Vec<'a, R3Directive<'a>> { - let mut directives = Vec::new_in(self.allocator); + let mut directives = Vec::new_in(&self.allocator); let mut seen_directives: FxHashSet<&str> = FxHashSet::default(); for html_dir in html_directives { @@ -847,10 +847,10 @@ impl<'a> HtmlToR3Transform<'a> { seen_directives.insert(directive_name); // Parse directive attributes similar to element attributes - let mut attributes = Vec::new_in(self.allocator); - let mut inputs = Vec::new_in(self.allocator); - let mut outputs = Vec::new_in(self.allocator); - let mut references = Vec::new_in(self.allocator); + let mut attributes = Vec::new_in(&self.allocator); + let mut inputs = Vec::new_in(&self.allocator); + let mut outputs = Vec::new_in(&self.allocator); + let mut references = Vec::new_in(&self.allocator); let mut seen_reference_names: FxHashSet<&str> = FxHashSet::default(); let mut invalid = false; @@ -904,8 +904,8 @@ impl<'a> HtmlToR3Transform<'a> { } else { seen_reference_names.insert(ref_name); references.push(R3Reference { - name: Ident::from_in(ref_name, self.allocator), - value: Ident::from_in("", self.allocator), + name: Ident::from_in(ref_name, &self.allocator), + value: Ident::from_in("", &self.allocator), source_span: attr.span, key_span: attr.name_span, value_span: None, @@ -947,7 +947,7 @@ impl<'a> HtmlToR3Transform<'a> { self.binding_parser.parse_binding(attr_value, value_span); inputs.push(R3BoundAttribute { - name: Ident::from_in(prop_name, self.allocator), + name: Ident::from_in(prop_name, &self.allocator), binding_type, value: parse_result.ast, unit: None, @@ -965,7 +965,7 @@ impl<'a> HtmlToR3Transform<'a> { self.binding_parser.parse_event(attr_value, value_span); outputs.push(R3BoundEvent { - name: Ident::from_in(rest, self.allocator), + name: Ident::from_in(rest, &self.allocator), handler: parse_result.ast, target: None, event_type: ParsedEventType::Regular, @@ -982,7 +982,7 @@ impl<'a> HtmlToR3Transform<'a> { self.binding_parser.parse_binding(attr_value, value_span); inputs.push(R3BoundAttribute { - name: Ident::from_in(rest, self.allocator), + name: Ident::from_in(rest, &self.allocator), binding_type: BindingType::TwoWay, value: parse_result.ast, unit: None, @@ -995,7 +995,7 @@ impl<'a> HtmlToR3Transform<'a> { // Two-way binding also creates an output event let event_name = - Ident::from_in(&format!("{rest}Change"), self.allocator); + Ident::from_in(&format!("{rest}Change"), &self.allocator); let event_parse_result = self.binding_parser.parse_event(attr_value, value_span); @@ -1021,7 +1021,7 @@ impl<'a> HtmlToR3Transform<'a> { self.binding_parser.parse_binding(value_str, value_span); inputs.push(R3BoundAttribute { - name: Ident::from_in(rest, self.allocator), + name: Ident::from_in(rest, &self.allocator), binding_type: BindingType::LegacyAnimation, value: parse_result.ast, unit: None, @@ -1048,7 +1048,7 @@ impl<'a> HtmlToR3Transform<'a> { let parse_result = self.binding_parser.parse_binding(value_str, value_span); inputs.push(R3BoundAttribute { - name: Ident::from_in(prop_name, self.allocator), + name: Ident::from_in(prop_name, &self.allocator), binding_type: BindingType::TwoWay, value: parse_result.ast, unit: None, @@ -1060,7 +1060,7 @@ impl<'a> HtmlToR3Transform<'a> { }); // Two-way binding also creates an output event - let event_name = Ident::from_in(&format!("{prop_name}Change"), self.allocator); + let event_name = Ident::from_in(&format!("{prop_name}Change"), &self.allocator); let event_value_str = self.allocator.alloc_str(attr_value); let event_parse_result = self.binding_parser.parse_event(event_value_str, value_span); @@ -1119,7 +1119,7 @@ impl<'a> HtmlToR3Transform<'a> { let parse_result = self.binding_parser.parse_binding(value_str, value_span); inputs.push(R3BoundAttribute { - name: Ident::from_in(prop_name, self.allocator), + name: Ident::from_in(prop_name, &self.allocator), binding_type: BindingType::Property, value: parse_result.ast, unit: None, @@ -1144,7 +1144,7 @@ impl<'a> HtmlToR3Transform<'a> { let parse_result = self.binding_parser.parse_event(value_str, value_span); outputs.push(R3BoundEvent { - name: Ident::from_in(event_name, self.allocator), + name: Ident::from_in(event_name, &self.allocator), handler: parse_result.ast, target: None, event_type: ParsedEventType::Regular, @@ -1249,33 +1249,33 @@ impl<'a> HtmlToR3Transform<'a> { let icu_type_upper = expansion.expansion_type.as_str().to_uppercase(); let base_name = format!("VAR_{icu_type_upper}"); let expression_placeholder = - Ident::from_in(&self.generate_unique_icu_placeholder(&base_name), self.allocator); - let icu_placeholder_name = Ident::from_in("ICU", self.allocator); + Ident::from_in(&self.generate_unique_icu_placeholder(&base_name), &self.allocator); + let icu_placeholder_name = Ident::from_in("ICU", &self.allocator); // Create the I18nIcu for the i18n metadata // The cases are empty here since they're parsed separately into R3Icu.placeholders let i18n_icu = I18nIcu { expression: expansion.switch_value, icu_type: expansion.expansion_type, - cases: HashMap::new_in(self.allocator), + cases: HashMap::new_in(&self.allocator), source_span: expansion.span, expression_placeholder: Some(expression_placeholder), }; // Create the IcuPlaceholder wrapping the ICU let i18n_icu_placeholder = I18nIcuPlaceholder { - value: Box::new_in(i18n_icu, self.allocator), + value: Box::new_in(i18n_icu, &self.allocator), name: icu_placeholder_name, source_span: expansion.span, }; // Create the Message containing the single IcuPlaceholder - let mut nodes = Vec::new_in(self.allocator); + let mut nodes = Vec::new_in(&self.allocator); nodes.push(I18nNode::IcuPlaceholder(i18n_icu_placeholder)); // Serialize the message string for goog.getMsg and $localize let message_string_str = serialize_i18n_nodes(&nodes); - let message_string = Ident::from_in(&*message_string_str, self.allocator); + let message_string = Ident::from_in(&*message_string_str, &self.allocator); let i18n_message = I18nMessage { instance_id: self.allocate_i18n_message_instance_id(), @@ -1284,12 +1284,12 @@ impl<'a> HtmlToR3Transform<'a> { description: Ident::from(""), custom_id: Ident::from(""), id: Ident::from(""), - legacy_ids: Vec::new_in(self.allocator), + legacy_ids: Vec::new_in(&self.allocator), message_string, }; // Create variable for the switch value (using VAR_* placeholder name) - let mut vars = Vec::new_in(self.allocator); + let mut vars = Vec::new_in(&self.allocator); let switch_value_str = expansion.switch_value.as_str(); let switch_value_span = expansion.switch_value_span; @@ -1301,7 +1301,7 @@ impl<'a> HtmlToR3Transform<'a> { // This matches Angular's visitExpansion behavior where nested ICUs are visited first, // and their VAR_* placeholders are added before the outer ICU's VAR_*. // Ported from Angular's i18n_parser.ts:137-159 - let mut placeholders = Vec::new_in(self.allocator); + let mut placeholders = Vec::new_in(&self.allocator); for case in &expansion.cases { self.extract_placeholders_from_nodes(&case.expansion, &mut placeholders, &mut vars); } @@ -1323,7 +1323,7 @@ impl<'a> HtmlToR3Transform<'a> { i18n: Some(I18nMeta::Message(i18n_message)), }; - Some(R3Node::Icu(Box::new_in(icu, self.allocator))) + Some(R3Node::Icu(Box::new_in(icu, &self.allocator))) } /// Extracts placeholders and nested ICU vars from expansion case nodes. @@ -1362,7 +1362,7 @@ impl<'a> HtmlToR3Transform<'a> { let icu_type_upper = nested_expansion.expansion_type.as_str().to_uppercase(); let base_name = format!("VAR_{icu_type_upper}"); let unique_name = self.generate_unique_icu_placeholder(&base_name); - let var_placeholder_name = Ident::from_in(&unique_name, self.allocator); + let var_placeholder_name = Ident::from_in(&unique_name, &self.allocator); // Recursively extract from nested expansion cases FIRST. // This ensures placeholders and further nested ICU vars are processed @@ -1438,7 +1438,7 @@ impl<'a> HtmlToR3Transform<'a> { let value_str = self.allocator.alloc_str(expr_content); let parse_result = self.binding_parser.parse_binding(value_str, interp_span); - let placeholder_key = Ident::from_in(interpolation, self.allocator); + let placeholder_key = Ident::from_in(interpolation, &self.allocator); let bound_text = R3BoundText { value: parse_result.ast, source_span: interp_span, @@ -1498,7 +1498,7 @@ impl<'a> HtmlToR3Transform<'a> { if let Some(expr) = self.parse_interpolation_from_tokens(text) { let bound_text = R3BoundText { value: expr, source_span: text.span, i18n: i18n_meta }; - return Some(R3Node::BoundText(Box::new_in(bound_text, self.allocator))); + return Some(R3Node::BoundText(Box::new_in(bound_text, &self.allocator))); } } else { // No entities - use the simple path with decoded text @@ -1513,7 +1513,7 @@ impl<'a> HtmlToR3Transform<'a> { if let Some(expr) = self.parse_interpolation(interpolation_text, text.span) { let bound_text = R3BoundText { value: expr, source_span: text.span, i18n: i18n_meta }; - return Some(R3Node::BoundText(Box::new_in(bound_text, self.allocator))); + return Some(R3Node::BoundText(Box::new_in(bound_text, &self.allocator))); } } } @@ -1521,12 +1521,12 @@ impl<'a> HtmlToR3Transform<'a> { // Static text - use value with ngsp replaced let value_atom = if has_ngsp { let value_no_ngsp = value_str.replace(NGSP_UNICODE, " "); - Ident::from_in(&value_no_ngsp, self.allocator) + Ident::from_in(&value_no_ngsp, &self.allocator) } else { text.value }; let r3_text = R3Text { value: value_atom, source_span: text.span }; - Some(R3Node::Text(Box::new_in(r3_text, self.allocator))) + Some(R3Node::Text(Box::new_in(r3_text, &self.allocator))) } /// Visits a comment node. @@ -1552,7 +1552,7 @@ impl<'a> HtmlToR3Transform<'a> { /// but since our visitor returns a single node, we create a wrapper template /// containing all the text nodes and children. fn visit_block_as_text(&mut self, block: &HtmlBlock<'a>) -> Option> { - let mut nodes = Vec::new_in(self.allocator); + let mut nodes = Vec::new_in(&self.allocator); // Get the text for the block's start source span (e.g., "@if (condition) {") let start_text = if block.start_span.start < block.start_span.end @@ -1569,7 +1569,7 @@ impl<'a> HtmlToR3Transform<'a> { value: Ident::from(self.allocator.alloc_str(start_text)), source_span: block.start_span, }, - self.allocator, + &self.allocator, ))); // Visit children recursively (they're also in ngNonBindable context) @@ -1593,7 +1593,7 @@ impl<'a> HtmlToR3Transform<'a> { value: Ident::from(self.allocator.alloc_str(end_text)), source_span: end_span, }, - self.allocator, + &self.allocator, ))); } @@ -1603,21 +1603,21 @@ impl<'a> HtmlToR3Transform<'a> { Some(R3Node::Template(Box::new_in( R3Template { tag_name: None, - attributes: Vec::new_in(self.allocator), - inputs: Vec::new_in(self.allocator), - outputs: Vec::new_in(self.allocator), - directives: Vec::new_in(self.allocator), - template_attrs: Vec::new_in(self.allocator), + attributes: Vec::new_in(&self.allocator), + inputs: Vec::new_in(&self.allocator), + outputs: Vec::new_in(&self.allocator), + directives: Vec::new_in(&self.allocator), + template_attrs: Vec::new_in(&self.allocator), children: nodes, - references: Vec::new_in(self.allocator), - variables: Vec::new_in(self.allocator), + references: Vec::new_in(&self.allocator), + variables: Vec::new_in(&self.allocator), source_span: block.span, start_source_span: block.start_span, end_source_span: block.end_span, i18n: None, is_self_closing: false, }, - self.allocator, + &self.allocator, ))) } @@ -1625,7 +1625,7 @@ impl<'a> HtmlToR3Transform<'a> { /// This is the correct implementation matching TypeScript's NonBindableVisitor.visitBlock(). /// TypeScript returns [startText, ...children, endText].flat(Infinity). fn visit_block_as_text_flat(&mut self, block: &HtmlBlock<'a>) -> Vec<'a, R3Node<'a>> { - let mut nodes = Vec::new_in(self.allocator); + let mut nodes = Vec::new_in(&self.allocator); // Get the text for the block's start source span (e.g., "@defer (when condition) {") let start_text = if block.start_span.start < block.start_span.end @@ -1642,7 +1642,7 @@ impl<'a> HtmlToR3Transform<'a> { value: Ident::from(self.allocator.alloc_str(start_text)), source_span: block.start_span, }, - self.allocator, + &self.allocator, ))); // Visit children recursively - they are also in ngNonBindable context @@ -1667,7 +1667,7 @@ impl<'a> HtmlToR3Transform<'a> { value: Ident::from(self.allocator.alloc_str(end_text)), source_span: end_span, }, - self.allocator, + &self.allocator, ))); } @@ -1738,7 +1738,7 @@ impl<'a> HtmlToR3Transform<'a> { source_span: block.span, name_span: block.name_span, }, - self.allocator, + &self.allocator, ))) } BlockType::For => { @@ -1780,7 +1780,7 @@ impl<'a> HtmlToR3Transform<'a> { source_span: block.span, name_span: block.name_span, }, - self.allocator, + &self.allocator, ))) } BlockType::Switch => self.visit_switch_block(block), @@ -1794,7 +1794,7 @@ impl<'a> HtmlToR3Transform<'a> { source_span: block.span, name_span: block.name_span, }, - self.allocator, + &self.allocator, ))) } BlockType::Defer => { @@ -1839,7 +1839,7 @@ impl<'a> HtmlToR3Transform<'a> { source_span: block.span, name_span: block.name_span, }, - self.allocator, + &self.allocator, ))) } } @@ -1928,7 +1928,7 @@ impl<'a> HtmlToR3Transform<'a> { name_span: decl.name_span, value_span: decl.value_span, }; - Some(R3Node::LetDeclaration(Box::new_in(r3_decl, self.allocator))) + Some(R3Node::LetDeclaration(Box::new_in(r3_decl, &self.allocator))) } /// Creates an i18n BlockPlaceholder for a control flow block when inside an i18n context. @@ -1954,29 +1954,29 @@ impl<'a> HtmlToR3Transform<'a> { self.block_placeholder_counter += 1; let start_name = if count == 0 { - Ident::from_in(format!("START_BLOCK_{block_upper}").as_str(), self.allocator) + Ident::from_in(format!("START_BLOCK_{block_upper}").as_str(), &self.allocator) } else { - Ident::from_in(format!("START_BLOCK_{block_upper}_{count}").as_str(), self.allocator) + Ident::from_in(format!("START_BLOCK_{block_upper}_{count}").as_str(), &self.allocator) }; let close_name = if count == 0 { - Ident::from_in(format!("CLOSE_BLOCK_{block_upper}").as_str(), self.allocator) + Ident::from_in(format!("CLOSE_BLOCK_{block_upper}").as_str(), &self.allocator) } else { - Ident::from_in(format!("CLOSE_BLOCK_{block_upper}_{count}").as_str(), self.allocator) + Ident::from_in(format!("CLOSE_BLOCK_{block_upper}_{count}").as_str(), &self.allocator) }; // Convert parameters to Atom vec - let mut params = Vec::new_in(self.allocator); + let mut params = Vec::new_in(&self.allocator); for p in parameters { params.push(*p); } let placeholder = I18nBlockPlaceholder { - name: Ident::from_in(block_name, self.allocator), + name: Ident::from_in(block_name, &self.allocator), parameters: params, start_name, close_name, - children: Vec::new_in(self.allocator), + children: Vec::new_in(&self.allocator), source_span, start_source_span: Some(start_source_span), end_source_span, @@ -1991,11 +1991,11 @@ impl<'a> HtmlToR3Transform<'a> { block: &HtmlBlock<'a>, connected_blocks: &[&HtmlBlock<'a>], ) -> Option> { - let mut branches = Vec::new_in(self.allocator); + let mut branches = Vec::new_in(&self.allocator); // Parse the main @if branch parameters (condition and optional "as" alias) let main_params = parse_conditional_params( - self.allocator, + &self.allocator, &block.parameters, &self.binding_parser, block.start_span, @@ -2066,7 +2066,7 @@ impl<'a> HtmlToR3Transform<'a> { BlockType::ElseIf => { // Parse @else if parameters (condition and optional "as" alias) let params = parse_conditional_params( - self.allocator, + &self.allocator, &connected.parameters, &self.binding_parser, connected.start_span, @@ -2204,7 +2204,7 @@ impl<'a> HtmlToR3Transform<'a> { end_source_span, name_span: block.name_span, }; - Some(R3Node::IfBlock(Box::new_in(if_block, self.allocator))) + Some(R3Node::IfBlock(Box::new_in(if_block, &self.allocator))) } /// Visits a @for block with connected @empty block. @@ -2218,7 +2218,7 @@ impl<'a> HtmlToR3Transform<'a> { // Parse loop parameters using the control flow parser let params = parse_for_loop_parameters( - self.allocator, + &self.allocator, &block.parameters, &self.binding_parser, block.start_span, @@ -2358,7 +2358,7 @@ impl<'a> HtmlToR3Transform<'a> { name_span: block.name_span, i18n, }; - Some(R3Node::ForLoopBlock(Box::new_in(for_block, self.allocator))) + Some(R3Node::ForLoopBlock(Box::new_in(for_block, &self.allocator))) } /// Visits a @switch block. @@ -2384,8 +2384,8 @@ impl<'a> HtmlToR3Transform<'a> { self.binding_parser.parse_binding("", block.span).ast }; - let mut groups = Vec::new_in(self.allocator); - let mut unknown_blocks = Vec::new_in(self.allocator); + let mut groups = Vec::new_in(&self.allocator); + let mut unknown_blocks = Vec::new_in(&self.allocator); let mut collected_cases: std::vec::Vec> = std::vec::Vec::new(); let mut first_case_start: Option = None; let mut has_default = false; @@ -2561,7 +2561,7 @@ impl<'a> HtmlToR3Transform<'a> { }; // Move collected cases into allocator vector - let mut cases = Vec::new_in(self.allocator); + let mut cases = Vec::new_in(&self.allocator); for case in collected_cases.drain(..) { cases.push(case); } @@ -2604,7 +2604,7 @@ impl<'a> HtmlToR3Transform<'a> { end_source_span: block.end_span, name_span: block.name_span, }; - Some(R3Node::SwitchBlock(Box::new_in(switch_block, self.allocator))) + Some(R3Node::SwitchBlock(Box::new_in(switch_block, &self.allocator))) } /// Visits a @defer block with connected @placeholder, @loading, @error blocks. @@ -2895,7 +2895,7 @@ impl<'a> HtmlToR3Transform<'a> { end_source_span, i18n, }; - Some(R3Node::DeferredBlock(Box::new_in(defer_block, self.allocator))) + Some(R3Node::DeferredBlock(Box::new_in(defer_block, &self.allocator))) } /// Visits all children of a node (uses sibling-aware traversal). @@ -2918,11 +2918,11 @@ impl<'a> HtmlToR3Transform<'a> { Vec<'a, R3Variable<'a>>, // Variables Option>, // Template attribute info ) { - let mut attributes = Vec::new_in(self.allocator); - let mut inputs = Vec::new_in(self.allocator); - let mut outputs = Vec::new_in(self.allocator); - let mut references = Vec::new_in(self.allocator); - let mut variables = Vec::new_in(self.allocator); + let mut attributes = Vec::new_in(&self.allocator); + let mut inputs = Vec::new_in(&self.allocator); + let mut outputs = Vec::new_in(&self.allocator); + let mut references = Vec::new_in(&self.allocator); + let mut variables = Vec::new_in(&self.allocator); let mut template_attr_info: Option> = None; // First pass: collect i18n-* attribute metadata @@ -3531,12 +3531,12 @@ impl<'a> HtmlToR3Transform<'a> { self.get_node_i18n(&node).map(|meta| meta.clone_in(self.allocator)) }; - let mut children = Vec::new_in(self.allocator); + let mut children = Vec::new_in(&self.allocator); children.push(node); - let mut attributes = Vec::new_in(self.allocator); - let mut inputs = Vec::new_in(self.allocator); - let mut variables = Vec::new_in(self.allocator); + let mut attributes = Vec::new_in(&self.allocator); + let mut inputs = Vec::new_in(&self.allocator); + let mut variables = Vec::new_in(&self.allocator); // Extract the directive name (strip the * prefix) let directive_name: &str = @@ -3749,7 +3749,7 @@ impl<'a> HtmlToR3Transform<'a> { // The directive-related attributes go into template_attrs // The hoisted element attributes become the template's main attributes - let mut template_attrs: Vec<'a, R3TemplateAttr<'a>> = Vec::new_in(self.allocator); + let mut template_attrs: Vec<'a, R3TemplateAttr<'a>> = Vec::new_in(&self.allocator); for attr in attributes { template_attrs.push(R3TemplateAttr::Text(attr)); } @@ -3762,10 +3762,10 @@ impl<'a> HtmlToR3Transform<'a> { attributes: hoisted_attributes, inputs: hoisted_inputs, outputs: hoisted_outputs, - directives: Vec::new_in(self.allocator), + directives: Vec::new_in(&self.allocator), template_attrs, children, - references: Vec::new_in(self.allocator), + references: Vec::new_in(&self.allocator), variables, is_self_closing: false, source_span: element.span, @@ -3773,7 +3773,7 @@ impl<'a> HtmlToR3Transform<'a> { end_source_span: element.end_span, i18n, }; - R3Node::Template(Box::new_in(template, self.allocator)) + R3Node::Template(Box::new_in(template, &self.allocator)) } /// Wraps a component node in a template for structural directives. @@ -3798,12 +3798,12 @@ impl<'a> HtmlToR3Transform<'a> { self.get_node_i18n(&node).map(|meta| meta.clone_in(self.allocator)) }; - let mut children = Vec::new_in(self.allocator); + let mut children = Vec::new_in(&self.allocator); children.push(node); - let mut attributes = Vec::new_in(self.allocator); - let mut inputs = Vec::new_in(self.allocator); - let mut variables = Vec::new_in(self.allocator); + let mut attributes = Vec::new_in(&self.allocator); + let mut inputs = Vec::new_in(&self.allocator); + let mut variables = Vec::new_in(&self.allocator); // Extract the directive name (strip the * prefix) let directive_name: &str = @@ -3983,7 +3983,7 @@ impl<'a> HtmlToR3Transform<'a> { let (hoisted_attributes, hoisted_inputs, hoisted_outputs) = self.get_hoisted_attrs_from_node(&children[0]); - let mut template_attrs: Vec<'a, R3TemplateAttr<'a>> = Vec::new_in(self.allocator); + let mut template_attrs: Vec<'a, R3TemplateAttr<'a>> = Vec::new_in(&self.allocator); for attr in attributes { template_attrs.push(R3TemplateAttr::Text(attr)); } @@ -3996,10 +3996,10 @@ impl<'a> HtmlToR3Transform<'a> { attributes: hoisted_attributes, inputs: hoisted_inputs, outputs: hoisted_outputs, - directives: Vec::new_in(self.allocator), + directives: Vec::new_in(&self.allocator), template_attrs, children, - references: Vec::new_in(self.allocator), + references: Vec::new_in(&self.allocator), variables, is_self_closing: false, source_span: component.span, @@ -4007,7 +4007,7 @@ impl<'a> HtmlToR3Transform<'a> { end_source_span: component.end_span, i18n, }; - R3Node::Template(Box::new_in(template, self.allocator)) + R3Node::Template(Box::new_in(template, &self.allocator)) } /// Filters out animation attributes (those starting with "animate."). @@ -4016,7 +4016,7 @@ impl<'a> HtmlToR3Transform<'a> { &self, attributes: &Vec<'a, R3TextAttribute<'a>>, ) -> Vec<'a, R3TextAttribute<'a>> { - let mut result = Vec::new_in(self.allocator); + let mut result = Vec::new_in(&self.allocator); for attr in attributes { if !attr.name.as_str().starts_with("animate.") { result.push(R3TextAttribute { @@ -4038,7 +4038,7 @@ impl<'a> HtmlToR3Transform<'a> { &self, inputs: &Vec<'a, R3BoundAttribute<'a>>, ) -> Vec<'a, R3BoundAttribute<'a>> { - let mut result = Vec::new_in(self.allocator); + let mut result = Vec::new_in(&self.allocator); for input in inputs { if input.binding_type != BindingType::Animation { result.push(R3BoundAttribute { @@ -4119,7 +4119,7 @@ impl<'a> HtmlToR3Transform<'a> { }; // Create TagPlaceholder - let mut placeholder_attrs = HashMap::new_in(self.allocator); + let mut placeholder_attrs = HashMap::new_in(&self.allocator); for (k, v) in attrs { placeholder_attrs.insert( Ident::from(self.allocator.alloc_str(&k)), @@ -4132,7 +4132,7 @@ impl<'a> HtmlToR3Transform<'a> { attrs: placeholder_attrs, start_name: Ident::from(self.allocator.alloc_str(&start_name)), close_name: Ident::from(self.allocator.alloc_str(&close_name)), - children: Vec::new_in(self.allocator), + children: Vec::new_in(&self.allocator), is_void, source_span: element.span, start_source_span: Some(element.start_span), @@ -4172,7 +4172,7 @@ impl<'a> HtmlToR3Transform<'a> { let close_name = self.i18n_placeholder_registry.get_close_tag_placeholder_name(tag_name); // Create TagPlaceholder - let mut placeholder_attrs = HashMap::new_in(self.allocator); + let mut placeholder_attrs = HashMap::new_in(&self.allocator); for (k, v) in attrs { placeholder_attrs.insert( Ident::from(self.allocator.alloc_str(&k)), @@ -4185,7 +4185,7 @@ impl<'a> HtmlToR3Transform<'a> { attrs: placeholder_attrs, start_name: Ident::from(self.allocator.alloc_str(&start_name)), close_name: Ident::from(self.allocator.alloc_str(&close_name)), - children: Vec::new_in(self.allocator), + children: Vec::new_in(&self.allocator), is_void, source_span: component.span, start_source_span: Some(component.start_span), @@ -4208,16 +4208,16 @@ impl<'a> HtmlToR3Transform<'a> { (attrs, inputs, outputs) } _ => ( - Vec::new_in(self.allocator), - Vec::new_in(self.allocator), - Vec::new_in(self.allocator), + Vec::new_in(&self.allocator), + Vec::new_in(&self.allocator), + Vec::new_in(&self.allocator), ), } } /// Creates a shallow copy of bound events. fn copy_bound_events(&self, events: &Vec<'a, R3BoundEvent<'a>>) -> Vec<'a, R3BoundEvent<'a>> { - let mut result = Vec::new_in(self.allocator); + let mut result = Vec::new_in(&self.allocator); for event in events { result.push(R3BoundEvent { name: event.name, @@ -4285,7 +4285,7 @@ impl<'a> HtmlToR3Transform<'a> { text: &str, span: Span, ) -> I18nMeta<'a> { - let mut children = Vec::new_in(self.allocator); + let mut children = Vec::new_in(&self.allocator); let mut current_pos = 0; // Find all interpolations {{ expr }} @@ -4296,7 +4296,7 @@ impl<'a> HtmlToR3Transform<'a> { if start > 0 { let text_before = &text[current_pos..abs_start]; if !text_before.is_empty() { - let text_atom = Ident::from_in(text_before, self.allocator); + let text_atom = Ident::from_in(text_before, &self.allocator); children.push(I18nNode::Text(I18nText { value: text_atom, source_span: span })); } } @@ -4310,8 +4310,8 @@ impl<'a> HtmlToR3Transform<'a> { // Generate placeholder name using the i18n placeholder registry let placeholder_name = self.i18n_placeholder_registry.get_placeholder_name("INTERPOLATION", expr); - let name_atom = Ident::from_in(&placeholder_name, self.allocator); - let value_atom = Ident::from_in(expr, self.allocator); + let name_atom = Ident::from_in(&placeholder_name, &self.allocator); + let value_atom = Ident::from_in(expr, &self.allocator); children.push(I18nNode::Placeholder(I18nPlaceholder { value: value_atom, @@ -4331,7 +4331,7 @@ impl<'a> HtmlToR3Transform<'a> { if current_pos < text.len() { let remaining = &text[current_pos..]; if !remaining.is_empty() { - let text_atom = Ident::from_in(remaining, self.allocator); + let text_atom = Ident::from_in(remaining, &self.allocator); children.push(I18nNode::Text(I18nText { value: text_atom, source_span: span })); } } @@ -4367,8 +4367,8 @@ impl<'a> HtmlToR3Transform<'a> { use crate::ast::expression::Interpolation; use crate::parser::html::NGSP_UNICODE; - let mut strings = Vec::new_in(self.allocator); - let mut expressions = Vec::new_in(self.allocator); + let mut strings = Vec::new_in(&self.allocator); + let mut expressions = Vec::new_in(&self.allocator); // Helper to accumulate text/entity content before committing to strings array. // The invariant we maintain: strings.len() == expressions.len() after processing text/entity, @@ -4394,7 +4394,7 @@ impl<'a> HtmlToR3Transform<'a> { if token.parts.len() >= 3 { // Before adding an expression, commit the current string buffer // (even if empty, we need a string before each expression) - strings.push(Ident::from_in(current_string.as_str(), self.allocator)); + strings.push(Ident::from_in(current_string.as_str(), &self.allocator)); current_string.clear(); let start_marker = &token.parts[0]; @@ -4438,13 +4438,13 @@ impl<'a> HtmlToR3Transform<'a> { } // Commit the trailing string (after the last expression) - strings.push(Ident::from_in(current_string.as_str(), self.allocator)); + strings.push(Ident::from_in(current_string.as_str(), &self.allocator)); // Create the Interpolation expression let span = ParseSpan::new(0, text.span.end - text.span.start); let source_span = AbsoluteSourceSpan { start: text.span.start, end: text.span.end }; let interpolation = Interpolation { span, source_span, strings, expressions }; - Some(AngularExpression::Interpolation(Box::new_in(interpolation, self.allocator))) + Some(AngularExpression::Interpolation(Box::new_in(interpolation, &self.allocator))) } /// Parses interpolation from attribute tokens, using token spans for correct source positions. @@ -4459,8 +4459,8 @@ impl<'a> HtmlToR3Transform<'a> { let tokens = attr.value_tokens.as_ref()?; - let mut strings = Vec::new_in(self.allocator); - let mut expressions = Vec::new_in(self.allocator); + let mut strings = Vec::new_in(&self.allocator); + let mut expressions = Vec::new_in(&self.allocator); // Helper to accumulate text/entity content before committing to strings array. // The invariant we maintain: strings.len() == expressions.len() after processing text/entity, @@ -4486,7 +4486,7 @@ impl<'a> HtmlToR3Transform<'a> { if token.parts.len() >= 3 { // Before adding an expression, commit the current string buffer // (even if empty, we need a string before each expression) - strings.push(Ident::from_in(current_string.as_str(), self.allocator)); + strings.push(Ident::from_in(current_string.as_str(), &self.allocator)); current_string.clear(); let start_marker = &token.parts[0]; @@ -4527,13 +4527,13 @@ impl<'a> HtmlToR3Transform<'a> { } // Commit the trailing string (after the last expression) - strings.push(Ident::from_in(current_string.as_str(), self.allocator)); + strings.push(Ident::from_in(current_string.as_str(), &self.allocator)); // Create the Interpolation expression let span = ParseSpan::new(0, value_span.size()); let source_span = AbsoluteSourceSpan { start: value_span.start, end: value_span.end }; let interpolation = Interpolation { span, source_span, strings, expressions }; - Some(AngularExpression::Interpolation(Box::new_in(interpolation, self.allocator))) + Some(AngularExpression::Interpolation(Box::new_in(interpolation, &self.allocator))) } /// Creates a bound attribute from an attribute with interpolation value. @@ -4611,7 +4611,7 @@ impl<'a> HtmlToR3Transform<'a> { span: ParseSpan::new(0, span.size()), source_span: AbsoluteSourceSpan::new(span.start, span.end), }, - self.allocator, + &self.allocator, )) } @@ -4820,13 +4820,13 @@ fn parse_i18n_meta_with_message<'a>( I18nMeta::Message(I18nMessage { instance_id, - nodes: Vec::new_in(allocator), - meaning: Ident::from_in(meaning, allocator), - description: Ident::from_in(description, allocator), - custom_id: Ident::from_in(custom_id, allocator), + nodes: Vec::new_in(&allocator), + meaning: Ident::from_in(meaning, &allocator), + description: Ident::from_in(description, &allocator), + custom_id: Ident::from_in(custom_id, &allocator), id: Ident::from(""), - legacy_ids: Vec::new_in(allocator), - message_string: Ident::from_in(message_string, allocator), + legacy_ids: Vec::new_in(&allocator), + message_string: Ident::from_in(message_string, &allocator), }) } diff --git a/crates/oxc_angular_compiler/tests/partial_class_metadata_async_test.rs b/crates/oxc_angular_compiler/tests/partial_class_metadata_async_test.rs index dc14884b2..6087e7d6e 100644 --- a/crates/oxc_angular_compiler/tests/partial_class_metadata_async_test.rs +++ b/crates/oxc_angular_compiler/tests/partial_class_metadata_async_test.rs @@ -23,7 +23,7 @@ use oxc_str::Ident; fn read_var<'a>(allocator: &'a Allocator, name: &'static str) -> OutputExpression<'a> { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(name), source_span: None }, - allocator, + &allocator, )) } @@ -37,7 +37,7 @@ fn make_class_metadata<'a>( decorator_name: &'static str, ) -> R3ClassMetadata<'a> { // decorators: [{ type: }] - let mut decorator_map_entries = oxc_allocator::Vec::new_in(allocator); + let mut decorator_map_entries = oxc_allocator::Vec::new_in(&allocator); decorator_map_entries.push(LiteralMapEntry::new( Ident::from("type"), read_var(allocator, decorator_name), @@ -45,13 +45,13 @@ fn make_class_metadata<'a>( )); let decorator_map = OutputExpression::LiteralMap(Box::new_in( LiteralMapExpr { entries: decorator_map_entries, source_span: None }, - allocator, + &allocator, )); - let mut decorators_array = oxc_allocator::Vec::new_in(allocator); + let mut decorators_array = oxc_allocator::Vec::new_in(&allocator); decorators_array.push(decorator_map); let decorators = OutputExpression::LiteralArray(Box::new_in( LiteralArrayExpr { entries: decorators_array, source_span: None }, - allocator, + &allocator, )); R3ClassMetadata { diff --git a/crates/oxc_angular_compiler/tests/partial_directive_test.rs b/crates/oxc_angular_compiler/tests/partial_directive_test.rs index f2e9ff36c..4e7532804 100644 --- a/crates/oxc_angular_compiler/tests/partial_directive_test.rs +++ b/crates/oxc_angular_compiler/tests/partial_directive_test.rs @@ -18,7 +18,7 @@ use oxc_str::Ident; fn read_var<'a>(allocator: &'a Allocator, name: &'static str) -> OutputExpression<'a> { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(name), source_span: None }, - allocator, + &allocator, )) } @@ -169,10 +169,10 @@ fn host_directive_with_forward_ref_wraps_directive() { let hd = R3HostDirectiveMetadata { directive: read_var(&allocator, "FwdHostDir"), is_forward_reference: true, - inputs: Vec::new_in(&allocator), - outputs: Vec::new_in(&allocator), + inputs: Vec::new_in(&&allocator), + outputs: Vec::new_in(&&allocator), }; - let mut host_dirs = Vec::new_in(&allocator); + let mut host_dirs = Vec::new_in(&&allocator); host_dirs.push(hd); let meta = R3DirectiveMetadataBuilder::new(&allocator) @@ -200,24 +200,24 @@ fn host_directive_with_forward_ref_wraps_directive() { type_argument_count: 0, deps: None::>>, selector: Some(Ident::from("[hostingDir]")), - queries: Vec::new_in(&allocator), - view_queries: Vec::new_in(&allocator), + queries: Vec::new_in(&&allocator), + view_queries: Vec::new_in(&&allocator), host: R3HostMetadata::new(&allocator), uses_on_changes: false, - inputs: Vec::new_in(&allocator), - outputs: Vec::new_in(&allocator), + inputs: Vec::new_in(&&allocator), + outputs: Vec::new_in(&&allocator), uses_inheritance: false, - export_as: Vec::new_in(&allocator), + export_as: Vec::new_in(&&allocator), providers: None, is_standalone: true, is_signal: false, host_directives: { - let mut v = Vec::new_in(&allocator); + let mut v = Vec::new_in(&&allocator); v.push(R3HostDirectiveMetadata { directive: read_var(&allocator, "FwdHostDir"), is_forward_reference: true, - inputs: Vec::new_in(&allocator), - outputs: Vec::new_in(&allocator), + inputs: Vec::new_in(&&allocator), + outputs: Vec::new_in(&&allocator), }); v }, @@ -233,7 +233,7 @@ fn host_directive_with_forward_ref_wraps_directive() { #[test] fn outputs_emitted_as_object_map() { let allocator = Allocator::default(); - let mut outputs = Vec::new_in(&allocator); + let mut outputs = Vec::new_in(&&allocator); outputs.push((Ident::from("valueChange"), Ident::from("valueChange"))); outputs.push((Ident::from("internalEvent"), Ident::from("publicEvent"))); @@ -245,18 +245,18 @@ fn outputs_emitted_as_object_map() { type_argument_count: 0, deps: None::>>, selector: Some(Ident::from("[myDir]")), - queries: Vec::new_in(&allocator), - view_queries: Vec::new_in(&allocator), + queries: Vec::new_in(&&allocator), + view_queries: Vec::new_in(&&allocator), host: R3HostMetadata::new(&allocator), uses_on_changes: false, - inputs: Vec::new_in(&allocator), + inputs: Vec::new_in(&&allocator), outputs, uses_inheritance: false, - export_as: Vec::new_in(&allocator), + export_as: Vec::new_in(&&allocator), providers: None, is_standalone: true, is_signal: false, - host_directives: Vec::new_in(&allocator), + host_directives: Vec::new_in(&&allocator), }; let expr = compile_declare_directive_from_metadata(&allocator, &meta); let js = emit(&expr); @@ -289,18 +289,18 @@ fn directive_uses_inheritance_and_on_changes() { type_argument_count: 0, deps: None::>>, selector: Some(Ident::from("[inheritingDir]")), - queries: Vec::new_in(&allocator), - view_queries: Vec::new_in(&allocator), + queries: Vec::new_in(&&allocator), + view_queries: Vec::new_in(&&allocator), host: R3HostMetadata::new(&allocator), uses_on_changes: true, - inputs: Vec::new_in(&allocator), - outputs: Vec::new_in(&allocator), + inputs: Vec::new_in(&&allocator), + outputs: Vec::new_in(&&allocator), uses_inheritance: true, - export_as: Vec::new_in(&allocator), + export_as: Vec::new_in(&&allocator), providers: None, is_standalone: true, is_signal: false, - host_directives: Vec::new_in(&allocator), + host_directives: Vec::new_in(&&allocator), }; let expr = compile_declare_directive_from_metadata(&allocator, &manual); let js = emit(&expr); @@ -313,7 +313,7 @@ fn directive_export_as_emitted_as_string_array() { let allocator = Allocator::default(); use oxc_angular_compiler::directive::R3DirectiveMetadata; use oxc_angular_compiler::factory::R3DependencyMetadata as FacDep; - let mut export_as = Vec::new_in(&allocator); + let mut export_as = Vec::new_in(&&allocator); export_as.push(Ident::from("alias1")); export_as.push(Ident::from("alias2")); let meta = R3DirectiveMetadata { @@ -322,18 +322,18 @@ fn directive_export_as_emitted_as_string_array() { type_argument_count: 0, deps: None::>>, selector: Some(Ident::from("[myDir]")), - queries: Vec::new_in(&allocator), - view_queries: Vec::new_in(&allocator), + queries: Vec::new_in(&&allocator), + view_queries: Vec::new_in(&&allocator), host: R3HostMetadata::new(&allocator), uses_on_changes: false, - inputs: Vec::new_in(&allocator), - outputs: Vec::new_in(&allocator), + inputs: Vec::new_in(&&allocator), + outputs: Vec::new_in(&&allocator), uses_inheritance: false, export_as, providers: None, is_standalone: true, is_signal: false, - host_directives: Vec::new_in(&allocator), + host_directives: Vec::new_in(&&allocator), }; let expr = compile_declare_directive_from_metadata(&allocator, &meta); let js = emit(&expr); diff --git a/crates/oxc_angular_compiler/tests/partial_factory_test.rs b/crates/oxc_angular_compiler/tests/partial_factory_test.rs index fe41d6445..206c05f58 100644 --- a/crates/oxc_angular_compiler/tests/partial_factory_test.rs +++ b/crates/oxc_angular_compiler/tests/partial_factory_test.rs @@ -17,7 +17,7 @@ use oxc_str::Ident; fn read_var<'a>(allocator: &'a Allocator, name: &'static str) -> OutputExpression<'a> { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(name), source_span: None }, - allocator, + &allocator, )) } @@ -45,7 +45,7 @@ fn emit(expr: &OutputExpression<'_>) -> String { #[test] fn simple_injectable_factory_with_one_dep() { let allocator = Allocator::default(); - let mut deps = Vec::new_in(&allocator); + let mut deps = Vec::new_in(&&allocator); deps.push(R3DependencyMetadata::simple(read_var(&allocator, "HttpClient"))); let meta = @@ -83,7 +83,7 @@ fn factory_with_type_only_invalid_dep_coerces_to_invalid() { // Matches full-mode behavior at factory/compiler.rs:143 — any constructor // param resolving to a type-only import poisons the whole factory. let allocator = Allocator::default(); - let mut deps = Vec::new_in(&allocator); + let mut deps = Vec::new_in(&&allocator); let mut poisoned = R3DependencyMetadata::simple(read_var(&allocator, "TypeOnlyToken")); poisoned.type_only_invalid = true; deps.push(poisoned); @@ -99,7 +99,7 @@ fn factory_with_type_only_invalid_dep_coerces_to_invalid() { #[test] fn factory_with_flag_deps_emits_only_set_flags() { let allocator = Allocator::default(); - let mut deps = Vec::new_in(&allocator); + let mut deps = Vec::new_in(&&allocator); let mut dep = R3DependencyMetadata::simple(read_var(&allocator, "ParentService")); dep.optional = true; dep.skip_self = true; @@ -175,7 +175,7 @@ fn round_trip_through_linker_to_full_factory() { use oxc_angular_compiler::link; let allocator = Allocator::default(); - let mut deps = Vec::new_in(&allocator); + let mut deps = Vec::new_in(&&allocator); deps.push(R3DependencyMetadata::simple(read_var(&allocator, "HttpClient"))); let meta = diff --git a/crates/oxc_angular_compiler/tests/partial_injectable_test.rs b/crates/oxc_angular_compiler/tests/partial_injectable_test.rs index a94ee4aba..553385db1 100644 --- a/crates/oxc_angular_compiler/tests/partial_injectable_test.rs +++ b/crates/oxc_angular_compiler/tests/partial_injectable_test.rs @@ -16,7 +16,7 @@ use oxc_str::Ident; fn read_var<'a>(allocator: &'a Allocator, name: &'static str) -> OutputExpression<'a> { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(name), source_span: None }, - allocator, + &allocator, )) } @@ -117,7 +117,7 @@ fn injectable_with_use_value() { #[test] fn injectable_with_use_factory_and_deps() { let allocator = Allocator::default(); - let mut deps = Vec::new_in(&allocator); + let mut deps = Vec::new_in(&&allocator); deps.push(R3DependencyMetadata::simple(read_var(&allocator, "Dep1"))); let mut optional_dep = R3DependencyMetadata::simple(read_var(&allocator, "Dep2")); optional_dep.optional = true; @@ -238,7 +238,7 @@ fn round_trip_partial_injectable_and_factory_through_linker() { use oxc_angular_compiler::{compile_declare_factory_function, link}; let allocator = Allocator::default(); - let mut ctor_deps = OxcVec::new_in(&allocator); + let mut ctor_deps = OxcVec::new_in(&&allocator); ctor_deps.push(R3DependencyMetadata::simple(read_var(&allocator, "HttpClient"))); let injectable_meta = R3InjectableMetadataBuilder::new() @@ -256,7 +256,7 @@ fn round_trip_partial_injectable_and_factory_through_linker() { type_decl: read_var(&allocator, "ApiService"), type_argument_count: 0, deps: { - let mut v = OxcVec::new_in(&allocator); + let mut v = OxcVec::new_in(&&allocator); v.push(R3DependencyMetadata::simple(read_var(&allocator, "HttpClient"))); R3FactoryDeps::Valid(v) }, diff --git a/crates/oxc_angular_compiler/tests/partial_ng_module_test.rs b/crates/oxc_angular_compiler/tests/partial_ng_module_test.rs index f117d8a11..ace12b00e 100644 --- a/crates/oxc_angular_compiler/tests/partial_ng_module_test.rs +++ b/crates/oxc_angular_compiler/tests/partial_ng_module_test.rs @@ -17,7 +17,7 @@ use oxc_str::Ident; fn read_var<'a>(allocator: &'a Allocator, name: &'static str) -> OutputExpression<'a> { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(name), source_span: None }, - allocator, + &allocator, )) } @@ -47,11 +47,11 @@ fn empty_module_emits_only_type() { #[test] fn module_with_declarations_and_imports() { let allocator = Allocator::default(); - let mut decls = Vec::new_in(&allocator); + let mut decls = Vec::new_in(&&allocator); decls.push(R3Reference::value_only(read_var(&allocator, "MyComp"))); decls.push(R3Reference::value_only(read_var(&allocator, "MyDir"))); - let mut imports = Vec::new_in(&allocator); + let mut imports = Vec::new_in(&&allocator); imports.push(R3Reference::value_only(read_var(&allocator, "CommonModule"))); let meta = R3NgModuleMetadataBuilder::new(&allocator) @@ -177,7 +177,7 @@ fn injector_raw_imports_preserved_over_per_element_imports() { let allocator = Allocator::default(); let raw_imports = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from("EXTERNAL_IMPORTS_ARRAY"), source_span: None }, - &allocator, + &&allocator, )); let meta = R3InjectorMetadataBuilder::new(&allocator) .name(Ident::from("FeatureModule")) diff --git a/crates/oxc_angular_compiler/tests/partial_pipe_test.rs b/crates/oxc_angular_compiler/tests/partial_pipe_test.rs index ac4caf05f..1b061a321 100644 --- a/crates/oxc_angular_compiler/tests/partial_pipe_test.rs +++ b/crates/oxc_angular_compiler/tests/partial_pipe_test.rs @@ -13,7 +13,7 @@ use oxc_str::Ident; fn read_var<'a>(allocator: &'a Allocator, name: &'static str) -> OutputExpression<'a> { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(name), source_span: None }, - allocator, + &allocator, )) } diff --git a/napi/angular-compiler/e2e/compare/package.json b/napi/angular-compiler/e2e/compare/package.json index 7069a658d..2e0c650fc 100644 --- a/napi/angular-compiler/e2e/compare/package.json +++ b/napi/angular-compiler/e2e/compare/package.json @@ -33,8 +33,8 @@ "@oxc-node/cli": "catalog:", "@oxc-node/core": "catalog:", "@types/node": "catalog:", - "oxc-parser": "^0.137.0", - "oxc-transform": "^0.137.0", + "oxc-parser": "^0.138.0", + "oxc-transform": "^0.138.0", "oxfmt": "catalog:", "typescript": "catalog:", "vitest": "catalog:" diff --git a/napi/angular-compiler/src/lib.rs b/napi/angular-compiler/src/lib.rs index d692cbeca..50e3eea25 100644 --- a/napi/angular-compiler/src/lib.rs +++ b/napi/angular-compiler/src/lib.rs @@ -1362,7 +1362,7 @@ pub fn compile_pipe_sync( let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: metadata.class_name, source_span: None }, - &allocator, + &&allocator, )); // Build R3PipeMetadata @@ -1877,7 +1877,7 @@ pub fn compile_injector_sync(input: InjectorCompileInput) -> InjectorNapiCompile // Create type expression for the injector class let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(input.name.as_str()), source_span: None }, - &allocator, + &&allocator, )); // Build the metadata @@ -1889,7 +1889,7 @@ pub fn compile_injector_sync(input: InjectorCompileInput) -> InjectorNapiCompile if let Some(providers_str) = &input.providers { let providers_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(providers_str.as_str()), source_span: None }, - &allocator, + &&allocator, )); builder = builder.providers(providers_expr); } @@ -1899,7 +1899,7 @@ pub fn compile_injector_sync(input: InjectorCompileInput) -> InjectorNapiCompile for import_name in imports { let import_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(import_name.as_str()), source_span: None }, - &allocator, + &&allocator, )); builder = builder.add_import(import_expr); } @@ -2027,7 +2027,7 @@ pub fn compile_class_metadata_sync( // Build the class type expression let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(class_name.as_str()), source_span: None }, - &allocator, + &&allocator, )); // Build decorators array: [{ type: DecoratorClass, args: [...] }] @@ -2248,7 +2248,7 @@ fn compile_factory_impl(input: FactoryCompileInput) -> FactoryNapiCompileResult // Create type expression for the class let type_expr = OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(input.name.as_str()), source_span: None }, - &allocator, + &&allocator, )); // Parse deps_kind and build deps @@ -2257,14 +2257,14 @@ fn compile_factory_impl(input: FactoryCompileInput) -> FactoryNapiCompileResult Some("None") => R3FactoryDeps::None, Some("Valid") | None => { // Build valid dependencies - let mut dep_list = AllocVec::new_in(&allocator); + let mut dep_list = AllocVec::new_in(&&allocator); if let Some(deps) = &input.deps { for dep in deps { // Use ReadVarExpr for token since WrappedNodeExpr cannot be emitted let token = dep.token.as_ref().map(|t| { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(t.as_str()), source_span: None }, - &allocator, + &&allocator, )) }); @@ -2272,7 +2272,7 @@ fn compile_factory_impl(input: FactoryCompileInput) -> FactoryNapiCompileResult let attribute_name_type = dep.attribute_name_type.as_ref().map(|a| { OutputExpression::ReadVar(Box::new_in( ReadVarExpr { name: Ident::from(a.as_str()), source_span: None }, - &allocator, + &&allocator, )) }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ea6a1c8a3..8f4efc745 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -395,11 +395,11 @@ importers: specifier: 'catalog:' version: 24.1.0 oxc-parser: - specifier: ^0.137.0 - version: 0.137.0 + specifier: ^0.138.0 + version: 0.138.0 oxc-transform: - specifier: ^0.137.0 - version: 0.137.0 + specifier: ^0.138.0 + version: 0.138.0 oxfmt: specifier: 'catalog:' version: 0.56.0 @@ -1904,129 +1904,129 @@ packages: '@oxc-node/core@0.1.0': resolution: {integrity: sha512-Spk/ey3zg1CpBU1eUHBPbAbfFddntutZPPsweh+kNh9M9Ksc8j9OCujralW9HrVyi6nNWek1PnMfSZ7NPLLCKA==} - '@oxc-parser/binding-android-arm-eabi@0.137.0': - resolution: {integrity: sha512-KDs+0VPdEmasOkpuJHW9V5WCF+cvYdMQv2Jd+aJXt+cxIx12NToRQRbXaRwUEDsZw+/jMk81Ve8ZFbjUkJTOwA==} + '@oxc-parser/binding-android-arm-eabi@0.138.0': + resolution: {integrity: sha512-hSYAD+F9W2Qh8SETMqBsQRx6YHvB4z+i/i36shlC7tfdZQauMs4vf3G/EQwKOkNlN7rkTiKINvsNmQb9q2MWcQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [android] - '@oxc-parser/binding-android-arm64@0.137.0': - resolution: {integrity: sha512-WhALNzfy3x/RfC6bsqX+csavuUY0yHHE7XfgPE5M542uhoBZUUoGTPG+nkMbGoG4+gcfss5s7urMyn5QBHu0sw==} + '@oxc-parser/binding-android-arm64@0.138.0': + resolution: {integrity: sha512-Ns5LLTp8cVyP8DsYqD482h0HE84xiGYRgtm7g4LtTinq209NAiMF768e/8r2NHaa0UMirS5mrT1m1VwiVmBi4Q==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [android] - '@oxc-parser/binding-darwin-arm64@0.137.0': - resolution: {integrity: sha512-bFPr5hgmNMOMoyPTGtdsK4Ug21RovIPojRMgDDhSp1LtCnc/DkLwGONKjgRjszg677RlGnkYSviQ8hHaUPOVYA==} + '@oxc-parser/binding-darwin-arm64@0.138.0': + resolution: {integrity: sha512-Yka0m4YhKUHBIZufafSLAeO+DUrfHPtNXBlZSj7DxshquIl41x/a+i/MbRnbOy8heuLiYU1STa6h0FAAzT7Pbw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [darwin] - '@oxc-parser/binding-darwin-x64@0.137.0': - resolution: {integrity: sha512-CL5dMm1asqXIDZHg14FLxj3Mc36w8PI7xCWh1uA4is6z8g2XrIILoTcQYOxDbwzuk34RDPX5IAGUxZr6LA9KAg==} + '@oxc-parser/binding-darwin-x64@0.138.0': + resolution: {integrity: sha512-MWLUZZzmNRUqTWueZF27ncreaZ1wZ0gboWL2QMPxRQA2xgOmBPlGg2H9pAKJSPBlwEHcWa9TdWRiehAS+yls8w==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [darwin] - '@oxc-parser/binding-freebsd-x64@0.137.0': - resolution: {integrity: sha512-79h8rYGnSlKPGWo7mHr2ixO6ea7aW8B0CT965SZ8SLbNnCOH5aOYBTeVXUY6eMvEaiLyWr8Skuiugr5pDYgLGw==} + '@oxc-parser/binding-freebsd-x64@0.138.0': + resolution: {integrity: sha512-Vae5tzsrzZ/lCDVCZUMi/vzSiiHEgcOEfsyIfWOHmjZ2ji+gT+n96T757yX5/f7/7JIJuiannAHJKV5ARaF6ng==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [freebsd] - '@oxc-parser/binding-linux-arm-gnueabihf@0.137.0': - resolution: {integrity: sha512-ASgmlSimhGyr0lksgVIo6hibz1obnDq4qJbiMX/AzltfgPnanRrzG1Q+23g8ljOHOjv6dsznkUuCYL3gg0sY1Q==} + '@oxc-parser/binding-linux-arm-gnueabihf@0.138.0': + resolution: {integrity: sha512-qkU8wv5mYexrCw0X4DHFgxGbRScwGLIIKUkHXU7xXEiLoMnQzELak2gujxfa9GFrlEgPjbyLUDFHWm67Zs38ng==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [linux] - '@oxc-parser/binding-linux-arm-musleabihf@0.137.0': - resolution: {integrity: sha512-AU2J9aa22Sx32wRGnDjybOU9TQXXQUud5sdUi+ZB0XxwM8aToWLweV+yA0wlQm0yIUVqljquqoHCYEq9II8gJQ==} + '@oxc-parser/binding-linux-arm-musleabihf@0.138.0': + resolution: {integrity: sha512-3HgULIvoDV7h2ZfVYzxQwOSOJnAjMwYmyUBzndNuLRGgBNI549ED0P6AGmN9y2TnSvrwJ+Q8zqdxqssMnGXitA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [linux] - '@oxc-parser/binding-linux-arm64-gnu@0.137.0': - resolution: {integrity: sha512-GdEtiG89yMr7XkUGxifgodXEEm2f+xW2f9CpDjlgAnBOwhTmrpQMvhOGobLVKUyzf/qHBXW16smk5zbF3nZU6w==} + '@oxc-parser/binding-linux-arm64-gnu@0.138.0': + resolution: {integrity: sha512-pIonbH2p0KLCwz4CNPCi0xGqci4numpMQDCLJwLfsrEky7NUuByKDFhCjzE0E7vR3aj/lBjyMoTskHBo/qSg8g==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] libc: [glibc] - '@oxc-parser/binding-linux-arm64-musl@0.137.0': - resolution: {integrity: sha512-EGJ+Bs8iXx8KBH8DQ5BLoEm5lnHaYjlh4/8j8vFhrr/6z4tqONy5BZDzLpKmmNWlN6Hlc5r8YOuBVHqZ9vRFEQ==} + '@oxc-parser/binding-linux-arm64-musl@0.138.0': + resolution: {integrity: sha512-cT5L1Xz/5m6Ga1hD3922gLc+fePOauJZJdApPTI/2Vu0EmYo62uHG9V5Dq65hhgU9TW10oDi2840y9cGdd7BIg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] libc: [musl] - '@oxc-parser/binding-linux-ppc64-gnu@0.137.0': - resolution: {integrity: sha512-vzFUQENy/fnbSe5DZWovq6tIBc1uhuMztanSW6rz1e9WdQE4gHwYuD7ZII6JnrJifd1R3RSoqiZbgRFlVL2tYQ==} + '@oxc-parser/binding-linux-ppc64-gnu@0.138.0': + resolution: {integrity: sha512-hKy/vvejKk3LNE/FsRbekWejLa046//TnLWtSo7ur29NIsNbSIvnOVYIirSVC7fsd6NO8UFzwDdcoZfCyBvSBA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [ppc64] os: [linux] libc: [glibc] - '@oxc-parser/binding-linux-riscv64-gnu@0.137.0': - resolution: {integrity: sha512-SfVI14HBQs9gtLcUD5hTt5hsNbdrqSUNg9S8muN+LhVQ5nf1WwH3hAoK6B9NKgdYgWAQSXFXGiiBedQ4r/BKuw==} + '@oxc-parser/binding-linux-riscv64-gnu@0.138.0': + resolution: {integrity: sha512-bh6tjNGq0v0b9GAMu0pTv/YpTqepCFy0TIOtQHm8+41fZwLXTaB6xiEWVUSarNCXqc5kyzYcH6EOfwW1sJxJOw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [riscv64] os: [linux] libc: [glibc] - '@oxc-parser/binding-linux-riscv64-musl@0.137.0': - resolution: {integrity: sha512-e7Ppy4FCIFNQxT/ikSeIWFoQ0l+N9vgtRBtLcyZXeolTzApyVoPqEXsYPrcdM/9i0Bwk8knvYd37vaEMxHyi6g==} + '@oxc-parser/binding-linux-riscv64-musl@0.138.0': + resolution: {integrity: sha512-HhOkddcClSTtTxY10f/mACblKcQdxWy4lYYwX12G23j+S5eiJ5y1kpo1r7kKng+2bdnCBO+lCDWOVVc9kVl9+g==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [riscv64] os: [linux] libc: [musl] - '@oxc-parser/binding-linux-s390x-gnu@0.137.0': - resolution: {integrity: sha512-Bho5qFwdhqsIFR7gipYEUlqvi3SRrY8sugxXig380MIaakBB1PyU9+7dBiBVScfImTNWhijUxdBwqrprGdq5WA==} + '@oxc-parser/binding-linux-s390x-gnu@0.138.0': + resolution: {integrity: sha512-5mi+wtbeJiEa4waGG88EcEGgJBBNJdDeIcayPPcrLNMXbCrgdtbb80q0Nrat7A8NglLUVzhuTAAp7K6PjmUO8Q==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [s390x] os: [linux] libc: [glibc] - '@oxc-parser/binding-linux-x64-gnu@0.137.0': - resolution: {integrity: sha512-36mGWtg7PyFzjJwGDkH6/F4o2nIDEoKXLPr/X/lwqklkomQwJJt1I5GJVmGhovUEmgPK5WAeAZMqlFCehwiy9Q==} + '@oxc-parser/binding-linux-x64-gnu@0.138.0': + resolution: {integrity: sha512-ckbq3AMI7lI8AhQtE8KdqYRmzmzwKfCU12QN/PBKXO72PfWdvvZQN0hFShDX/XRNsPqjddLmvXaQMT3zfYtNlw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] libc: [glibc] - '@oxc-parser/binding-linux-x64-musl@0.137.0': - resolution: {integrity: sha512-/Jqx6+N7A44n2BdvUr7pXhVr2vFjs6WGH3unZRczwrfiH0H1zY0QwKQMG/dtRiTlKGDKGukznPT8lx84/oEsZg==} + '@oxc-parser/binding-linux-x64-musl@0.138.0': + resolution: {integrity: sha512-JrCOzHO9BYEs5Xz5JHYBxSc/hYKxfXUj5QQb64sERSbkQot6+KEgMTOR2C9hLrhaqOui65OYcFyTTS+YxXDtnA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] libc: [musl] - '@oxc-parser/binding-openharmony-arm64@0.137.0': - resolution: {integrity: sha512-9Uj0qHNNl+OgT1UTGwF7ixIXU6T1u2SbMidmgPy/h1h/fl2gRS6YpAxxY1gwHofcWjoTwkoMFd8xs5Vuj6GOFA==} + '@oxc-parser/binding-openharmony-arm64@0.138.0': + resolution: {integrity: sha512-eASMMfOOIfLHkWJRPSu8llByvVRM+c1M/lh18KjsjELM3y10+7B5iBbbrht9LdtsJXQ+mRuP/lJ7UWe3Ok3ehw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [openharmony] - '@oxc-parser/binding-wasm32-wasi@0.137.0': - resolution: {integrity: sha512-gW2vfkytNGgMVADiuzdvOfw0mWG9za20F/1fCJsif5aBMAvWJTSbpIXbIe0XkOe0VENk+PadpQ7cZgUy2sUJcA==} + '@oxc-parser/binding-wasm32-wasi@0.138.0': + resolution: {integrity: sha512-BnTCO87Iwc57NufXS7vcrkrmpN+daeCeYr1+/xgPT6HjwNs0lBmJYeFrcOs4WkNN8yscdd6Rc4FxWh3+59hAFw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [wasm32] - '@oxc-parser/binding-win32-arm64-msvc@0.137.0': - resolution: {integrity: sha512-x+pFANF0yL5uK/6T7lu6SlR5qid6sp//eZXKLq5iNsIE+EQg6EaS8/wsW7E91nXXjpnPhSoMOHXShSVhGRdn8w==} + '@oxc-parser/binding-win32-arm64-msvc@0.138.0': + resolution: {integrity: sha512-+Zi47boD2wKNL0hOA47Vkwk6njMZ8sOsr4Geu/56EUtlooDh9crNOU41U6bXGS0UjC4Y72HtRA1iuB6qx1ARUw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [win32] - '@oxc-parser/binding-win32-ia32-msvc@0.137.0': - resolution: {integrity: sha512-sQUqym80PFi6McRsIqfJrSu2JrSClEZIXXD+/FjAFoULEKzOPsldIdFBG96xdX8aVMzCNQ9792FPx3MfkEIrFA==} + '@oxc-parser/binding-win32-ia32-msvc@0.138.0': + resolution: {integrity: sha512-SYcV674Wi2WuoBefUFgf0PBMNlZe5IF0YZ0TnP7DK+EusMVpEWq6iz+7r64svjAb7vjthzlas0FUCSlz8YkqYg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [ia32] os: [win32] - '@oxc-parser/binding-win32-x64-msvc@0.137.0': - resolution: {integrity: sha512-2AsevxlvNN4WKxpEn3RtqD5zbqMaXF+T7JXblsP4gVuY+vC9dXS4ED/PwfRCliFqoeisYS3Iro4DHzxr0TEvVA==} + '@oxc-parser/binding-win32-x64-msvc@0.138.0': + resolution: {integrity: sha512-QZplnCxS4vPe4StAVBtvD2bW3pELlidf0Ek6iQ/HHiCjbEtrs5pFZZfLAoPhKLJyDzyxoGAdic9bSIYrJYTZcg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [win32] @@ -2034,129 +2034,132 @@ packages: '@oxc-project/types@0.137.0': resolution: {integrity: sha512-WT+Gb24i8hmvo85AIv2oEYouEXkRlKAlT9WaCa3TfLgNCN+GhrJOGZuIlMouAh38Qe4QOx26eUOVsq70qXrywA==} - '@oxc-transform/binding-android-arm-eabi@0.137.0': - resolution: {integrity: sha512-D9Xk5kR97ujC/Hlwe5OEk0CrvbnRcp6VpjjD/EXLc9bjDcueWhNxh3Kg70uTut6PYqySHIfZQvFXqE7udmqecg==} + '@oxc-project/types@0.138.0': + resolution: {integrity: sha512-1a7ZKmrRTCoN1XMZ4L0PyyqrMnrNlLyPuOkdSX2MZg7IiIGRUyurNhAm73ptDOraoBcIordsIGKNPKUzy3ZmfA==} + + '@oxc-transform/binding-android-arm-eabi@0.138.0': + resolution: {integrity: sha512-YBNqz0zCNIciKXq+ktn8ePuv4laVE2nW9M2Cyo6K3mqcQOS97GmMFpOBJYJ7vvd9FbJmCVNvNf/21OG+K+EOyA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [android] - '@oxc-transform/binding-android-arm64@0.137.0': - resolution: {integrity: sha512-LyqCR2ExTg4UsWPXXbenwmPlA52GUKaCp0uIEEa9ZGixAJZtPw5rtc3PqaCZPq4I7L6zN9HavsnyG09aiIrrKA==} + '@oxc-transform/binding-android-arm64@0.138.0': + resolution: {integrity: sha512-uvwBNFt7F8p/ubmN+ujdu2poRhfzDnSlDCPlv3Hw7WP0zv7Zj/rLXn+WemsROg+o+xFKEo3LOvTDTTxQtK4h9A==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [android] - '@oxc-transform/binding-darwin-arm64@0.137.0': - resolution: {integrity: sha512-AtGXaWe2TIVFBvtUm37N549f4hCQNnbxUTOCCv1FugoJHsb80Cq0fOfh8ntZxzCEd/4KsmxqFeeYUutE5+Fr0w==} + '@oxc-transform/binding-darwin-arm64@0.138.0': + resolution: {integrity: sha512-eJFulgKaKX9DBIjxc4c2QH8MZjUvJNwJvqipYEDGqSAiaVDnG+TGB6H9IadzQal7aUvncMU5hOT9q2zRpe+09w==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [darwin] - '@oxc-transform/binding-darwin-x64@0.137.0': - resolution: {integrity: sha512-80LqHzx7TCJ8Bp0zMh/39MRod9KBAZ2Bno7oMebNWp9U0j24dP2hm4DukFrW1g6g5+HjVSTCYQ9bHzLoeCKLDQ==} + '@oxc-transform/binding-darwin-x64@0.138.0': + resolution: {integrity: sha512-hxxGnegzEVSdwpKlVI44m9iTxQEnt3ycRLASMyAF+P1QN+i7bKViM/AxriMETipN/xt7kMaUVEdm7e0gXNkgig==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [darwin] - '@oxc-transform/binding-freebsd-x64@0.137.0': - resolution: {integrity: sha512-V8VjKlbFPWvE/v81NVAFaPTu5xK4+nMMSvcCLAGFE4FcUJXB7MEZ0A+UXufwn2A6dZpQwQPCYSFw7m7KAVr5wg==} + '@oxc-transform/binding-freebsd-x64@0.138.0': + resolution: {integrity: sha512-0nlG2y5sVCpHE5TiYcuWHqmfVXQex1OYt4tmEfwRiu4QV4038W8zM2iHRtOAe6mAU9eJdPEgMl5+aVMbY/3yrw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [freebsd] - '@oxc-transform/binding-linux-arm-gnueabihf@0.137.0': - resolution: {integrity: sha512-iBR+nI7tZyHued1VTNjOEb6jYLjGaqDsjTG5AMa2XJHZiELsniZHkXlYYgVbSLQH+Hsp0+THmeJDl72EQiVCeA==} + '@oxc-transform/binding-linux-arm-gnueabihf@0.138.0': + resolution: {integrity: sha512-6P8a3pB8KmpZelVYS+rozcYmEqUBi4P16la6u5BDIphoRjMHyeO1/QLB/GNVxXwkS3vPJy8Gp1SFvf+XGXt8Nw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [linux] - '@oxc-transform/binding-linux-arm-musleabihf@0.137.0': - resolution: {integrity: sha512-V3jIACMxrwEiIPut2YAGTfE54bux0drlsw37Rl0KnWXOV9qgJGK04LNmkKARLtqTyZFoe5ymcpM0H/MqvHeMVA==} + '@oxc-transform/binding-linux-arm-musleabihf@0.138.0': + resolution: {integrity: sha512-1cBvbRxhVV5/+9H9ZzAKDXae3W2AdAaaz7WOsn0cQy/Vz8CYz/3GMQSYard15EzTj/EKTANPqY4qIvOAGqYowA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [linux] - '@oxc-transform/binding-linux-arm64-gnu@0.137.0': - resolution: {integrity: sha512-ZJbV5QwlrDpglZFMS+dwlsFnzWTgQlmboVJrXCZZqaNubTqB+QjlaPliV++rSX3untUDd9MEOa+iwvUtzcutIQ==} + '@oxc-transform/binding-linux-arm64-gnu@0.138.0': + resolution: {integrity: sha512-PLE7otK/VXZj2HdbA0Idbp9pfZOMMIE8kkCRN8k9ftty4GWBLjlJ1TDOWwJ7PpOi0oWOHlpOjZaaTDvX3rix7A==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] libc: [glibc] - '@oxc-transform/binding-linux-arm64-musl@0.137.0': - resolution: {integrity: sha512-3t5oSmqdBLKG6Yol6Ho3Y7NEpGZM3kP9EhdFjsejHg4shloABI3p0XR+CwF3lmzqdqDISdni/Z/2hBlMNEuOBQ==} + '@oxc-transform/binding-linux-arm64-musl@0.138.0': + resolution: {integrity: sha512-9aIEbbkuxpkIoC/y1wpY2RR4E45DJAiEGjpSWeK6s8r6cccOF4raJcnSLRiCJ5tsjXMNI/1+7cdYfXORBTkFCA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] libc: [musl] - '@oxc-transform/binding-linux-ppc64-gnu@0.137.0': - resolution: {integrity: sha512-WxR7ws6tw8fjwIUAgvS8VJNG809boXz4XORgtxtuvDJQdO7Uhls+QK73zhMYqAOYFi1dMkbpCSkz8sC0HjbeTQ==} + '@oxc-transform/binding-linux-ppc64-gnu@0.138.0': + resolution: {integrity: sha512-qqYFxGPNKE9rZVcKzT7FczlpH0NiXwe3MXxkxNBW/0CiBZif3yhT/GlMOSm/Xu/mnhVwrNnHF9xMhs3eSvFBOQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [ppc64] os: [linux] libc: [glibc] - '@oxc-transform/binding-linux-riscv64-gnu@0.137.0': - resolution: {integrity: sha512-0CDDSbasGrKXkti2XP1FdinZnSljCHVf7c1ntKArHvhZH5c8QfElPpZlZhXGbt0EZIbkU1dXvZOhj31BILFQFQ==} + '@oxc-transform/binding-linux-riscv64-gnu@0.138.0': + resolution: {integrity: sha512-5aeMF7aYy0MEU7ccAqr8NR1Z+fNhaRSk1KjGtI2nDsa3S77D0yA5SxUMq2yX265jNPwWhnc6FqN+mLdVOVJs2w==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [riscv64] os: [linux] libc: [glibc] - '@oxc-transform/binding-linux-riscv64-musl@0.137.0': - resolution: {integrity: sha512-n0w7kWnigg9ayFZ6jOQ01MfeF2pS8hrYX2bMNDzQrNLwRT2w/dkMWITOu0b3JRFZEnh8pFY0wDYGDgG4En+xog==} + '@oxc-transform/binding-linux-riscv64-musl@0.138.0': + resolution: {integrity: sha512-hFWlJSVqwCCS33S9y8ZgeuN48YjQRnG2n/Dox994ETmgO1eEYRLIsBBqtxuQpjaTK3ozif58tlPoiOUNPHOrTw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [riscv64] os: [linux] libc: [musl] - '@oxc-transform/binding-linux-s390x-gnu@0.137.0': - resolution: {integrity: sha512-t02alZgnJheIMH38XWyDMQqriSmFy0BA2p+iKA5jAl8YYTsak2aStB7i0umJz8vh0dJrezugLvpg44WMzU3CPQ==} + '@oxc-transform/binding-linux-s390x-gnu@0.138.0': + resolution: {integrity: sha512-DDzZn/MdAFCdF/uaEgxmILRQXk25icDJepzXa2PKjgRsoJiIIHBb/9tirIIRPcGcD5XtIBrkErvJ38pA2Ve9Cw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [s390x] os: [linux] libc: [glibc] - '@oxc-transform/binding-linux-x64-gnu@0.137.0': - resolution: {integrity: sha512-e1W9L67MFHUyDVKRGSMLoYNSZTxpItJNsizqI7CkTujMQ/lanAxeBgsrVAHaPftDxW6omDnARpq9qEBFKBS9aQ==} + '@oxc-transform/binding-linux-x64-gnu@0.138.0': + resolution: {integrity: sha512-5EtifH5oFFIANFyA5Eev8jNAS3oOZdJolKtL7dfvdGp2dpRZj9g2Da+HDjr9rLXLsks/pIdMpMl2NBKzQYmugw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] libc: [glibc] - '@oxc-transform/binding-linux-x64-musl@0.137.0': - resolution: {integrity: sha512-1yF7219jYlhzJppVopzChj5OMFdXu1e1G9gWBkGNvNTUtBHvprQy21lzSQ0MHJn/tY/ul0QqiSjX2aQfewR5RA==} + '@oxc-transform/binding-linux-x64-musl@0.138.0': + resolution: {integrity: sha512-UxX4DbJg9IwrEe1F3hx/j5qURLm2zmo8VHz8JBoEt1GrWmza3lFrxW8eiWOgg5pv792tBjGz3hWddCb4SEmz2g==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] libc: [musl] - '@oxc-transform/binding-openharmony-arm64@0.137.0': - resolution: {integrity: sha512-JIyYVli943JmtkiG63O/Nxv9jwwn3KOqdbbrtS+udBEI94EIriOp9+znF3Etc6r/XKcfUffyc9kkfAPL1utx+w==} + '@oxc-transform/binding-openharmony-arm64@0.138.0': + resolution: {integrity: sha512-6NmNGQ9TpI9SwYM08a/rz9xdjSMeQhse8og5OkoJRmZrWmHN4wUm+IAEFzS7g5uxPK2Y9vkqvLUjg/uvsdXkFg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [openharmony] - '@oxc-transform/binding-wasm32-wasi@0.137.0': - resolution: {integrity: sha512-GBaJLQkmtYXFnpzL5zZfl48Y3YIqdST/8cAooDm2PHIYOxFwaWfMHK8WbsXoBT6ifQ1kw+4xJ/89LBqjPdbjZQ==} + '@oxc-transform/binding-wasm32-wasi@0.138.0': + resolution: {integrity: sha512-MQFxHo3SbpNLarY/tA3/CpX/X6D6waggyWfZsOZBFhyPwnIIamozk7KwOMs2A9X81KHQBFY6InSIZeXUnWZDZw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [wasm32] - '@oxc-transform/binding-win32-arm64-msvc@0.137.0': - resolution: {integrity: sha512-uyQMui1xgauzFNTVm4gsMEuKIP5WLrkRWGustWq8jCZ7wlCEH8GZ+ebaKFxhEbr8z+HXYyQ2uxCrC0VumlMezQ==} + '@oxc-transform/binding-win32-arm64-msvc@0.138.0': + resolution: {integrity: sha512-S5yr+EwQgtro5hs8JyPhaLJ+ZYj3+aCbQhQLqxdNLPUVV3JS4SFUzeUmgvcF9LPz8UC7QmYrJPeFb/RBBWwckw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [win32] - '@oxc-transform/binding-win32-ia32-msvc@0.137.0': - resolution: {integrity: sha512-d2BDYpw41XD69hz/0bfPblb3dPnta/dGKJ49ivdqLeORC2d13Vv1Gz85bfz2DZ5b/NdGEViFlCdT8ARHalgK/g==} + '@oxc-transform/binding-win32-ia32-msvc@0.138.0': + resolution: {integrity: sha512-2p35rl20vNu/uQMaKM9/IsBXKIo8Y1lu4lMo0OG0leBCYIePRlHHls+0AQOo29xbnupH6yGq5HdVZORJ+JNJPg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [ia32] os: [win32] - '@oxc-transform/binding-win32-x64-msvc@0.137.0': - resolution: {integrity: sha512-9NmWzbcDZRCvGOWeN6xB3N6WubJH2eF2qvVnPMcIv+LBV1WlsZSCnFBpUIvqk/MFalJrVFQ2SkGDwvdm0FtNIQ==} + '@oxc-transform/binding-win32-x64-msvc@0.138.0': + resolution: {integrity: sha512-b3HcocQafzqrG2+TXgDUm4gYDZDjEIlJ98MqwkxTJnSGi0h4jI+7bmecRcFmrvZOOq7Et2O/fRs2jFCp0+Aw4w==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [win32] @@ -4015,12 +4018,12 @@ packages: ordered-binary@1.6.1: resolution: {integrity: sha512-QkCdPooczexPLiXIrbVOPYkR3VO3T6v2OyKRkR1Xbhpy7/LAVXwahnRCgRp78Oe/Ehf0C/HATAxfSr6eA1oX+w==} - oxc-parser@0.137.0: - resolution: {integrity: sha512-yFImD+WLElJpLKy8llG1qe4DCmMsL18peRp8XP1JKfig/gISbJkglnpDtX2aTmAn10kZF7164HbN2H8QPsXxGg==} + oxc-parser@0.138.0: + resolution: {integrity: sha512-c25lvfpZ2+WY1yk6NkP0X0RTQg0ZxgSVaZHDa7lt6fEe1jwZjPWkRWvTyZ1xyaM7roVJMdtRCfbhUj/d4ims3Q==} engines: {node: ^20.19.0 || >=22.12.0} - oxc-transform@0.137.0: - resolution: {integrity: sha512-uQWiGRkA4ZYgZ99t0ZpLsxTVzrUJJUAS3ArGDKukVLiLf9pGXvtdEksTL2M7YoXbuUn/slU9+kyDdScuwFEMDQ==} + oxc-transform@0.138.0: + resolution: {integrity: sha512-PgCUGInuop9TGcFAL/cYSmUxAXhDMp3BIJN/FS9MhBhfToitfzj0pou4VrHBVuflM1b2thKccYbx7bGgjVryQg==} engines: {node: ^20.19.0 || >=22.12.0} oxfmt@0.56.0: @@ -5796,134 +5799,136 @@ snapshots: '@oxc-node/core-win32-ia32-msvc': 0.1.0 '@oxc-node/core-win32-x64-msvc': 0.1.0 - '@oxc-parser/binding-android-arm-eabi@0.137.0': + '@oxc-parser/binding-android-arm-eabi@0.138.0': optional: true - '@oxc-parser/binding-android-arm64@0.137.0': + '@oxc-parser/binding-android-arm64@0.138.0': optional: true - '@oxc-parser/binding-darwin-arm64@0.137.0': + '@oxc-parser/binding-darwin-arm64@0.138.0': optional: true - '@oxc-parser/binding-darwin-x64@0.137.0': + '@oxc-parser/binding-darwin-x64@0.138.0': optional: true - '@oxc-parser/binding-freebsd-x64@0.137.0': + '@oxc-parser/binding-freebsd-x64@0.138.0': optional: true - '@oxc-parser/binding-linux-arm-gnueabihf@0.137.0': + '@oxc-parser/binding-linux-arm-gnueabihf@0.138.0': optional: true - '@oxc-parser/binding-linux-arm-musleabihf@0.137.0': + '@oxc-parser/binding-linux-arm-musleabihf@0.138.0': optional: true - '@oxc-parser/binding-linux-arm64-gnu@0.137.0': + '@oxc-parser/binding-linux-arm64-gnu@0.138.0': optional: true - '@oxc-parser/binding-linux-arm64-musl@0.137.0': + '@oxc-parser/binding-linux-arm64-musl@0.138.0': optional: true - '@oxc-parser/binding-linux-ppc64-gnu@0.137.0': + '@oxc-parser/binding-linux-ppc64-gnu@0.138.0': optional: true - '@oxc-parser/binding-linux-riscv64-gnu@0.137.0': + '@oxc-parser/binding-linux-riscv64-gnu@0.138.0': optional: true - '@oxc-parser/binding-linux-riscv64-musl@0.137.0': + '@oxc-parser/binding-linux-riscv64-musl@0.138.0': optional: true - '@oxc-parser/binding-linux-s390x-gnu@0.137.0': + '@oxc-parser/binding-linux-s390x-gnu@0.138.0': optional: true - '@oxc-parser/binding-linux-x64-gnu@0.137.0': + '@oxc-parser/binding-linux-x64-gnu@0.138.0': optional: true - '@oxc-parser/binding-linux-x64-musl@0.137.0': + '@oxc-parser/binding-linux-x64-musl@0.138.0': optional: true - '@oxc-parser/binding-openharmony-arm64@0.137.0': + '@oxc-parser/binding-openharmony-arm64@0.138.0': optional: true - '@oxc-parser/binding-wasm32-wasi@0.137.0': + '@oxc-parser/binding-wasm32-wasi@0.138.0': dependencies: '@emnapi/core': 1.11.1 '@emnapi/runtime': 1.11.1 '@napi-rs/wasm-runtime': 1.1.6(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1) optional: true - '@oxc-parser/binding-win32-arm64-msvc@0.137.0': + '@oxc-parser/binding-win32-arm64-msvc@0.138.0': optional: true - '@oxc-parser/binding-win32-ia32-msvc@0.137.0': + '@oxc-parser/binding-win32-ia32-msvc@0.138.0': optional: true - '@oxc-parser/binding-win32-x64-msvc@0.137.0': + '@oxc-parser/binding-win32-x64-msvc@0.138.0': optional: true '@oxc-project/types@0.137.0': {} - '@oxc-transform/binding-android-arm-eabi@0.137.0': + '@oxc-project/types@0.138.0': {} + + '@oxc-transform/binding-android-arm-eabi@0.138.0': optional: true - '@oxc-transform/binding-android-arm64@0.137.0': + '@oxc-transform/binding-android-arm64@0.138.0': optional: true - '@oxc-transform/binding-darwin-arm64@0.137.0': + '@oxc-transform/binding-darwin-arm64@0.138.0': optional: true - '@oxc-transform/binding-darwin-x64@0.137.0': + '@oxc-transform/binding-darwin-x64@0.138.0': optional: true - '@oxc-transform/binding-freebsd-x64@0.137.0': + '@oxc-transform/binding-freebsd-x64@0.138.0': optional: true - '@oxc-transform/binding-linux-arm-gnueabihf@0.137.0': + '@oxc-transform/binding-linux-arm-gnueabihf@0.138.0': optional: true - '@oxc-transform/binding-linux-arm-musleabihf@0.137.0': + '@oxc-transform/binding-linux-arm-musleabihf@0.138.0': optional: true - '@oxc-transform/binding-linux-arm64-gnu@0.137.0': + '@oxc-transform/binding-linux-arm64-gnu@0.138.0': optional: true - '@oxc-transform/binding-linux-arm64-musl@0.137.0': + '@oxc-transform/binding-linux-arm64-musl@0.138.0': optional: true - '@oxc-transform/binding-linux-ppc64-gnu@0.137.0': + '@oxc-transform/binding-linux-ppc64-gnu@0.138.0': optional: true - '@oxc-transform/binding-linux-riscv64-gnu@0.137.0': + '@oxc-transform/binding-linux-riscv64-gnu@0.138.0': optional: true - '@oxc-transform/binding-linux-riscv64-musl@0.137.0': + '@oxc-transform/binding-linux-riscv64-musl@0.138.0': optional: true - '@oxc-transform/binding-linux-s390x-gnu@0.137.0': + '@oxc-transform/binding-linux-s390x-gnu@0.138.0': optional: true - '@oxc-transform/binding-linux-x64-gnu@0.137.0': + '@oxc-transform/binding-linux-x64-gnu@0.138.0': optional: true - '@oxc-transform/binding-linux-x64-musl@0.137.0': + '@oxc-transform/binding-linux-x64-musl@0.138.0': optional: true - '@oxc-transform/binding-openharmony-arm64@0.137.0': + '@oxc-transform/binding-openharmony-arm64@0.138.0': optional: true - '@oxc-transform/binding-wasm32-wasi@0.137.0': + '@oxc-transform/binding-wasm32-wasi@0.138.0': dependencies: '@emnapi/core': 1.11.1 '@emnapi/runtime': 1.11.1 '@napi-rs/wasm-runtime': 1.1.6(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1) optional: true - '@oxc-transform/binding-win32-arm64-msvc@0.137.0': + '@oxc-transform/binding-win32-arm64-msvc@0.138.0': optional: true - '@oxc-transform/binding-win32-ia32-msvc@0.137.0': + '@oxc-transform/binding-win32-ia32-msvc@0.138.0': optional: true - '@oxc-transform/binding-win32-x64-msvc@0.137.0': + '@oxc-transform/binding-win32-x64-msvc@0.138.0': optional: true '@oxfmt/binding-android-arm-eabi@0.56.0': @@ -7413,53 +7418,53 @@ snapshots: ordered-binary@1.6.1: optional: true - oxc-parser@0.137.0: + oxc-parser@0.138.0: dependencies: - '@oxc-project/types': 0.137.0 + '@oxc-project/types': 0.138.0 optionalDependencies: - '@oxc-parser/binding-android-arm-eabi': 0.137.0 - '@oxc-parser/binding-android-arm64': 0.137.0 - '@oxc-parser/binding-darwin-arm64': 0.137.0 - '@oxc-parser/binding-darwin-x64': 0.137.0 - '@oxc-parser/binding-freebsd-x64': 0.137.0 - '@oxc-parser/binding-linux-arm-gnueabihf': 0.137.0 - '@oxc-parser/binding-linux-arm-musleabihf': 0.137.0 - '@oxc-parser/binding-linux-arm64-gnu': 0.137.0 - '@oxc-parser/binding-linux-arm64-musl': 0.137.0 - '@oxc-parser/binding-linux-ppc64-gnu': 0.137.0 - '@oxc-parser/binding-linux-riscv64-gnu': 0.137.0 - '@oxc-parser/binding-linux-riscv64-musl': 0.137.0 - '@oxc-parser/binding-linux-s390x-gnu': 0.137.0 - '@oxc-parser/binding-linux-x64-gnu': 0.137.0 - '@oxc-parser/binding-linux-x64-musl': 0.137.0 - '@oxc-parser/binding-openharmony-arm64': 0.137.0 - '@oxc-parser/binding-wasm32-wasi': 0.137.0 - '@oxc-parser/binding-win32-arm64-msvc': 0.137.0 - '@oxc-parser/binding-win32-ia32-msvc': 0.137.0 - '@oxc-parser/binding-win32-x64-msvc': 0.137.0 - - oxc-transform@0.137.0: + '@oxc-parser/binding-android-arm-eabi': 0.138.0 + '@oxc-parser/binding-android-arm64': 0.138.0 + '@oxc-parser/binding-darwin-arm64': 0.138.0 + '@oxc-parser/binding-darwin-x64': 0.138.0 + '@oxc-parser/binding-freebsd-x64': 0.138.0 + '@oxc-parser/binding-linux-arm-gnueabihf': 0.138.0 + '@oxc-parser/binding-linux-arm-musleabihf': 0.138.0 + '@oxc-parser/binding-linux-arm64-gnu': 0.138.0 + '@oxc-parser/binding-linux-arm64-musl': 0.138.0 + '@oxc-parser/binding-linux-ppc64-gnu': 0.138.0 + '@oxc-parser/binding-linux-riscv64-gnu': 0.138.0 + '@oxc-parser/binding-linux-riscv64-musl': 0.138.0 + '@oxc-parser/binding-linux-s390x-gnu': 0.138.0 + '@oxc-parser/binding-linux-x64-gnu': 0.138.0 + '@oxc-parser/binding-linux-x64-musl': 0.138.0 + '@oxc-parser/binding-openharmony-arm64': 0.138.0 + '@oxc-parser/binding-wasm32-wasi': 0.138.0 + '@oxc-parser/binding-win32-arm64-msvc': 0.138.0 + '@oxc-parser/binding-win32-ia32-msvc': 0.138.0 + '@oxc-parser/binding-win32-x64-msvc': 0.138.0 + + oxc-transform@0.138.0: optionalDependencies: - '@oxc-transform/binding-android-arm-eabi': 0.137.0 - '@oxc-transform/binding-android-arm64': 0.137.0 - '@oxc-transform/binding-darwin-arm64': 0.137.0 - '@oxc-transform/binding-darwin-x64': 0.137.0 - '@oxc-transform/binding-freebsd-x64': 0.137.0 - '@oxc-transform/binding-linux-arm-gnueabihf': 0.137.0 - '@oxc-transform/binding-linux-arm-musleabihf': 0.137.0 - '@oxc-transform/binding-linux-arm64-gnu': 0.137.0 - '@oxc-transform/binding-linux-arm64-musl': 0.137.0 - '@oxc-transform/binding-linux-ppc64-gnu': 0.137.0 - '@oxc-transform/binding-linux-riscv64-gnu': 0.137.0 - '@oxc-transform/binding-linux-riscv64-musl': 0.137.0 - '@oxc-transform/binding-linux-s390x-gnu': 0.137.0 - '@oxc-transform/binding-linux-x64-gnu': 0.137.0 - '@oxc-transform/binding-linux-x64-musl': 0.137.0 - '@oxc-transform/binding-openharmony-arm64': 0.137.0 - '@oxc-transform/binding-wasm32-wasi': 0.137.0 - '@oxc-transform/binding-win32-arm64-msvc': 0.137.0 - '@oxc-transform/binding-win32-ia32-msvc': 0.137.0 - '@oxc-transform/binding-win32-x64-msvc': 0.137.0 + '@oxc-transform/binding-android-arm-eabi': 0.138.0 + '@oxc-transform/binding-android-arm64': 0.138.0 + '@oxc-transform/binding-darwin-arm64': 0.138.0 + '@oxc-transform/binding-darwin-x64': 0.138.0 + '@oxc-transform/binding-freebsd-x64': 0.138.0 + '@oxc-transform/binding-linux-arm-gnueabihf': 0.138.0 + '@oxc-transform/binding-linux-arm-musleabihf': 0.138.0 + '@oxc-transform/binding-linux-arm64-gnu': 0.138.0 + '@oxc-transform/binding-linux-arm64-musl': 0.138.0 + '@oxc-transform/binding-linux-ppc64-gnu': 0.138.0 + '@oxc-transform/binding-linux-riscv64-gnu': 0.138.0 + '@oxc-transform/binding-linux-riscv64-musl': 0.138.0 + '@oxc-transform/binding-linux-s390x-gnu': 0.138.0 + '@oxc-transform/binding-linux-x64-gnu': 0.138.0 + '@oxc-transform/binding-linux-x64-musl': 0.138.0 + '@oxc-transform/binding-openharmony-arm64': 0.138.0 + '@oxc-transform/binding-wasm32-wasi': 0.138.0 + '@oxc-transform/binding-win32-arm64-msvc': 0.138.0 + '@oxc-transform/binding-win32-ia32-msvc': 0.138.0 + '@oxc-transform/binding-win32-x64-msvc': 0.138.0 oxfmt@0.56.0: dependencies: