[tools] Fix script source position clobbering

Change-Id: Ic917bf0e6a3d5f6624f77c72cb9d16626d6508fa
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3145418
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Patrick Thier <pthier@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76717}
This commit is contained in:
Leszek Swirski 2021-09-07 18:21:12 +02:00 committed by V8 LUCI CQ
parent 0b28f2602e
commit 398f0314b3

View File

@ -116,8 +116,9 @@ export class Script {
sourcePosition = new SourcePosition(this, line, column,)
this._addSourcePosition(line, column, sourcePosition);
}
if (entry.entry?.type == "Script") {
// Mark the source position of scripts, for inline scripts which
if (this.sourcePosition === undefined && entry.entry?.type === "Script") {
// Mark the source position of scripts, for inline scripts which don't
// start at line 1.
this.sourcePosition = sourcePosition;
}
sourcePosition.addEntry(entry);