From 8a48246ed1a93983668a25f5b9b0af0e745e3f04 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 6 Mar 2023 14:17:01 +0100 Subject: Everywhere: Stop using NonnullRefPtrVector This class had slightly confusing semantics and the added weirdness doesn't seem worth it just so we can say "." instead of "->" when iterating over a vector of NNRPs. This patch replaces NonnullRefPtrVector with Vector>. --- Userland/Shell/AST.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'Userland/Shell/AST.h') diff --git a/Userland/Shell/AST.h b/Userland/Shell/AST.h index 0ae1d236b8..f70302ebb7 100644 --- a/Userland/Shell/AST.h +++ b/Userland/Shell/AST.h @@ -208,7 +208,7 @@ struct NodeWithAction { struct Command { Vector argv; - NonnullRefPtrVector redirections; + Vector> redirections; bool should_wait { true }; bool is_pipe_source { false }; bool should_notify_if_in_background { true }; @@ -233,7 +233,7 @@ public: virtual ErrorOr> resolve_without_cast(RefPtr) { return *this; } virtual ErrorOr> clone() const = 0; virtual ErrorOr> with_slices(NonnullRefPtr slice) const&; - virtual ErrorOr> with_slices(NonnullRefPtrVector slices) const&; + virtual ErrorOr> with_slices(Vector> slices) const&; virtual ~Value(); virtual bool is_command() const { return false; } virtual bool is_glob() const { return false; } @@ -243,12 +243,12 @@ public: virtual bool is_list_without_resolution() const { return false; } protected: - Value& set_slices(NonnullRefPtrVector slices) + Value& set_slices(Vector> slices) { m_slices = move(slices); return *this; } - NonnullRefPtrVector m_slices; + Vector> m_slices; }; class CommandValue final : public Value { @@ -316,16 +316,16 @@ public: virtual bool is_list() const override { return true; } virtual bool is_list_without_resolution() const override { return true; } ListValue(Vector values); - ListValue(NonnullRefPtrVector values) + ListValue(Vector> values) : m_contained_values(move(values)) { } - NonnullRefPtrVector const& values() const { return m_contained_values; } - NonnullRefPtrVector& values() { return m_contained_values; } + Vector> const& values() const { return m_contained_values; } + Vector>& values() { return m_contained_values; } private: - NonnullRefPtrVector m_contained_values; + Vector> m_contained_values; }; class StringValue final : public Value { @@ -629,11 +629,11 @@ private: class BraceExpansion final : public Node { public: - BraceExpansion(Position, NonnullRefPtrVector); + BraceExpansion(Position, Vector>); virtual ~BraceExpansion() = default; virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); } - NonnullRefPtrVector const& entries() const { return m_entries; } + Vector> const& entries() const { return m_entries; } private: NODE(BraceExpansion); @@ -642,7 +642,7 @@ private: virtual ErrorOr highlight_in_editor(Line::Editor&, Shell&, HighlightMetadata = {}) override; virtual HitTestResult hit_test_position(size_t) const override; - NonnullRefPtrVector m_entries; + Vector> m_entries; }; class CastToCommand final : public Node { @@ -1019,11 +1019,11 @@ private: class ImmediateExpression final : public Node { public: - ImmediateExpression(Position, NameWithPosition function, NonnullRefPtrVector arguments, Optional closing_brace_position); + ImmediateExpression(Position, NameWithPosition function, Vector> arguments, Optional closing_brace_position); virtual ~ImmediateExpression(); virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); } - NonnullRefPtrVector const& arguments() const { return m_arguments; } + Vector> const& arguments() const { return m_arguments; } auto const& function() const { return m_function; } String const& function_name() const { return m_function.name; } Position const& function_position() const { return m_function.position; } @@ -1037,7 +1037,7 @@ private: ErrorOr> complete_for_editor(Shell&, size_t, HitTestResult const&) const override; virtual HitTestResult hit_test_position(size_t) const override; - NonnullRefPtrVector m_arguments; + Vector> m_arguments; NameWithPosition m_function; Optional m_closing_brace_position; }; @@ -1066,7 +1066,7 @@ private: }; struct MatchEntry { - Variant, Vector>> options; + Variant>, Vector>> options; Optional> match_names; Optional match_as_position; Vector pipe_positions; @@ -1188,11 +1188,11 @@ private: class Sequence final : public Node { public: - Sequence(Position, NonnullRefPtrVector, Vector separator_positions); + Sequence(Position, Vector>, Vector separator_positions); virtual ~Sequence(); virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); } - NonnullRefPtrVector const& entries() const { return m_entries; } + Vector> const& entries() const { return m_entries; } Vector const& separator_positions() const { return m_separator_positions; } @@ -1206,7 +1206,7 @@ private: virtual bool should_override_execution_in_current_process() const override { return true; } virtual RefPtr leftmost_trivial_literal() const override; - NonnullRefPtrVector m_entries; + Vector> m_entries; Vector m_separator_positions; }; -- cgit v1.2.3