Skip to content

Default source to "<anonymous>" in PrepareScript/PrepareModule#2379

Merged
lahma merged 1 commit intosebastienros:mainfrom
lahma:fix/prepared-script-breakpoints
Apr 3, 2026
Merged

Default source to "<anonymous>" in PrepareScript/PrepareModule#2379
lahma merged 1 commit intosebastienros:mainfrom
lahma:fix/prepared-script-breakpoints

Conversation

@lahma
Copy link
Copy Markdown
Collaborator

@lahma lahma commented Apr 3, 2026

Summary

  • PrepareScript and PrepareModule passed null source through to the parser as-is, while Evaluate/Execute defaulted null source to "<anonymous>". This inconsistency meant AST nodes from prepared scripts had Location.SourceFile == null instead of "<anonymous>", causing breakpoint matching issues when debugging tools use the source identifier.
  • Added three test cases verifying breakpoints work correctly with prepared scripts (positional, source-specific, and default source).

Fixes #2378

Test plan

  • Existing breakpoint tests pass (18 passed, 1 skipped)
  • New BreakPointBreaksAtPositionWithPreparedScript - breakpoint without source on prepared script
  • New BreakPointBreaksInCorrectSourceWithPreparedScript - source-specific breakpoint across multiple prepared scripts
  • New BreakPointBreaksWithPreparedScriptDefaultSource - breakpoint on "<anonymous>" with PrepareScript(code) (no source)

🤖 Generated with Claude Code

@lahma lahma enabled auto-merge (squash) April 3, 2026 10:45
PrepareScript and PrepareModule passed null source through to the parser
as-is, while Evaluate/Execute defaulted null source to "<anonymous>".
This inconsistency meant nodes from prepared scripts had
Location.SourceFile == null instead of "<anonymous>", causing breakpoint
matching issues when debugging tools used the source identifier.

Fixes sebastienros#2378

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lahma lahma force-pushed the fix/prepared-script-breakpoints branch from 83b4045 to 31681a1 Compare April 3, 2026 10:51
@lahma lahma merged commit 7b41ac0 into sebastienros:main Apr 3, 2026
4 checks passed
@lahma lahma deleted the fix/prepared-script-breakpoints branch April 3, 2026 11:13
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

Successfully merging this pull request may close these issues.

Breakpoints not hitting when executing pre-prepared scripts in Jint 4.7.0

1 participant