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.