Some checks failed
ci / fast (linux) (push) Failing after 13m32s
Implements full class support: prototype-chain-based inheritance on JsObject, class/extends/super/static/instanceof keywords, parser and VM execution for class declarations and expressions, super() constructor calls and super.method() dispatch via dedicated SuperInfo fields (not user-observable properties), and instanceof operator with prototype chain walking. Includes depth guards, Box<JsValue> in RuntimeError::Thrown to satisfy clippy result_large_err, and 11 JS262 conformance tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
17 lines
331 B
JavaScript
17 lines
331 B
JavaScript
// Classes without explicit constructor still work.
|
|
class Base {
|
|
greet() { return 'hello'; }
|
|
}
|
|
|
|
// Derived class without constructor forwards args to parent.
|
|
class Parent {
|
|
constructor(x) { this.x = x; }
|
|
}
|
|
class Child extends Parent {}
|
|
|
|
var b = new Base();
|
|
console.log(b.greet());
|
|
|
|
var c = new Child(42);
|
|
console.log(c.x);
|