mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 11:42:17 +00:00
Found while reading the rebase's recordings; none of these were recorded before, and the pre-rebase reference behaves the same except where noted. - Callback sites (array methods, sort, then/catch/finally, replace and replaceAll, JSON.parse's reviver and JSON.stringify's replacer) admit what the reference's isSupportedCallback does: not the Promise statics or Symbol (marked NOT_CALLBACK), nor a namespace reference, each refused with the site's wording. The hint now says (value) => fn(value), as on dev. - Symbol says it isn't callable, and new Symbol() asks for a call. - Array.prototype methods on a receiver that isn't an array name themselves and what they got. - JSON.parse fails with its host runtime's message after the reference's prefix, from the parser Response.json already used. - Assigning to a namespace says only data fields may be assigned; a namespace is described as a namespace reference, and the un-awaited promise hint names load(...), as on dev. Recorded: std-callback-admission, std-json-parse-errors and std-array-receivers.
17 lines
797 B
JavaScript
17 lines
797 B
JavaScript
// Array.prototype methods called on what is not an array name themselves and what they got.
|
|
const names = ["at", "concat", "copyWithin", "entries", "every", "fill", "filter", "find", "findIndex", "findLast",
|
|
"findLastIndex", "flat", "flatMap", "forEach", "includes", "indexOf", "join", "keys", "lastIndexOf", "map", "pop", "push",
|
|
"reduce", "reduceRight", "reverse", "shift", "slice", "some", "sort", "splice", "toLocaleString", "toReversed",
|
|
"toSorted", "toSpliced", "toString", "unshift", "values", "with"]
|
|
const out = []
|
|
for (const n of names) {
|
|
for (const t of [1, "ab", { length: 2, 0: "x", 1: "y" }, null, undefined]) {
|
|
try {
|
|
Array.prototype[n].call(t, (x) => x, 0)
|
|
out.push([n, "ok"])
|
|
} catch (e) {
|
|
out.push([n, e.name, e.message])
|
|
}
|
|
}
|
|
}
|
|
return out
|