diff options
Diffstat (limited to 'chromium/v8/src/torque/source-positions.h')
-rw-r--r-- | chromium/v8/src/torque/source-positions.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/chromium/v8/src/torque/source-positions.h b/chromium/v8/src/torque/source-positions.h index 857efa22261..f953417fd34 100644 --- a/chromium/v8/src/torque/source-positions.h +++ b/chromium/v8/src/torque/source-positions.h @@ -30,16 +30,27 @@ class SourceId { }; struct LineAndColumn { + static constexpr int kUnknownOffset = -1; + + int offset; int line; int column; - static LineAndColumn Invalid() { return {-1, -1}; } + static LineAndColumn Invalid() { return {-1, -1, -1}; } + static LineAndColumn WithUnknownOffset(int line, int column) { + return {kUnknownOffset, line, column}; + } bool operator==(const LineAndColumn& other) const { - return line == other.line && column == other.column; + if (offset == kUnknownOffset || other.offset == kUnknownOffset) { + return line == other.line && column == other.column; + } + DCHECK_EQ(offset == other.offset, + line == other.line && column == other.column); + return offset == other.offset; } bool operator!=(const LineAndColumn& other) const { - return !(*this == other); + return !operator==(other); } }; |