mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-06 16:09:30 +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
12
AK/Vector.h
12
AK/Vector.h
|
@ -227,15 +227,15 @@ public:
|
|||
VERIFY(did_allocate);
|
||||
}
|
||||
|
||||
void append(Vector&& other)
|
||||
void extend(Vector&& other)
|
||||
{
|
||||
auto did_allocate = try_append(move(other));
|
||||
auto did_allocate = try_extend(move(other));
|
||||
VERIFY(did_allocate);
|
||||
}
|
||||
|
||||
void append(Vector const& other)
|
||||
void extend(Vector const& other)
|
||||
{
|
||||
auto did_allocate = try_append(other);
|
||||
auto did_allocate = try_extend(other);
|
||||
VERIFY(did_allocate);
|
||||
}
|
||||
|
||||
|
@ -506,7 +506,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool try_append(Vector&& other)
|
||||
[[nodiscard]] bool try_extend(Vector&& other)
|
||||
{
|
||||
if (is_empty()) {
|
||||
*this = move(other);
|
||||
|
@ -521,7 +521,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool try_append(Vector const& other)
|
||||
[[nodiscard]] bool try_extend(Vector const& other)
|
||||
{
|
||||
if (!try_grow_capacity(size() + other.size()))
|
||||
return false;
|
||||
|
|
|
@ -920,7 +920,7 @@ KResult Ext2FSInode::resize(u64 new_size)
|
|||
auto blocks_or_error = fs().allocate_blocks(fs().group_index_from_inode(index()), blocks_needed_after - blocks_needed_before);
|
||||
if (blocks_or_error.is_error())
|
||||
return blocks_or_error.error();
|
||||
if (!m_block_list.try_append(blocks_or_error.release_value()))
|
||||
if (!m_block_list.try_extend(blocks_or_error.release_value()))
|
||||
return ENOMEM;
|
||||
} else if (blocks_needed_after < blocks_needed_before) {
|
||||
if constexpr (EXT2_VERY_DEBUG) {
|
||||
|
|
|
@ -119,7 +119,7 @@ KResult Space::unmap_mmap_range(VirtualAddress addr, size_t size)
|
|||
region->unmap(Region::ShouldDeallocateVirtualMemoryRange::No);
|
||||
|
||||
// Otherwise just split the regions and collect them for future mapping
|
||||
if (new_regions.try_append(split_region_around_range(*region, range_to_unmap)))
|
||||
if (new_regions.try_extend(split_region_around_range(*region, range_to_unmap)))
|
||||
return ENOMEM;
|
||||
}
|
||||
// Instead we give back the unwanted VM manually at the end.
|
||||
|
|
|
@ -209,7 +209,7 @@ BENCHMARK_CASE(vector_append_trivial)
|
|||
}
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
Vector<int> tmp;
|
||||
tmp.append(ints);
|
||||
tmp.extend(ints);
|
||||
EXPECT_EQ(tmp.size(), 1000000u);
|
||||
}
|
||||
}
|
||||
|
@ -450,7 +450,7 @@ TEST_CASE(can_store_references)
|
|||
|
||||
{
|
||||
Vector<int&> other_references;
|
||||
other_references.append(references);
|
||||
other_references.extend(references);
|
||||
EXPECT_EQ(&other_references.first(), &my_integer);
|
||||
}
|
||||
|
||||
|
|
|
@ -286,7 +286,7 @@ void TreeMapWidget::mousedown_event(GUI::MouseEvent& event)
|
|||
Vector<int> path = path_to_position(event.position());
|
||||
if (!path.is_empty()) {
|
||||
m_path.shrink(m_viewpoint);
|
||||
m_path.append(path);
|
||||
m_path.extend(path);
|
||||
if (on_path_change) {
|
||||
on_path_change();
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ void TreeMapWidget::doubleclick_event(GUI::MouseEvent& event)
|
|||
if (node && !node_is_leaf(*node)) {
|
||||
Vector<int> path = path_to_position(event.position());
|
||||
m_path.shrink(m_viewpoint);
|
||||
m_path.append(path);
|
||||
m_path.extend(path);
|
||||
m_viewpoint = m_path.size();
|
||||
if (on_path_change) {
|
||||
on_path_change();
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace Spreadsheet {
|
|||
CSVExportDialogPage::CSVExportDialogPage(const Sheet& sheet)
|
||||
: m_data(sheet.to_xsv())
|
||||
{
|
||||
m_headers.append(m_data.take_first());
|
||||
m_headers.extend(m_data.take_first());
|
||||
|
||||
auto temp_template = String::formatted("{}/spreadsheet-csv-export.{}.XXXXXX", Core::StandardPaths::tempfile_directory(), getpid());
|
||||
auto temp_path = ByteBuffer::create_uninitialized(temp_template.length() + 1);
|
||||
|
|
|
@ -321,7 +321,7 @@ void SpreadsheetWidget::add_sheet(NonnullRefPtr<Sheet>&& sheet)
|
|||
|
||||
NonnullRefPtrVector<Sheet> new_sheets;
|
||||
new_sheets.append(move(sheet));
|
||||
m_workbook->sheets().append(new_sheets);
|
||||
m_workbook->sheets().extend(new_sheets);
|
||||
setup_tabs(new_sheets);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ Vector<LexicalPath> GitRepo::unstaged_files() const
|
|||
{
|
||||
auto modified = modified_files();
|
||||
auto untracked = untracked_files();
|
||||
modified.append(move(untracked));
|
||||
modified.extend(move(untracked));
|
||||
return modified;
|
||||
}
|
||||
//
|
||||
|
|
|
@ -325,7 +325,7 @@ Vector<CppComprehensionEngine::Symbol> CppComprehensionEngine::get_child_symbols
|
|||
|
||||
auto new_scope = scope;
|
||||
new_scope.append(decl.name());
|
||||
symbols.append(get_child_symbols(decl, new_scope, are_child_symbols_local ? Symbol::IsLocal::Yes : is_local));
|
||||
symbols.extend(get_child_symbols(decl, new_scope, are_child_symbols_local ? Symbol::IsLocal::Yes : is_local));
|
||||
}
|
||||
|
||||
return symbols;
|
||||
|
|
|
@ -92,7 +92,7 @@ GUI::ModelIndex RemoteObjectPropertyModel::index(int row, int column, const GUI:
|
|||
|
||||
auto nth_child = [&](int n, const JsonValue& value) -> const JsonPath* {
|
||||
auto path = make<JsonPath>();
|
||||
path->append(parent_path);
|
||||
path->extend(parent_path);
|
||||
int row_index = n;
|
||||
if (value.is_object()) {
|
||||
String property_name;
|
||||
|
|
|
@ -202,8 +202,8 @@ void GMLAutocompleteProvider::provide_completions(Function<void(Vector<Entry>)>
|
|||
quick_sort(identifier_entries, [](auto& a, auto& b) { return a.completion < b.completion; });
|
||||
|
||||
Vector<GUI::AutocompleteProvider::Entry> entries;
|
||||
entries.append(move(identifier_entries));
|
||||
entries.append(move(class_entries));
|
||||
entries.extend(move(identifier_entries));
|
||||
entries.extend(move(class_entries));
|
||||
|
||||
callback(move(entries));
|
||||
}
|
||||
|
|
|
@ -405,7 +405,7 @@ void EventLoop::pump(WaitMode mode)
|
|||
new_event_queue.ensure_capacity(m_queued_events.size() + events.size());
|
||||
for (++i; i < events.size(); ++i)
|
||||
new_event_queue.unchecked_append(move(events[i]));
|
||||
new_event_queue.append(move(m_queued_events));
|
||||
new_event_queue.extend(move(m_queued_events));
|
||||
m_queued_events = move(new_event_queue);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
|
||||
void take_pending_events_from(EventLoop& other)
|
||||
{
|
||||
m_queued_events.append(move(other.m_queued_events));
|
||||
m_queued_events.extend(move(other.m_queued_events));
|
||||
}
|
||||
|
||||
static void wake();
|
||||
|
|
|
@ -63,7 +63,7 @@ NonnullRefPtrVector<Declaration> FunctionDeclaration::declarations() const
|
|||
}
|
||||
|
||||
if (m_definition)
|
||||
declarations.append(m_definition->declarations());
|
||||
declarations.extend(m_definition->declarations());
|
||||
|
||||
return declarations;
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ NonnullRefPtrVector<Declaration> FunctionDefinition::declarations() const
|
|||
{
|
||||
NonnullRefPtrVector<Declaration> declarations;
|
||||
for (auto& statement : m_statements) {
|
||||
declarations.append(statement.declarations());
|
||||
declarations.extend(statement.declarations());
|
||||
}
|
||||
return declarations;
|
||||
}
|
||||
|
@ -400,9 +400,9 @@ NonnullRefPtrVector<Declaration> ForStatement::declarations() const
|
|||
{
|
||||
NonnullRefPtrVector<Declaration> declarations;
|
||||
if (m_init)
|
||||
declarations.append(m_init->declarations());
|
||||
declarations.extend(m_init->declarations());
|
||||
if (m_body)
|
||||
declarations.append(m_body->declarations());
|
||||
declarations.extend(m_body->declarations());
|
||||
return declarations;
|
||||
}
|
||||
|
||||
|
@ -410,7 +410,7 @@ NonnullRefPtrVector<Declaration> BlockStatement::declarations() const
|
|||
{
|
||||
NonnullRefPtrVector<Declaration> declarations;
|
||||
for (auto& statement : m_statements) {
|
||||
declarations.append(statement.declarations());
|
||||
declarations.extend(statement.declarations());
|
||||
}
|
||||
return declarations;
|
||||
}
|
||||
|
@ -439,11 +439,11 @@ NonnullRefPtrVector<Declaration> IfStatement::declarations() const
|
|||
{
|
||||
NonnullRefPtrVector<Declaration> declarations;
|
||||
if (m_predicate)
|
||||
declarations.append(m_predicate->declarations());
|
||||
declarations.extend(m_predicate->declarations());
|
||||
if (m_then)
|
||||
declarations.append(m_then->declarations());
|
||||
declarations.extend(m_then->declarations());
|
||||
if (m_else)
|
||||
declarations.append(m_else->declarations());
|
||||
declarations.extend(m_else->declarations());
|
||||
return declarations;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ void DebugInfo::prepare_lines()
|
|||
Vector<Dwarf::LineProgram::LineInfo> all_lines;
|
||||
while (!stream.eof()) {
|
||||
Dwarf::LineProgram program(m_dwarf_info, stream);
|
||||
all_lines.append(program.lines());
|
||||
all_lines.extend(program.lines());
|
||||
}
|
||||
|
||||
HashMap<FlyString, Optional<String>> memoized_full_paths;
|
||||
|
|
|
@ -123,8 +123,8 @@ void FileSystemModel::Node::traverse_if_needed()
|
|||
file_children.append(move(child));
|
||||
}
|
||||
|
||||
children.append(move(directory_children));
|
||||
children.append(move(file_children));
|
||||
children.extend(move(directory_children));
|
||||
children.extend(move(file_children));
|
||||
|
||||
if (!m_model.m_file_watcher->is_watching(full_path)) {
|
||||
// We are not already watching this file, watch it
|
||||
|
|
|
@ -380,7 +380,7 @@ void Window::handle_multi_paint_event(MultiPaintEvent& event)
|
|||
// It's possible that there had been some calls to update() that
|
||||
// haven't been flushed. We can handle these right now, avoiding
|
||||
// another round trip.
|
||||
rects.append(move(m_pending_paint_event_rects));
|
||||
rects.extend(move(m_pending_paint_event_rects));
|
||||
}
|
||||
VERIFY(!rects.is_empty());
|
||||
if (m_back_store && m_back_store->size() != event.window_size()) {
|
||||
|
|
|
@ -424,9 +424,9 @@ static bool set_dib_bitmasks(BMPLoadingContext& context, InputStreamer& streamer
|
|||
auto& type = context.dib_type;
|
||||
|
||||
if (type > DIBType::OSV2 && bpp == 16 && compression == Compression::RGB) {
|
||||
context.dib.info.masks.append({ 0x7c00, 0x03e0, 0x001f });
|
||||
context.dib.info.mask_shifts.append({ 7, 2, -3 });
|
||||
context.dib.info.mask_sizes.append({ 5, 5, 5 });
|
||||
context.dib.info.masks.extend({ 0x7c00, 0x03e0, 0x001f });
|
||||
context.dib.info.mask_shifts.extend({ 7, 2, -3 });
|
||||
context.dib.info.mask_sizes.extend({ 5, 5, 5 });
|
||||
} else if (type == DIBType::Info && (compression == Compression::BITFIELDS || compression == Compression::ALPHABITFIELDS)) {
|
||||
// Consume the extra BITFIELDS bytes
|
||||
auto number_of_mask_fields = compression == Compression::ALPHABITFIELDS ? 4 : 3;
|
||||
|
|
|
@ -160,7 +160,7 @@ public:
|
|||
void reset()
|
||||
{
|
||||
m_code_table.clear();
|
||||
m_code_table.append(m_original_code_table);
|
||||
m_code_table.extend(m_original_code_table);
|
||||
m_code_size = m_original_code_size;
|
||||
m_table_capacity = pow(2, m_code_size);
|
||||
m_output.clear();
|
||||
|
|
|
@ -129,7 +129,7 @@ void PNGWriter::add_chunk(PNGChunk const& png_chunk)
|
|||
for (auto character : png_chunk.type()) {
|
||||
combined.append(character);
|
||||
}
|
||||
combined.append(png_chunk.data());
|
||||
combined.extend(png_chunk.data());
|
||||
|
||||
auto crc = BigEndian(Crypto::Checksum::CRC32({ (const u8*)combined.data(), combined.size() }).digest());
|
||||
auto data_len = BigEndian(png_chunk.data().size());
|
||||
|
|
|
@ -2230,12 +2230,12 @@ Value DebuggerStatement::execute(Interpreter& interpreter, GlobalObject&) const
|
|||
|
||||
void ScopeNode::add_variables(NonnullRefPtrVector<VariableDeclaration> variables)
|
||||
{
|
||||
m_variables.append(move(variables));
|
||||
m_variables.extend(move(variables));
|
||||
}
|
||||
|
||||
void ScopeNode::add_functions(NonnullRefPtrVector<FunctionDeclaration> functions)
|
||||
{
|
||||
m_functions.append(move(functions));
|
||||
m_functions.extend(move(functions));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ BoundFunction* Function::bind(Value bound_this_value, Vector<Value> arguments)
|
|||
constructor_prototype = &prototype_property.as_object();
|
||||
|
||||
auto all_bound_arguments = bound_arguments();
|
||||
all_bound_arguments.append(move(arguments));
|
||||
all_bound_arguments.extend(move(arguments));
|
||||
|
||||
return heap().allocate<BoundFunction>(global_object(), global_object(), target_function, bound_this_object, move(all_bound_arguments), computed_length, constructor_prototype);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
MarkedValueList copy() const
|
||||
{
|
||||
MarkedValueList copy { m_heap };
|
||||
copy.append(*this);
|
||||
copy.extend(*this);
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
|
|
@ -373,7 +373,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_replace)
|
|||
if (replace_value.is_function()) {
|
||||
MarkedValueList replacer_args(vm.heap());
|
||||
replacer_args.append(js_string(vm, matched));
|
||||
replacer_args.append(move(captures));
|
||||
replacer_args.extend(move(captures));
|
||||
replacer_args.append(Value(position));
|
||||
replacer_args.append(js_string(vm, string));
|
||||
if (!named_captures.is_undefined()) {
|
||||
|
|
|
@ -397,7 +397,7 @@ Value VM::construct(Function& function, Function& new_target, Optional<MarkedVal
|
|||
call_frame.function_name = function.name();
|
||||
call_frame.arguments = function.bound_arguments();
|
||||
if (arguments.has_value())
|
||||
call_frame.arguments.append(arguments.value().values());
|
||||
call_frame.arguments.extend(arguments.value().values());
|
||||
auto* environment = function.create_environment();
|
||||
call_frame.scope = environment;
|
||||
if (environment)
|
||||
|
@ -509,7 +509,7 @@ Value VM::call_internal(Function& function, Value this_value, Optional<MarkedVal
|
|||
call_frame.this_value = function.bound_this().value_or(this_value);
|
||||
call_frame.arguments = function.bound_arguments();
|
||||
if (arguments.has_value())
|
||||
call_frame.arguments.append(arguments.value().values());
|
||||
call_frame.arguments.extend(arguments.value().values());
|
||||
auto* environment = function.create_environment();
|
||||
call_frame.scope = environment;
|
||||
|
||||
|
|
|
@ -155,9 +155,9 @@ public:
|
|||
}
|
||||
|
||||
bytecode.empend(arguments.size()); // size of arguments
|
||||
bytecode.append(move(arguments));
|
||||
bytecode.extend(move(arguments));
|
||||
|
||||
append(move(bytecode));
|
||||
extend(move(bytecode));
|
||||
}
|
||||
|
||||
void insert_bytecode_check_boundary(BoundaryCheckType type)
|
||||
|
@ -166,7 +166,7 @@ public:
|
|||
bytecode.empend((ByteCodeValueType)OpCodeId::CheckBoundary);
|
||||
bytecode.empend((ByteCodeValueType)type);
|
||||
|
||||
append(move(bytecode));
|
||||
extend(move(bytecode));
|
||||
}
|
||||
|
||||
void insert_bytecode_compare_string(StringView view)
|
||||
|
@ -182,9 +182,9 @@ public:
|
|||
arguments.insert_string(view);
|
||||
|
||||
bytecode.empend(arguments.size()); // size of arguments
|
||||
bytecode.append(move(arguments));
|
||||
bytecode.extend(move(arguments));
|
||||
|
||||
append(move(bytecode));
|
||||
extend(move(bytecode));
|
||||
}
|
||||
|
||||
void insert_bytecode_compare_named_reference(StringView name)
|
||||
|
@ -201,9 +201,9 @@ public:
|
|||
arguments.empend(name.length());
|
||||
|
||||
bytecode.empend(arguments.size()); // size of arguments
|
||||
bytecode.append(move(arguments));
|
||||
bytecode.extend(move(arguments));
|
||||
|
||||
append(move(bytecode));
|
||||
extend(move(bytecode));
|
||||
}
|
||||
|
||||
void insert_bytecode_group_capture_left(size_t capture_groups_count)
|
||||
|
@ -248,7 +248,7 @@ public:
|
|||
// REGEXP BODY
|
||||
// RESTORE
|
||||
empend((ByteCodeValueType)OpCodeId::Save);
|
||||
append(move(lookaround_body));
|
||||
extend(move(lookaround_body));
|
||||
empend((ByteCodeValueType)OpCodeId::Restore);
|
||||
return;
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ public:
|
|||
auto body_length = lookaround_body.size();
|
||||
empend((ByteCodeValueType)OpCodeId::Jump);
|
||||
empend((ByteCodeValueType)body_length + 2); // JUMP to label _A
|
||||
append(move(lookaround_body));
|
||||
extend(move(lookaround_body));
|
||||
empend((ByteCodeValueType)OpCodeId::FailForks);
|
||||
empend((ByteCodeValueType)2); // Fail two forks
|
||||
empend((ByteCodeValueType)OpCodeId::Save);
|
||||
|
@ -281,7 +281,7 @@ public:
|
|||
empend((ByteCodeValueType)OpCodeId::Save);
|
||||
empend((ByteCodeValueType)OpCodeId::GoBack);
|
||||
empend((ByteCodeValueType)match_length);
|
||||
append(move(lookaround_body));
|
||||
extend(move(lookaround_body));
|
||||
empend((ByteCodeValueType)OpCodeId::Restore);
|
||||
return;
|
||||
case LookAroundType::NegatedLookBehind: {
|
||||
|
@ -299,7 +299,7 @@ public:
|
|||
empend((ByteCodeValueType)body_length + 4); // JUMP to label _A
|
||||
empend((ByteCodeValueType)OpCodeId::GoBack);
|
||||
empend((ByteCodeValueType)match_length);
|
||||
append(move(lookaround_body));
|
||||
extend(move(lookaround_body));
|
||||
empend((ByteCodeValueType)OpCodeId::FailForks);
|
||||
empend((ByteCodeValueType)2); // Fail two forks
|
||||
empend((ByteCodeValueType)OpCodeId::Save);
|
||||
|
@ -355,7 +355,7 @@ public:
|
|||
new_bytecode.empend(diff * (bytecode_to_repeat.size() + 2)); // Jump to the _END label
|
||||
|
||||
for (size_t i = 0; i < diff; ++i) {
|
||||
new_bytecode.append(bytecode_to_repeat);
|
||||
new_bytecode.extend(bytecode_to_repeat);
|
||||
new_bytecode.empend(jump_kind);
|
||||
new_bytecode.empend((diff - i - 1) * (bytecode_to_repeat.size() + 2)); // Jump to the _END label
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ public:
|
|||
void insert_bytecode_repetition_n(ByteCode& bytecode_to_repeat, size_t n)
|
||||
{
|
||||
for (size_t i = 0; i < n; ++i)
|
||||
append(bytecode_to_repeat);
|
||||
extend(bytecode_to_repeat);
|
||||
}
|
||||
|
||||
void insert_bytecode_repetition_min_one(ByteCode& bytecode_to_repeat, bool greedy)
|
||||
|
|
|
@ -473,7 +473,7 @@ ALWAYS_INLINE bool PosixExtendedParser::parse_sub_expression(ByteCode& stack, si
|
|||
if (!parse_bracket_expression(sub_ops, length) || !sub_ops.size())
|
||||
return set_error(Error::InvalidBracketContent);
|
||||
|
||||
bytecode.append(move(sub_ops));
|
||||
bytecode.extend(move(sub_ops));
|
||||
|
||||
consume(TokenType::RightBracket, Error::MismatchingBracket);
|
||||
should_parse_repetition_symbol = true;
|
||||
|
@ -559,7 +559,7 @@ ALWAYS_INLINE bool PosixExtendedParser::parse_sub_expression(ByteCode& stack, si
|
|||
if (!parse_root(capture_group_bytecode, length))
|
||||
return set_error(Error::InvalidPattern);
|
||||
|
||||
bytecode.append(move(capture_group_bytecode));
|
||||
bytecode.extend(move(capture_group_bytecode));
|
||||
|
||||
consume(TokenType::RightParen, Error::MismatchingParen);
|
||||
|
||||
|
@ -586,7 +586,7 @@ ALWAYS_INLINE bool PosixExtendedParser::parse_sub_expression(ByteCode& stack, si
|
|||
return set_error(Error::InvalidRepetitionMarker);
|
||||
}
|
||||
|
||||
stack.append(move(bytecode));
|
||||
stack.extend(move(bytecode));
|
||||
match_length_minimum += length;
|
||||
|
||||
return true;
|
||||
|
@ -623,7 +623,7 @@ bool PosixExtendedParser::parse_root(ByteCode& stack, size_t& match_length_minim
|
|||
if (bytecode_left.is_empty())
|
||||
set_error(Error::EmptySubExpression);
|
||||
|
||||
stack.append(move(bytecode_left));
|
||||
stack.extend(move(bytecode_left));
|
||||
match_length_minimum = match_length_minimum_left;
|
||||
return !has_error();
|
||||
}
|
||||
|
@ -648,7 +648,7 @@ bool ECMA262Parser::parse_internal(ByteCode& stack, size_t& match_length_minimum
|
|||
if (!res)
|
||||
return false;
|
||||
|
||||
stack.append(new_stack);
|
||||
stack.extend(new_stack);
|
||||
match_length_minimum = new_match_length;
|
||||
return res;
|
||||
}
|
||||
|
@ -668,7 +668,7 @@ bool ECMA262Parser::parse_disjunction(ByteCode& stack, size_t& match_length_mini
|
|||
return false;
|
||||
|
||||
if (!match(TokenType::Pipe)) {
|
||||
stack.append(left_alternative_stack);
|
||||
stack.extend(left_alternative_stack);
|
||||
match_length_minimum = left_alternative_min_length;
|
||||
return alt_ok;
|
||||
}
|
||||
|
@ -726,7 +726,7 @@ bool ECMA262Parser::parse_term(ByteCode& stack, size_t& match_length_minimum, bo
|
|||
if (!parse_with_quantifier())
|
||||
return false;
|
||||
|
||||
stack.append(move(atom_stack));
|
||||
stack.extend(move(atom_stack));
|
||||
match_length_minimum += minimum_atom_length;
|
||||
return true;
|
||||
}
|
||||
|
@ -783,7 +783,7 @@ bool ECMA262Parser::parse_assertion(ByteCode& stack, [[maybe_unused]] size_t& ma
|
|||
if (m_should_use_browser_extended_grammar) {
|
||||
if (!unicode) {
|
||||
if (parse_quantifiable_assertion(assertion_stack, match_length_minimum, named)) {
|
||||
stack.append(move(assertion_stack));
|
||||
stack.extend(move(assertion_stack));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1656,7 +1656,7 @@ bool ECMA262Parser::parse_capture_group(ByteCode& stack, size_t& match_length_mi
|
|||
|
||||
consume(TokenType::RightParen, Error::MismatchingParen);
|
||||
|
||||
stack.append(move(noncapture_group_bytecode));
|
||||
stack.extend(move(noncapture_group_bytecode));
|
||||
match_length_minimum += length;
|
||||
return true;
|
||||
}
|
||||
|
@ -1680,7 +1680,7 @@ bool ECMA262Parser::parse_capture_group(ByteCode& stack, size_t& match_length_mi
|
|||
|
||||
stack.insert_bytecode_group_capture_left(name);
|
||||
stack.insert_bytecode_group_capture_left(group_index);
|
||||
stack.append(move(capture_group_bytecode));
|
||||
stack.extend(move(capture_group_bytecode));
|
||||
stack.insert_bytecode_group_capture_right(name);
|
||||
stack.insert_bytecode_group_capture_right(group_index);
|
||||
|
||||
|
@ -1704,7 +1704,7 @@ bool ECMA262Parser::parse_capture_group(ByteCode& stack, size_t& match_length_mi
|
|||
if (!parse_disjunction(capture_group_bytecode, length, unicode, named))
|
||||
return set_error(Error::InvalidPattern);
|
||||
|
||||
stack.append(move(capture_group_bytecode));
|
||||
stack.extend(move(capture_group_bytecode));
|
||||
|
||||
m_parser_state.capture_group_minimum_lengths.set(group_index, length);
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ static ParseResult<ParseUntilAnyOfResult<T>> parse_until_any_of(InputStream& str
|
|||
if (parse_result.is_error())
|
||||
return parse_result.error();
|
||||
|
||||
result.values.append(parse_result.release_value());
|
||||
result.values.extend(parse_result.release_value());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -312,7 +312,7 @@ ParseResult<Vector<Instruction>> Instruction::parse(InputStream& stream, Instruc
|
|||
|
||||
// Transform op(..., instr*, instr*) -> op(...) instr* op(else(ip) instr* op(end(ip))
|
||||
VERIFY(result.value().terminator == 0x05);
|
||||
instructions.append(result.release_value().values);
|
||||
instructions.extend(result.release_value().values);
|
||||
instructions.append(Instruction { Instructions::structured_else });
|
||||
++ip;
|
||||
else_ip = ip.value();
|
||||
|
@ -322,7 +322,7 @@ ParseResult<Vector<Instruction>> Instruction::parse(InputStream& stream, Instruc
|
|||
auto result = parse_until_any_of<Instruction, 0x0b>(stream, ip);
|
||||
if (result.is_error())
|
||||
return result.error();
|
||||
instructions.append(result.release_value().values);
|
||||
instructions.extend(result.release_value().values);
|
||||
instructions.append(Instruction { Instructions::structured_end });
|
||||
++ip;
|
||||
end_ip = ip.value();
|
||||
|
|
|
@ -1560,8 +1560,7 @@ _StartOfFunction:
|
|||
log_parse_error();
|
||||
}
|
||||
|
||||
m_temporary_buffer.clear();
|
||||
m_temporary_buffer.append(match.value().code_points);
|
||||
m_temporary_buffer = match.value().code_points;
|
||||
|
||||
FLUSH_CODEPOINTS_CONSUMED_AS_A_CHARACTER_REFERENCE;
|
||||
SWITCH_TO_RETURN_STATE;
|
||||
|
|
|
@ -99,7 +99,7 @@ void SyntaxHighlighter::rehighlight(Palette const& palette)
|
|||
register_nested_token_pairs(proxy_client.corrected_token_pairs(highlighter.matching_token_pairs()));
|
||||
}
|
||||
|
||||
spans.append(proxy_client.corrected_spans());
|
||||
spans.extend(proxy_client.corrected_spans());
|
||||
substring_builder.clear();
|
||||
} else if (state == State::CSS) {
|
||||
// FIXME: Highlight CSS code here instead.
|
||||
|
|
|
@ -279,23 +279,23 @@ Vector<Vector<float>> PathDataParser::parse_coordinate_pair_sequence()
|
|||
Vector<float> PathDataParser::parse_coordinate_pair_double()
|
||||
{
|
||||
Vector<float> coordinates;
|
||||
coordinates.append(parse_coordinate_pair());
|
||||
coordinates.extend(parse_coordinate_pair());
|
||||
if (match_comma_whitespace())
|
||||
parse_comma_whitespace();
|
||||
coordinates.append(parse_coordinate_pair());
|
||||
coordinates.extend(parse_coordinate_pair());
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
Vector<float> PathDataParser::parse_coordinate_pair_triplet()
|
||||
{
|
||||
Vector<float> coordinates;
|
||||
coordinates.append(parse_coordinate_pair());
|
||||
coordinates.extend(parse_coordinate_pair());
|
||||
if (match_comma_whitespace())
|
||||
parse_comma_whitespace();
|
||||
coordinates.append(parse_coordinate_pair());
|
||||
coordinates.extend(parse_coordinate_pair());
|
||||
if (match_comma_whitespace())
|
||||
parse_comma_whitespace();
|
||||
coordinates.append(parse_coordinate_pair());
|
||||
coordinates.extend(parse_coordinate_pair());
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ Vector<float> PathDataParser::parse_elliptical_arg_argument()
|
|||
numbers.append(parse_flag());
|
||||
if (match_comma_whitespace())
|
||||
parse_comma_whitespace();
|
||||
numbers.append(parse_coordinate_pair());
|
||||
numbers.extend(parse_coordinate_pair());
|
||||
|
||||
return numbers;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ void Mixer::mix()
|
|||
if (active_mix_queues.is_empty() || m_added_queue) {
|
||||
pthread_mutex_lock(&m_pending_mutex);
|
||||
pthread_cond_wait(&m_pending_cond, &m_pending_mutex);
|
||||
active_mix_queues.append(move(m_pending_mixing));
|
||||
active_mix_queues.extend(move(m_pending_mixing));
|
||||
pthread_mutex_unlock(&m_pending_mutex);
|
||||
m_added_queue = false;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -113,7 +113,7 @@ int parse_args(int argc, char** argv, Vector<String>& files, DuOption& du_option
|
|||
const auto buff = file->read_all();
|
||||
if (!buff.is_empty()) {
|
||||
String patterns = String::copy(buff, Chomp);
|
||||
du_option.excluded_patterns.append(patterns.split('\n'));
|
||||
du_option.excluded_patterns.extend(patterns.split('\n'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue