mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-21 05:50:55 +08:00
* 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
20 lines
431 B
JavaScript
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]());
|