From 66b29654c09f42807faeef859d4cea1f29520013 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Sat, 25 Sep 2021 00:33:45 -0700 Subject: Fix visiting bug when using JSX with a spread prop and a key and one of the props is an anonymous function More specifically, Bun shouldn't be visiting the same properties more than once. That was the cause. --- src/js_parser/js_parser.zig | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/js_parser/js_parser.zig') diff --git a/src/js_parser/js_parser.zig b/src/js_parser/js_parser.zig index dcccea8a6..c4a619ab3 100644 --- a/src/js_parser/js_parser.zig +++ b/src/js_parser/js_parser.zig @@ -10980,6 +10980,10 @@ pub fn NewParser( } } + if (e_.key) |key| { + e_.key = p.visitExpr(key); + } + const runtime = if (p.options.jsx.runtime == .automatic and !e_.flags.is_key_before_rest) options.JSX.Runtime.automatic else options.JSX.Runtime.classic; var children_count = e_.children.len; @@ -11005,16 +11009,6 @@ pub fn NewParser( var i: usize = 1; args[0] = tag; if (e_.properties.len > 0) { - for (e_.properties) |prop, prop_i| { - if (prop.key) |key| { - e_.properties[prop_i].key = p.visitExpr(key); - } - - if (prop.value) |val| { - e_.properties[prop_i].value = p.visitExpr(val); - } - } - if (e_.key) |key| { var props = p.allocator.alloc(G.Property, e_.properties.len + 1) catch unreachable; std.mem.copy(G.Property, props, e_.properties); -- cgit v1.2.3