mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-26 06:34:20 +08:00
- Support published three.js rotations, bounds, ray intersections, culling, and vertex attributes on native and WASM targets without a JavaScript engine. - Preserve JavaScript class defaults, data descriptors, and captured loop bindings in static code. - Handle typed-array input unions and constructor identities while keeping unsupported method overrides explicit.
12 lines
455 B
JavaScript
12 lines
455 B
JavaScript
class Shape {
|
|
constructor(size = 1) { this.size = size; }
|
|
copy(source, recursive = true) { return source.size + (recursive ? 1 : 0); }
|
|
area() { return this.size * this.size; }
|
|
}
|
|
class ColoredShape extends Shape {
|
|
constructor(size = 1) { super(size); this.color = 'red'; }
|
|
copy(source, recursive) { return source.size + (recursive ? 1 : 0); }
|
|
}
|
|
const shape = new ColoredShape(3);
|
|
console.log(shape.area(), shape.color, new Shape(2).copy(shape));
|