aboutsummaryrefslogtreecommitdiff
path: root/src/js_parser/js_parser.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-06-02 16:39:40 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-06-02 16:39:40 -0700
commitda0bb118dc130c42606aa2688298d14060fc4354 (patch)
tree42a0cde898867175ed41339db2bb3c2d79d43709 /src/js_parser/js_parser.zig
parentddd5ed1cc2e64f151864bd977cedcefa6929fb74 (diff)
downloadbun-da0bb118dc130c42606aa2688298d14060fc4354.tar.gz
bun-da0bb118dc130c42606aa2688298d14060fc4354.tar.zst
bun-da0bb118dc130c42606aa2688298d14060fc4354.zip
HTTP fixes + buffer stdout/in + a little HTTP caching
Former-commit-id: d49df1df573c40fbfa56c475098cc0da789aeffa
Diffstat (limited to 'src/js_parser/js_parser.zig')
-rw-r--r--src/js_parser/js_parser.zig10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/js_parser/js_parser.zig b/src/js_parser/js_parser.zig
index fcf3450e1..e69c55ea3 100644
--- a/src/js_parser/js_parser.zig
+++ b/src/js_parser/js_parser.zig
@@ -9838,10 +9838,12 @@ pub const P = struct {
}
if (p.options.jsx.development) {
- // If we leave it as false, we get a warning about not providing a key
- // It calls Object.freeze on the array though
- // Which is wasteful! Object.freeze is slow.
- args[3] = Expr{ .loc = expr.loc, .data = .{ .e_boolean = .{ .value = e_.children.len == 0 } } };
+ // is the return type of the first child an array?
+ // It's dynamic
+ // Else, it's static
+ args[3] = Expr{ .loc = expr.loc, .data = .{ .e_boolean = .{
+ .value = e_.children.len == 0 or e_.children.len > 1 or std.meta.activeTag(e_.children[0].data) != .e_array,
+ } } };
var source = p.allocator.alloc(G.Property, 2) catch unreachable;
p.recordUsage(p.jsx_filename_ref);