mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-21 05:50:55 +08:00
* Expand static three.js workflows and host integration * Preserve JavaScript class state in static three.js workflows * Preserve inferred JavaScript behavior across static workflows * Preserve inferred callables and native compatibility boundaries * Retain annotated JavaScript factory exports and bootstrap-safe call spreads * Preserve Buffer and child callback identities in static packages * Clarify JavaScript symbol spread support
33 lines
746 B
JavaScript
33 lines
746 B
JavaScript
class C {
|
|
constructor() {
|
|
this.foo = () => {
|
|
console.log("called arrow");
|
|
};
|
|
}
|
|
foo() {
|
|
console.log("called method");
|
|
}
|
|
}
|
|
|
|
class D extends C {
|
|
foo() {
|
|
console.log("SUPER:");
|
|
super.foo();
|
|
console.log("THIS:");
|
|
this.foo();
|
|
}
|
|
}
|
|
|
|
const obj = new D();
|
|
obj.foo();
|
|
D.prototype.foo.call(obj);
|
|
|
|
class NonCallable {
|
|
constructor() { this.m = 'not callable'; }
|
|
m() { console.log('unreached'); }
|
|
}
|
|
try { new NonCallable().m(); } catch (error) { console.log(error.name, error.message.includes('is not a function')); }
|
|
class Clean { foo() { return 4; } }
|
|
class Callable extends Clean { constructor() { super(); this.foo = () => 3; } }
|
|
console.log(new Callable().foo(), Clean.prototype.foo.call(new Callable()));
|