Files
sausage/userland/qjs/source/tests/callsite-native-position.js
T
surma d44f1d9677 Build separate native and WASI pipelines with shared multicall names
Checkpoint before integration and package validation.

Assisted-by: SurmAgent:unknown [read] [edit] [bash]
2026-11-12 09:36:27 +00:00

20 lines
757 B
JavaScript

import { assert } from "./assert.js";
/* CallSite position getters return null for frames with no source position
(native frames), matching V8, instead of leaking the internal -1. */
Error.prepareStackTrace = (_, frames) => frames;
const frames = [1].map(function m() { return new Error().stack; })[0];
Error.prepareStackTrace = undefined;
const native = frames.find((f) => f.isNative());
assert(native !== undefined, true);
assert(native.getLineNumber(), null);
assert(native.getColumnNumber(), null);
assert(native.getFileName(), null);
/* frames with a real position still report numbers */
const scripted = frames.find((f) => !f.isNative());
assert(typeof scripted.getLineNumber(), "number");
assert(typeof scripted.getColumnNumber(), "number");