mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-29 04:34:38 +00:00
Shell: Do not flatten syntactic lists in for_each_entry()
This commit is contained in:
parent
0676bd4afc
commit
2c14abedd6
|
@ -87,6 +87,16 @@ void Node::for_each_entry(RefPtr<Shell> shell, Function<IterationDecision(RefPtr
|
|||
callback(value);
|
||||
return;
|
||||
}
|
||||
|
||||
if (value->is_list_without_resolution()) {
|
||||
auto list = value->resolve_without_cast(shell);
|
||||
for (auto& element : static_cast<ListValue*>(list.ptr())->values()) {
|
||||
if (callback(element) == IterationDecision::Break)
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
auto list = value->resolve_as_list(shell);
|
||||
for (auto& element : list) {
|
||||
if (callback(create<StringValue>(move(element))) == IterationDecision::Break)
|
||||
|
|
Loading…
Reference in a new issue