mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
* fix(compiler): unblock self-hosting analysis and tuple construction - Bound type diagnostics to handle deeply nested and shared compiler types. - Compile fixed tuple spreads and preserve const tuple inference under satisfies. - Add native compiler-component and differential regression coverage. * fix(tests): record tuple spread frontend parity baseline - Record module order and preflight diagnostics for the new tuple spread regression fixture.
16 lines
706 B
TypeScript
16 lines
706 B
TypeScript
import { SourceLocations } from "../../../packages/compiler/src/backend/source-locations.js";
|
|
|
|
// Exercise the real compiler module, including every offset around each
|
|
// newline form, astral characters, empty files, and failed lookups.
|
|
const text = "one\r\ntwo\rthree\nfour\u2028five\u2029😀six\n";
|
|
const sources = new Map<string, string>();
|
|
sources.set("main.ts", text);
|
|
sources.set("empty.ts", "");
|
|
sources.set("other.ts", "other");
|
|
const locations = new SourceLocations(sources);
|
|
for (const file of ["main.ts", "empty.ts", "other.ts", "missing.ts"]) {
|
|
for (let start = -1; start <= text.length + 1; start++) {
|
|
console.log(JSON.stringify(locations.position({ file, start, end: start })));
|
|
}
|
|
}
|