From 1a9518ebe313f10091da92e73de76b4ab2f2d875 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Sun, 11 Jul 2021 01:16:17 +0430 Subject: LibJS: Implement parsing and evaluation for AssignmentPatterns e.g. `[...foo] = bar` can now be evaluated :^) --- Userland/Libraries/LibJS/SourceRange.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Userland/Libraries/LibJS/SourceRange.h') 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; -- cgit v1.2.3