diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2022-03-06 13:04:11 +0330 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-03-06 13:20:41 +0100 |
commit | c4d937747751d59ca3a5a1c04f608a0ccb2ee9b0 (patch) | |
tree | 97357a60cc6dda0cd6ba52d837ec47138770619c /Userland/Shell | |
parent | d7d847c8c6057aa2a4ab33b894692e74bb46a621 (diff) | |
download | serenity-c4d937747751d59ca3a5a1c04f608a0ccb2ee9b0.zip |
Shell: Implement leftmost_trivial_literal() for Sequence nodes
Diffstat (limited to 'Userland/Shell')
-rw-r--r-- | Userland/Shell/AST.cpp | 9 | ||||
-rw-r--r-- | Userland/Shell/AST.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Shell/AST.cpp b/Userland/Shell/AST.cpp index ef79901c67..f069b2c5a7 100644 --- a/Userland/Shell/AST.cpp +++ b/Userland/Shell/AST.cpp @@ -2736,6 +2736,15 @@ HitTestResult Sequence::hit_test_position(size_t offset) const return {}; } +RefPtr<Node> Sequence::leftmost_trivial_literal() const +{ + for (auto& entry : m_entries) { + if (auto node = entry.leftmost_trivial_literal()) + return node; + } + return nullptr; +} + Sequence::Sequence(Position position, NonnullRefPtrVector<Node> entries, Vector<Position> separator_positions) : Node(move(position)) , m_entries(move(entries)) diff --git a/Userland/Shell/AST.h b/Userland/Shell/AST.h index e9c25ead06..eea365db0a 100644 --- a/Userland/Shell/AST.h +++ b/Userland/Shell/AST.h @@ -1183,6 +1183,7 @@ private: virtual HitTestResult hit_test_position(size_t) const override; virtual bool is_list() const override { return true; } virtual bool should_override_execution_in_current_process() const override { return true; } + virtual RefPtr<Node> leftmost_trivial_literal() const override; NonnullRefPtrVector<Node> m_entries; Vector<Position> m_separator_positions; |