mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-02 08:35:07 +08:00
Clarify conversion contracts and tidy fixtures
This commit is contained in:
@@ -6367,9 +6367,9 @@ export function canConvertToDyn(
|
||||
/** The composite extension of the dynFrom domain: JSON-safe scalars plus
|
||||
* numeric typed arrays and boxable functions anywhere, recursing through records
|
||||
* (fields + index value), arrays, and unit-armed unions — exactly the
|
||||
* sc_td_* walker's capability. Returns false for a composite carrying a
|
||||
* kind the walker cannot box (Maps or handles nested in a record); those
|
||||
* still fence. */
|
||||
* sc_td_* walker's capability. Map and Set payloads must also support
|
||||
* checked extraction back into native storage. Other unsupported nested
|
||||
* kinds retain their conversion fence. */
|
||||
function canBoxDynComposite(
|
||||
t: IrType,
|
||||
getRecord: (shapeId: string) => IrRecordShape | undefined,
|
||||
|
||||
@@ -4,4 +4,3 @@ function assign(index: any, value: any): any {
|
||||
}
|
||||
console.log(assign(0, 42), values[0]);
|
||||
console.log(assign("1", "end"), JSON.stringify(values));
|
||||
|
||||
|
||||
@@ -6,4 +6,3 @@ console.log(answer);
|
||||
const pair: [any, any] = [answer, "done"];
|
||||
const [value, label] = pair;
|
||||
console.log(value, label);
|
||||
|
||||
|
||||
@@ -6,4 +6,3 @@ Object.assign(second, { toString() { return "second"; } });
|
||||
console.log(render(first), render(second));
|
||||
Object.assign(first, { toString() { return "changed"; } });
|
||||
console.log(render(first));
|
||||
|
||||
|
||||
@@ -8,4 +8,3 @@ class Value {
|
||||
function read(value = new Empty()) { return value.kind; }
|
||||
function invoke(fn, value) { return fn(value); }
|
||||
console.log(read(), invoke(read, new Value(42)), invoke(read, undefined));
|
||||
|
||||
|
||||
@@ -4,4 +4,3 @@ function entries(map) {
|
||||
for (const [key, value = 4] of map) console.log(key, value);
|
||||
}
|
||||
entries(new Map([["a", 1], ["b", 2]]));
|
||||
|
||||
|
||||
@@ -10,4 +10,3 @@ console.log(prototype(Object.prototype) === null, prototype(bare) === null);
|
||||
console.log(prototype([]) === Array.prototype);
|
||||
console.log(prototype(Array.prototype) === Object.prototype);
|
||||
console.log(prototype(child) === plain, child.value);
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
Promise.reject("bad").catch((reason: unknown) => console.log(reason));
|
||||
Promise.reject(42).catch((reason: unknown) => console.log(reason));
|
||||
Promise.reject(null).catch((reason: unknown) => console.log(reason));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user