mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:47:44 +00:00
AK: Rename Vector::append(Vector) => Vector::extend(Vector)
Let's make it a bit more clear when we're appending the elements from one vector to the end of another vector.
This commit is contained in:
parent
7e1bffdeb8
commit
dc65f54c06
37 changed files with 103 additions and 104 deletions
|
@ -133,11 +133,11 @@ static inline Vector<Command> join_commands(Vector<Command> left, Vector<Command
|
|||
auto last_in_left = left.take_last();
|
||||
auto first_in_right = right.take_first();
|
||||
|
||||
command.argv.append(last_in_left.argv);
|
||||
command.argv.append(first_in_right.argv);
|
||||
command.argv.extend(last_in_left.argv);
|
||||
command.argv.extend(first_in_right.argv);
|
||||
|
||||
command.redirections.append(last_in_left.redirections);
|
||||
command.redirections.append(first_in_right.redirections);
|
||||
command.redirections.extend(last_in_left.redirections);
|
||||
command.redirections.extend(first_in_right.redirections);
|
||||
|
||||
command.should_wait = first_in_right.should_wait && last_in_left.should_wait;
|
||||
command.is_pipe_source = first_in_right.is_pipe_source;
|
||||
|
@ -146,9 +146,9 @@ static inline Vector<Command> join_commands(Vector<Command> left, Vector<Command
|
|||
command.position = merge_positions(last_in_left.position, first_in_right.position);
|
||||
|
||||
Vector<Command> commands;
|
||||
commands.append(left);
|
||||
commands.extend(left);
|
||||
commands.append(command);
|
||||
commands.append(right);
|
||||
commands.extend(right);
|
||||
|
||||
return commands;
|
||||
}
|
||||
|
@ -463,7 +463,7 @@ RefPtr<Value> ListConcatenate::run(RefPtr<Shell> shell)
|
|||
NonnullRefPtrVector<Value> values;
|
||||
|
||||
if (result->is_list_without_resolution()) {
|
||||
values.append(static_cast<ListValue*>(result.ptr())->values());
|
||||
values.extend(static_cast<ListValue*>(result.ptr())->values());
|
||||
} else {
|
||||
for (auto& result : result->resolve_as_list(shell))
|
||||
values.append(create<StringValue>(result));
|
||||
|
@ -1107,7 +1107,7 @@ Vector<Line::CompletionSuggestion> FunctionDeclaration::complete_for_editor(Shel
|
|||
results.append(arg.name);
|
||||
}
|
||||
|
||||
results.append(matching_node->complete_for_editor(shell, offset, hit_test_result));
|
||||
results.extend(matching_node->complete_for_editor(shell, offset, hit_test_result));
|
||||
|
||||
return results;
|
||||
}
|
||||
|
@ -2069,7 +2069,7 @@ RefPtr<Value> MatchExpr::run(RefPtr<Shell> shell)
|
|||
} else {
|
||||
auto list = option.run(shell);
|
||||
option.for_each_entry(shell, [&](auto&& value) {
|
||||
pattern.append(value->resolve_as_list(nullptr)); // Note: 'nullptr' incurs special behaviour,
|
||||
pattern.extend(value->resolve_as_list(nullptr)); // Note: 'nullptr' incurs special behaviour,
|
||||
// asking the node for a 'raw' value.
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
|
@ -2276,10 +2276,10 @@ RefPtr<Value> Pipe::run(RefPtr<Shell> shell)
|
|||
}
|
||||
|
||||
Vector<Command> commands;
|
||||
commands.append(left);
|
||||
commands.extend(left);
|
||||
commands.append(last_in_left);
|
||||
commands.append(first_in_right);
|
||||
commands.append(right);
|
||||
commands.extend(right);
|
||||
|
||||
return create<CommandSequenceValue>(move(commands));
|
||||
}
|
||||
|
@ -2556,7 +2556,7 @@ RefPtr<Value> Sequence::run(RefPtr<Shell> shell)
|
|||
for (auto& entry : m_entries) {
|
||||
if (!last_command_in_sequence) {
|
||||
auto commands = entry.to_lazy_evaluated_commands(shell);
|
||||
all_commands.append(move(commands));
|
||||
all_commands.extend(move(commands));
|
||||
last_command_in_sequence = &all_commands.last();
|
||||
continue;
|
||||
}
|
||||
|
@ -2564,7 +2564,7 @@ RefPtr<Value> Sequence::run(RefPtr<Shell> shell)
|
|||
if (last_command_in_sequence->should_wait) {
|
||||
last_command_in_sequence->next_chain.append(NodeWithAction { entry, NodeWithAction::Sequence });
|
||||
} else {
|
||||
all_commands.append(entry.to_lazy_evaluated_commands(shell));
|
||||
all_commands.extend(entry.to_lazy_evaluated_commands(shell));
|
||||
last_command_in_sequence = &all_commands.last();
|
||||
}
|
||||
}
|
||||
|
@ -3274,7 +3274,7 @@ NonnullRefPtr<Value> Value::with_slices(NonnullRefPtr<Slice> slice) const&
|
|||
NonnullRefPtr<Value> Value::with_slices(NonnullRefPtrVector<Slice> slices) const&
|
||||
{
|
||||
auto value = clone();
|
||||
value->m_slices.append(move(slices));
|
||||
value->m_slices.extend(move(slices));
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -3286,7 +3286,7 @@ Vector<String> ListValue::resolve_as_list(RefPtr<Shell> shell)
|
|||
{
|
||||
Vector<String> values;
|
||||
for (auto& value : m_contained_values)
|
||||
values.append(value.resolve_as_list(shell));
|
||||
values.extend(value.resolve_as_list(shell));
|
||||
|
||||
return resolve_slices(shell, move(values), m_slices);
|
||||
}
|
||||
|
|
|
@ -366,7 +366,7 @@ RefPtr<AST::Node> Shell::immediate_concat_lists(AST::ImmediateExpression& invoki
|
|||
|
||||
for (auto& argument : arguments) {
|
||||
if (auto* list = dynamic_cast<const AST::ListConcatenate*>(&argument)) {
|
||||
result.append(list->list());
|
||||
result.extend(list->list());
|
||||
} else {
|
||||
auto list_of_values = const_cast<AST::Node&>(argument).run(this)->resolve_without_cast(this);
|
||||
if (auto* list = dynamic_cast<AST::ListValue*>(list_of_values.ptr())) {
|
||||
|
|
|
@ -175,8 +175,8 @@ RefPtr<AST::Node> Parser::parse_toplevel()
|
|||
if (result.entries.is_empty())
|
||||
break;
|
||||
|
||||
sequence.append(move(result.entries));
|
||||
positions.append(move(result.separator_positions));
|
||||
sequence.extend(move(result.entries));
|
||||
positions.extend(move(result.separator_positions));
|
||||
} while (result.decision == ShouldReadMoreSequences::Yes);
|
||||
|
||||
if (sequence.is_empty())
|
||||
|
@ -353,7 +353,7 @@ RefPtr<AST::Node> Parser::parse_variable_decls()
|
|||
VERIFY(rest->is_variable_decls());
|
||||
auto* rest_decl = static_cast<AST::VariableDeclarations*>(rest.ptr());
|
||||
|
||||
variables.append(rest_decl->variables());
|
||||
variables.extend(rest_decl->variables());
|
||||
|
||||
return create<AST::VariableDeclarations>(move(variables));
|
||||
}
|
||||
|
|
|
@ -269,7 +269,7 @@ Vector<String> Shell::expand_globs(Vector<StringView> path_segments, const Strin
|
|||
if (!base.ends_with('/'))
|
||||
builder.append('/');
|
||||
builder.append(path);
|
||||
result.append(expand_globs(path_segments, builder.string_view()));
|
||||
result.extend(expand_globs(path_segments, builder.string_view()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -589,7 +589,7 @@ RefPtr<Job> Shell::run_command(const AST::Command& command)
|
|||
|
||||
// If the command is empty, store the redirections and apply them to all later commands.
|
||||
if (command.argv.is_empty() && !command.should_immediately_execute_next) {
|
||||
m_global_redirections.append(command.redirections);
|
||||
m_global_redirections.extend(command.redirections);
|
||||
for (auto& next_in_chain : command.next_chain)
|
||||
run_tail(command, next_in_chain, last_return_code);
|
||||
return nullptr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue