Files
scriptc/tests/corpus/class-bracket-method-calls.js
Chris Tate f8906d0b75 Expand static native object and array semantics (#569)
* Support primitive and function property descriptors

* Dispatch literal bracket calls to native class methods

* Handle numeric class method keys in bracket calls

* Call function values returned by class accessors

* Expand native object and array semantics

* Keep new corpus fixtures aligned with compiler gates

* Lower Object.isFrozen arguments once
2026-09-29 08:30:54 -05:00

20 lines
431 B
JavaScript

class Base {
value() { return 'base'; }
}
class Derived extends Base {
value() { return 'derived'; }
}
const base = new Base();
const derived = new Derived();
console.log(base['value'](), derived['value']());
let asBase = derived;
console.log(asBase['value']());
class Keyword {
w\u0069th() { return 42; }
}
console.log(new Keyword()['with']());
class Numeric {
[7]() { return 'seven'; }
}
console.log(new Numeric()[7]());