Skip to content

getLineNumber does not treat U+2028 and U+2029 as line terminators outside eval #1123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
WWRS opened this issue Apr 29, 2025 · 0 comments
Open

Comments

@WWRS
Copy link

WWRS commented Apr 29, 2025

Version: Deno 2.2.11
OS: Win11

Note: When running these examples, replace [\u2028] with the proper unicode character.

Issue

const foo=1[\u2028]

throw new Error("bar")

produces

error: Uncaught (in promise) Error: bar
const foo=1
throw new Error("bar")
                  ^
    at file:///tmp/main.ts:1:19

with location 1:19.

Expected

It should match ECMAScript's specs, which denotes U+2028 and U+2029 as line terminators.

Node reports location 2:7 as well.

Works in eval

Both of these:

eval(`const foo=1[\u2028]



throw new Error("bar")`)
eval(`const foo=1\u2028


throw new Error("bar")`)

produce

error: Uncaught (in promise) Error: bar
eval(`const foo=1
throw new Error("bar")`)
^
    at eval (eval at <anonymous> (file:///tmp/main.ts:1:1), <anonymous>:2:7)
    at file:///tmp/main.ts:1:1

with line number 2:7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant