Files
ladybird/Tests/LibJS/Bytecode/input/computed-string-to-ById.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

21 lines
448 B
JavaScript

// Test that computed member access with string literal keys is optimized
// to GetById/PutNormalById, while array index strings stay as GetByValue.
function get_string_prop(o) {
return o["hello"];
}
function set_string_prop(o) {
o["hello"] = 42;
}
function get_index_prop(o) {
return o["0"];
}
function get_length_prop(o) {
return o["length"];
}
get_string_prop({});
set_string_prop({});
get_index_prop([]);
get_length_prop([]);