summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/SourceRange.h
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibJS/SourceRange.h')
-rw-r--r--Userland/Libraries/LibJS/SourceRange.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/SourceRange.h b/Userland/Libraries/LibJS/SourceRange.h
index 936863ecc7..b92208dc32 100644
--- a/Userland/Libraries/LibJS/SourceRange.h
+++ b/Userland/Libraries/LibJS/SourceRange.h
@@ -13,9 +13,12 @@ namespace JS {
struct Position {
size_t line { 0 };
size_t column { 0 };
+ size_t offset { 0 };
};
struct SourceRange {
+ [[nodiscard]] bool contains(Position const& position) const { return position.offset <= end.offset && position.offset >= start.offset; }
+
StringView filename;
Position start;
Position end;