diff options
author | 2023-05-20 19:41:12 -0700 | |
---|---|---|
committer | 2023-05-20 22:02:09 -0700 | |
commit | ff4df6b6001ac7fd30103b469d0a076021f533c2 (patch) | |
tree | 32638d3a5c6893a0e5f0c1b0755ade5c676deec2 /src/bun.js/scripts/generate-classes.ts | |
parent | 0e97f91f9f4ba1b7a1a24dd33c568a159c755850 (diff) | |
download | bun-ff4df6b6001ac7fd30103b469d0a076021f533c2.tar.gz bun-ff4df6b6001ac7fd30103b469d0a076021f533c2.tar.zst bun-ff4df6b6001ac7fd30103b469d0a076021f533c2.zip |
[internal] Show the file path to the calling function from JS
Diffstat (limited to 'src/bun.js/scripts/generate-classes.ts')
-rw-r--r-- | src/bun.js/scripts/generate-classes.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/bun.js/scripts/generate-classes.ts b/src/bun.js/scripts/generate-classes.ts index e8c4eeaa9..ff6954753 100644 --- a/src/bun.js/scripts/generate-classes.ts +++ b/src/bun.js/scripts/generate-classes.ts @@ -818,6 +818,17 @@ JSC_DEFINE_CUSTOM_SETTER(${symbolName( JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + #ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } + #endif + return ${symbolName(typeName, proto[name].fn)}(thisObject->wrapped(), lexicalGlobalObject, callFrame); } `); |