Files
scriptc/tests/corpus/js-implicit-call-results.js
Chris Tate a07998f667 Expand static three.js workflows and host integration (#621)
* 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
2026-10-02 19:56:34 -05:00

27 lines
995 B
JavaScript

const nodeObject = (value, type = null) => value;
const Make = function (NodeClass, settings = null) {
function assignNode(node) {
if (settings !== null) node = nodeObject(Object.assign(node, settings));
else node = nodeObject(node);
return node;
}
return (...values) => assignNode(new NodeClass(...values));
};
class Value {
constructor(value) { this.value = value; }
}
const make = new Make(Value, { intent: true });
const first = make(4);
console.log(first.value, first.intent, first instanceof Value);
const owner = { get() { return first; } };
console.log(nodeObject(owner.get()) === first);
function lineCount(stack) { return stack.split("\n").length; }
class Trace {
/** @param {Error|string|null} message */
constructor(message = null) {
this.lines = lineCount(message ? message : new Error().stack);
}
}
console.log(new Trace().lines > 0, new Trace("first\nsecond").lines);
try { new Trace(new Error("input")); } catch (error) { console.log(error.name); }