Files
ladybird/Tests/LibJS/Bytecode/input/chained-member-call.js
Andreas Kling 4724b08a26 LibJS: Make MemberExpression::to_string_approximation() recursive
Previously, the function only handled a single level of member access,
producing strings like "<object>.isWall" for chained expressions like
"graphSet[j][k].isWall". Now it recurses through nested member
expressions, identifiers, string/numeric literals, and `this`.
2026-02-15 23:21:46 +01:00

18 lines
363 B
JavaScript

// Test that chained member access produces readable expression strings
// in Call instructions (e.g., "a[b][c].foo" not "<object>.foo").
function chained_computed_call(a, j, k) {
return a[j][k].foo();
}
function chained_dot_call(a) {
return a.b.c.bar();
}
try {
chained_computed_call(0, 0, 0);
} catch {}
try {
chained_dot_call(0);
} catch {}