1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-24 01:05:08 +00:00

Shell: Search for variables in the last frame first

Otherwise, we'll end up overwriting another frame's variables if the
names match up.
This commit is contained in:
AnotherTest 2020-11-01 13:28:58 +03:30 committed by Andreas Kling
parent bedad383b5
commit e87e580eb3

View file

@ -359,7 +359,8 @@ String Shell::resolve_path(String path) const
Shell::LocalFrame* Shell::find_frame_containing_local_variable(const String& name)
{
for (auto& frame : m_local_frames) {
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;
}