mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
- Compile Unicode code-point construction, scalar iterable inputs, and primitive Buffer predicates without a JavaScript engine. - Preserve object identity and property additions or deletions in inferred JavaScript locals. - Recover nullable class fields initialized through static factories in bundled packages.
52 lines
1.3 KiB
JavaScript
52 lines
1.3 KiB
JavaScript
class Base2 {
|
|
onLifecyclePass = null;
|
|
constructor() { console.log("base callback", this.onLifecyclePass === null); }
|
|
runLifecycle() { this.onLifecyclePass?.(); }
|
|
resetLifecycle() { this.onLifecyclePass = null; }
|
|
getSelectedText() { return ""; }
|
|
selected() { return this.getSelectedText(); }
|
|
}
|
|
class Middle2 extends Base2 {}
|
|
class View2 extends Middle2 {
|
|
value;
|
|
onLifecyclePass = () => { console.log("lifecycle", this.value); };
|
|
constructor(value) {
|
|
super();
|
|
this.value = value;
|
|
this.parent = null;
|
|
}
|
|
getSelectedText() { return this.value; }
|
|
label(value) {
|
|
if (value === undefined) return this.value;
|
|
this.value = value;
|
|
return this;
|
|
}
|
|
}
|
|
class Metrics2 {
|
|
countValue;
|
|
activeValue;
|
|
constructor(count, active) {
|
|
this.countValue = count;
|
|
this.activeValue = active;
|
|
}
|
|
count() { return this.countValue; }
|
|
active() { return this.activeValue; }
|
|
}
|
|
class ParserBase2 {
|
|
value = "";
|
|
push(value) { this.value += value; }
|
|
read() { return this.value; }
|
|
reset() { this.value = ""; }
|
|
kind() { return "base"; }
|
|
describe() { return this.kind() + ":" + this.value; }
|
|
}
|
|
class Parser2 extends ParserBase2 {
|
|
static create(value = "") {
|
|
const parser = new Parser2();
|
|
parser.push(value);
|
|
return parser;
|
|
}
|
|
kind() { return "parser"; }
|
|
}
|
|
export { Base2, View2, Metrics2, Parser2 };
|