diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-07-11 01:16:17 +0430 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-07-11 21:41:54 +0100 |
commit | 1a9518ebe313f10091da92e73de76b4ab2f2d875 (patch) | |
tree | 0bcf7429be2941e314df5209f5ed8f7983f328fb /Userland/Libraries/LibJS/SourceRange.h | |
parent | 7fc6cd6b20ea0f9252c733de5c3249605a3bd130 (diff) | |
download | serenity-1a9518ebe313f10091da92e73de76b4ab2f2d875.zip |
LibJS: Implement parsing and evaluation for AssignmentPatterns
e.g. `[...foo] = bar` can now be evaluated :^)
Diffstat (limited to 'Userland/Libraries/LibJS/SourceRange.h')
-rw-r--r-- | Userland/Libraries/LibJS/SourceRange.h | 3 |
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; |