diff options
author | Andreas Kling <kling@serenityos.org> | 2023-03-06 17:16:25 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-03-06 23:46:35 +0100 |
commit | 359d6e7b0b0ef7add9eb2015d0dd664a82cf73d7 (patch) | |
tree | be51963e0f0dc7e1eeeb670188c8fe1fa5eea37f /Userland/Shell | |
parent | 689ca370d4eca80eb5c3856a69c3eed4ed848a29 (diff) | |
download | serenity-359d6e7b0b0ef7add9eb2015d0dd664a82cf73d7.zip |
Everywhere: Stop using NonnullOwnPtrVector
Same as NonnullRefPtrVector: weird semantics, questionable benefits.
Diffstat (limited to 'Userland/Shell')
-rw-r--r-- | Userland/Shell/Shell.cpp | 16 | ||||
-rw-r--r-- | Userland/Shell/Shell.h | 6 |
2 files changed, 11 insertions, 11 deletions
diff --git a/Userland/Shell/Shell.cpp b/Userland/Shell/Shell.cpp index 03d1bfb08a..42a02cd58d 100644 --- a/Userland/Shell/Shell.cpp +++ b/Userland/Shell/Shell.cpp @@ -346,8 +346,8 @@ Shell::LocalFrame* Shell::find_frame_containing_local_variable(StringView name) { for (size_t i = m_local_frames.size(); i > 0; --i) { auto& frame = m_local_frames[i - 1]; - if (frame.local_variables.contains(name)) - return &frame; + if (frame->local_variables.contains(name)) + return frame; } return nullptr; } @@ -407,7 +407,7 @@ void Shell::set_local_variable(DeprecatedString const& name, RefPtr<AST::Value> } } - m_local_frames.last().local_variables.set(name, move(value)); + m_local_frames.last()->local_variables.set(name, move(value)); } void Shell::unset_local_variable(StringView name, bool only_in_current_frame) @@ -418,7 +418,7 @@ void Shell::unset_local_variable(StringView name, bool only_in_current_frame) return; } - m_local_frames.last().local_variables.remove(name); + m_local_frames.last()->local_variables.remove(name); } void Shell::define_function(DeprecatedString name, Vector<DeprecatedString> argnames, RefPtr<AST::Node> body) @@ -491,7 +491,7 @@ Shell::Frame Shell::push_frame(DeprecatedString name) { m_local_frames.append(make<LocalFrame>(name, decltype(LocalFrame::local_variables) {})); dbgln_if(SH_DEBUG, "New frame '{}' at {:p}", name, &m_local_frames.last()); - return { m_local_frames, m_local_frames.last() }; + return { m_local_frames, *m_local_frames.last() }; } void Shell::pop_frame() @@ -504,11 +504,11 @@ Shell::Frame::~Frame() { if (!should_destroy_frame) return; - if (&frames.last() != &frame) { + if (frames.last() != &frame) { dbgln("Frame destruction order violation near {:p} (container = {:p}) in '{}'", &frame, this, frame.name); dbgln("Current frames:"); for (auto& frame : frames) - dbgln("- {:p}: {}", &frame, frame.name); + dbgln("- {:p}: {}", &frame, frame->name); VERIFY_NOT_REACHED(); } (void)frames.take_last(); @@ -1607,7 +1607,7 @@ Vector<Line::CompletionSuggestion> Shell::complete_variable(StringView name, siz // Look at local variables. for (auto& frame : m_local_frames) { - for (auto& variable : frame.local_variables) { + for (auto& variable : frame->local_variables) { if (variable.key.starts_with(pattern) && !suggestions.contains_slow(variable.key)) suggestions.append(variable.key); } diff --git a/Userland/Shell/Shell.h b/Userland/Shell/Shell.h index bb4b05bf0e..be20866c60 100644 --- a/Userland/Shell/Shell.h +++ b/Userland/Shell/Shell.h @@ -197,7 +197,7 @@ public: }; struct Frame { - Frame(NonnullOwnPtrVector<LocalFrame>& frames, LocalFrame const& frame) + Frame(Vector<NonnullOwnPtr<LocalFrame>>& frames, LocalFrame const& frame) : frames(frames) , frame(frame) { @@ -207,7 +207,7 @@ public: void leak_frame() { should_destroy_frame = false; } private: - NonnullOwnPtrVector<LocalFrame>& frames; + Vector<NonnullOwnPtr<LocalFrame>>& frames; LocalFrame const& frame; bool should_destroy_frame { true }; }; @@ -458,7 +458,7 @@ private: }; HashMap<DeprecatedString, ShellFunction> m_functions; - NonnullOwnPtrVector<LocalFrame> m_local_frames; + Vector<NonnullOwnPtr<LocalFrame>> m_local_frames; Promise::List m_active_promises; Vector<NonnullRefPtr<AST::Redirection>> m_global_redirections; |