Files
ladybird/Tests/LibJS/Bytecode/input/computed-string-object-literal.js
Andreas Kling fdd7809bd1 Tests/LibJS: Add a big pile of AST, bytecode, and runtime tests
Created these while experimenting with LibJS. Might as well bring them
into the tree and increase our coverage.
2026-02-17 20:44:57 +01:00

18 lines
406 B
JavaScript

// Test that computed string keys in object literals like {["x"]: 1}
// are treated the same as non-computed keys like {x: 1}, using
// InitObjectLiteralProperty + CacheObjectShape instead of PutOwnByValue.
function simple_computed() {
return { ["x"]: 1 };
}
function mixed() {
return { ["a"]: 1, b: 2 };
}
function dynamic(k) {
return { [k]: 1 };
}
simple_computed();
mixed();
dynamic("x");