diff options
author | 2021-09-25 00:33:45 -0700 | |
---|---|---|
committer | 2021-09-25 00:33:45 -0700 | |
commit | 66b29654c09f42807faeef859d4cea1f29520013 (patch) | |
tree | 980fd32c73204083a0d2645685d1acaed625a763 | |
parent | 940570af5904b35784e24f7ea35ccc1fa1f260e7 (diff) | |
download | bun-66b29654c09f42807faeef859d4cea1f29520013.tar.gz bun-66b29654c09f42807faeef859d4cea1f29520013.tar.zst bun-66b29654c09f42807faeef859d4cea1f29520013.zip |
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.
Diffstat (limited to '')
-rw-r--r-- | src/js_parser/js_parser.zig | 14 |
1 files changed, 4 insertions, 10 deletions
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); |