mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
Created these while experimenting with LibJS. Might as well bring them into the tree and increase our coverage.
18 lines
406 B
JavaScript
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");
|