Skip to content

stacktrace is affected by an eval statement just existing later in the script #20993

@jbsiddall

Description

@jbsiddall

run this code:

(function hello() {
  console.log('outer stack', new Error().stack)
})();

eval("")

Expected Output:

outer stack Error
    at hello (file:///....ts:2:30)
    at file:///....ts:3:2

Actual Output:

outer stack Error
    at hello1 (file:///....ts:2:30)
    at file:///....ts:3:2

stacktrace should have function "hello" but instead has "hello1".

If you remove the eval statement, then the stack trace becomes the expected output.
Deno Version:

$ deno --version
deno 1.37.1 (release, x86_64-apple-darwin)
v8 11.8.172.6
typescript 5.2.2

Me reproducing the issue in a deno terminal:

demo.mov

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working correctlyswcrelated to swc (bundling/transpiling)upstreamChanges in upstream are required to solve these issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions