Skip to content

error.stack: report frames at new X(...) at the new keyword - #37396

Open
robobun wants to merge 7 commits into
mainfrom
farm/cee5f8f9/stack-column-new-keyword
Open

error.stack: report frames at new X(...) at the new keyword#37396
robobun wants to merge 7 commits into
mainfrom
farm/cee5f8f9/stack-column-new-keyword

error.stack: report frames at new X(...) at the new keyword

3be1fef
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Aug 11, 2026 in 24m 14s

Code review found 2 potential issues

Found 2 candidates, confirmed 2. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 2
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/jsc/bindings/ErrorStackFrame.cpp:41-46 Column recount drops provider startColumn (vm columnOffset) when 'new' lands on line 1
🟡 Nit src/jsc/bindings/ErrorStackFrame.cpp:36-43 adjustPositionBackwards only recognizes '\n', missing CR / U+2028 / U+2029

Annotations

Check warning on line 46 in src/jsc/bindings/ErrorStackFrame.cpp

See this annotation in the file changed.

@claude claude / Claude Code Review

Column recount drops provider startColumn (vm columnOffset) when 'new' lands on line 1

The slow-path column recount drops `provider->startPosition().m_column` (node:vm `columnOffset`) when `new` lands on the source's first physical line — e.g. `vm.runInContext('throw new\\nError("x")', ctx, {columnOffset:100})` reports `:1:7` where Node reports `:1:107`. The fast path preserves the offset by simple subtraction; the recount discards it. Fix: when the column loop exits at `i < 0` without finding a `'\n'`, add `provider->startPosition().m_column.zeroBasedInt()` to `column`.

Check warning on line 43 in src/jsc/bindings/ErrorStackFrame.cpp

See this annotation in the file changed.

@claude claude / Claude Code Review

adjustPositionBackwards only recognizes '\n', missing CR / U+2028 / U+2029

The line-decrement and column-recount loops only test `source[i] == '\n'`, but JSC's lexer counts all four ECMAScript LineTerminators (LF, CR, U+2028, U+2029) when computing `expr.lineColumn`. When `new` and its callee are separated by a lone CR, LS, or PS in untranspiled (eval / `node:vm`) code, the slow path leaves the line at the divot's line and walks the column past the terminator — reporting a position on the wrong line. Extremely exotic trigger and cosmetic failure, but since this rewrite