[Webkit-unassigned] [Bug 275145] New: Incorrect source location for TDZ error in modules when thrown before other statements

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jun 5 01:33:41 PDT 2024


https://bugs.webkit.org/show_bug.cgi?id=275145

            Bug ID: 275145
           Summary: Incorrect source location for TDZ error in modules
                    when thrown before other statements
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: jarred at jarredsumner.com

For the following input code:
```
// A statement which doesn't declare any variables
Intl;








const a = a;
```

When running `jsc` (correct, not a module):

```
jsc error.js

Exception: ReferenceError: Cannot access uninitialized variable.
global code at error.js:11:12
```

When running `jsc -m` (incorrect, is a module):

```
jsc -m error.js

Exception: ReferenceError: Cannot access uninitialized variable.
module code at error.js:2:5
```

It's pointing to the first statement in the function body instead of the location where it happened. 

Relevant issue: https://github.com/oven-sh/bun/issues/6824

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240605/f2857f80/attachment.htm>


More information about the webkit-unassigned mailing list