From ec9f4a4f74e6a2b0492afa369dfad6e1df17f7af Mon Sep 17 00:00:00 2001 From: chloe caruso Date: Fri, 10 Jan 2025 20:13:05 -0800 Subject: [PATCH 1/2] a --- src/codegen/bindgen-lib-internal.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/codegen/bindgen-lib-internal.ts b/src/codegen/bindgen-lib-internal.ts index 7c4ee555fa49c2..4fba7ad357a1a4 100644 --- a/src/codegen/bindgen-lib-internal.ts +++ b/src/codegen/bindgen-lib-internal.ts @@ -886,7 +886,9 @@ function snapshotCallerLocation(): string { } function stackTraceFileName(line: string): string { - return / \(((?:[A-Za-z]:)?.*?)[:)]/.exec(line)![1].replaceAll("\\", "/"); + const match = /(?:at\s+|\()((?:.|[a-z]:)[^:\n(\)]*)[^(]*$/i.exec(line); + assert(match, `Couldn't extract filename from stack trace line: ${line}`); + return match[1].replaceAll("\\", "/"); } export type CAbiType = From 17783cbf6c957d03388f8109015a4582197662ee Mon Sep 17 00:00:00 2001 From: chloe caruso Date: Fri, 10 Jan 2025 20:22:42 -0800 Subject: [PATCH 2/2] shorter --- src/codegen/bindgen-lib-internal.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/codegen/bindgen-lib-internal.ts b/src/codegen/bindgen-lib-internal.ts index 4fba7ad357a1a4..f969c30fd11954 100644 --- a/src/codegen/bindgen-lib-internal.ts +++ b/src/codegen/bindgen-lib-internal.ts @@ -886,7 +886,7 @@ function snapshotCallerLocation(): string { } function stackTraceFileName(line: string): string { - const match = /(?:at\s+|\()((?:.|[a-z]:)[^:\n(\)]*)[^(]*$/i.exec(line); + const match = /(?:at\s+|\()(.:?[^:\n(\)]*)[^(\n]*$/i.exec(line); assert(match, `Couldn't extract filename from stack trace line: ${line}`); return match[1].replaceAll("\\", "/"); }