mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 06:37:35 +00:00
Everywhere: Stop using NonnullRefPtrVector
This class had slightly confusing semantics and the added weirdness doesn't seem worth it just so we can say "." instead of "->" when iterating over a vector of NNRPs. This patch replaces NonnullRefPtrVector<T> with Vector<NNRP<T>>.
This commit is contained in:
parent
104be6c8ac
commit
8a48246ed1
168 changed files with 1280 additions and 1280 deletions
|
@ -55,14 +55,14 @@ void Card::clear_and_paint(GUI::Painter& painter, Color background_color, bool h
|
|||
save_old_position();
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtrVector<Card>> create_standard_deck(Shuffle shuffle)
|
||||
ErrorOr<Vector<NonnullRefPtr<Card>>> create_standard_deck(Shuffle shuffle)
|
||||
{
|
||||
return create_deck(1, 1, 1, 1, shuffle);
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtrVector<Card>> create_deck(unsigned full_club_suit_count, unsigned full_diamond_suit_count, unsigned full_heart_suit_count, unsigned full_spade_suit_count, Shuffle shuffle)
|
||||
ErrorOr<Vector<NonnullRefPtr<Card>>> create_deck(unsigned full_club_suit_count, unsigned full_diamond_suit_count, unsigned full_heart_suit_count, unsigned full_spade_suit_count, Shuffle shuffle)
|
||||
{
|
||||
NonnullRefPtrVector<Card> deck;
|
||||
Vector<NonnullRefPtr<Card>> deck;
|
||||
TRY(deck.try_ensure_capacity(Card::card_count * (full_club_suit_count + full_diamond_suit_count + full_heart_suit_count + full_spade_suit_count)));
|
||||
|
||||
auto add_cards_for_suit = [&deck](Cards::Suit suit, unsigned number_of_suits) -> ErrorOr<void> {
|
||||
|
|
|
@ -131,8 +131,8 @@ enum class Shuffle {
|
|||
No,
|
||||
Yes,
|
||||
};
|
||||
ErrorOr<NonnullRefPtrVector<Card>> create_standard_deck(Shuffle);
|
||||
ErrorOr<NonnullRefPtrVector<Card>> create_deck(unsigned full_club_suit_count, unsigned full_diamond_suit_count, unsigned full_heart_suit_count, unsigned full_spade_suit_count, Shuffle);
|
||||
ErrorOr<Vector<NonnullRefPtr<Card>>> create_standard_deck(Shuffle);
|
||||
ErrorOr<Vector<NonnullRefPtr<Card>>> create_deck(unsigned full_club_suit_count, unsigned full_diamond_suit_count, unsigned full_heart_suit_count, unsigned full_spade_suit_count, Shuffle);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -36,8 +36,8 @@ CardGame::CardGame()
|
|||
void CardGame::mark_intersecting_stacks_dirty(Cards::Card const& intersecting_card)
|
||||
{
|
||||
for (auto& stack : stacks()) {
|
||||
if (intersecting_card.rect().intersects(stack.bounding_box()))
|
||||
update(stack.bounding_box());
|
||||
if (intersecting_card.rect().intersects(stack->bounding_box()))
|
||||
update(stack->bounding_box());
|
||||
}
|
||||
|
||||
update(intersecting_card.rect());
|
||||
|
@ -49,7 +49,7 @@ Gfx::IntRect CardGame::moving_cards_bounds() const
|
|||
return {};
|
||||
|
||||
// Note: This assumes that the cards are arranged in a line.
|
||||
return m_moving_cards.first().rect().united(m_moving_cards.last().rect());
|
||||
return m_moving_cards.first()->rect().united(m_moving_cards.last()->rect());
|
||||
}
|
||||
|
||||
ErrorOr<void> CardGame::pick_up_cards_from_stack(Cards::CardStack& stack, Gfx::IntPoint click_location, CardStack::MovementRule movement_rule)
|
||||
|
@ -70,10 +70,10 @@ RefPtr<CardStack> CardGame::find_stack_to_drop_on(CardStack::MovementRule moveme
|
|||
if (stack == moving_cards_source_stack())
|
||||
continue;
|
||||
|
||||
if (stack.bounding_box().intersects(bounds_to_check)
|
||||
&& stack.is_allowed_to_push(moving_cards().at(0), moving_cards().size(), movement_rule)) {
|
||||
if (stack->bounding_box().intersects(bounds_to_check)
|
||||
&& stack->is_allowed_to_push(moving_cards().at(0), moving_cards().size(), movement_rule)) {
|
||||
|
||||
auto distance = bounds_to_check.center().distance_from(stack.bounding_box().center());
|
||||
auto distance = bounds_to_check.center().distance_from(stack->bounding_box().center());
|
||||
if (distance < closest_distance) {
|
||||
closest_stack = stack;
|
||||
closest_distance = distance;
|
||||
|
|
|
@ -25,8 +25,8 @@ public:
|
|||
Gfx::Color background_color() const;
|
||||
void set_background_color(Gfx::Color);
|
||||
|
||||
NonnullRefPtrVector<CardStack>& stacks() { return m_stacks; }
|
||||
NonnullRefPtrVector<CardStack> const& stacks() const { return m_stacks; }
|
||||
Vector<NonnullRefPtr<CardStack>>& stacks() { return m_stacks; }
|
||||
Vector<NonnullRefPtr<CardStack>> const& stacks() const { return m_stacks; }
|
||||
CardStack& stack_at_location(int location) { return m_stacks[location]; }
|
||||
|
||||
template<class... Args>
|
||||
|
@ -38,8 +38,8 @@ public:
|
|||
void mark_intersecting_stacks_dirty(Card const& intersecting_card);
|
||||
|
||||
bool is_moving_cards() const { return !m_moving_cards.is_empty(); }
|
||||
NonnullRefPtrVector<Card>& moving_cards() { return m_moving_cards; }
|
||||
NonnullRefPtrVector<Card> const& moving_cards() const { return m_moving_cards; }
|
||||
Vector<NonnullRefPtr<Card>>& moving_cards() { return m_moving_cards; }
|
||||
Vector<NonnullRefPtr<Card>> const& moving_cards() const { return m_moving_cards; }
|
||||
Gfx::IntRect moving_cards_bounds() const;
|
||||
RefPtr<CardStack> moving_cards_source_stack() const { return m_moving_cards_source_stack; }
|
||||
ErrorOr<void> pick_up_cards_from_stack(CardStack&, Gfx::IntPoint click_location, CardStack::MovementRule);
|
||||
|
@ -59,9 +59,9 @@ protected:
|
|||
private:
|
||||
virtual void config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) override;
|
||||
|
||||
NonnullRefPtrVector<CardStack> m_stacks;
|
||||
Vector<NonnullRefPtr<CardStack>> m_stacks;
|
||||
|
||||
NonnullRefPtrVector<Card> m_moving_cards;
|
||||
Vector<NonnullRefPtr<Card>> m_moving_cards;
|
||||
RefPtr<CardStack> m_moving_cards_source_stack;
|
||||
RefPtr<CardStack> m_previewed_card_stack;
|
||||
};
|
||||
|
|
|
@ -37,7 +37,7 @@ void CardStack::paint(GUI::Painter& painter, Gfx::Color background_color)
|
|||
auto draw_background_if_empty = [&]() {
|
||||
size_t number_of_moving_cards = 0;
|
||||
for (auto const& card : m_stack)
|
||||
number_of_moving_cards += card.is_moving() ? 1 : 0;
|
||||
number_of_moving_cards += card->is_moving() ? 1 : 0;
|
||||
|
||||
if (m_covered_stack && !m_covered_stack->is_empty())
|
||||
return false;
|
||||
|
@ -96,15 +96,15 @@ void CardStack::paint(GUI::Painter& painter, Gfx::Color background_color)
|
|||
RefPtr<Card> previewed_card;
|
||||
|
||||
for (size_t i = 0; i < m_stack.size(); ++i) {
|
||||
if (auto& card = m_stack[i]; !card.is_moving()) {
|
||||
if (card.is_previewed()) {
|
||||
if (auto& card = m_stack[i]; !card->is_moving()) {
|
||||
if (card->is_previewed()) {
|
||||
VERIFY(!previewed_card);
|
||||
previewed_card = card;
|
||||
continue;
|
||||
}
|
||||
|
||||
auto highlighted = m_highlighted && (i == m_stack.size() - 1);
|
||||
card.clear_and_paint(painter, Gfx::Color::Transparent, highlighted);
|
||||
card->clear_and_paint(painter, Gfx::Color::Transparent, highlighted);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,10 +118,10 @@ void CardStack::rebound_cards()
|
|||
|
||||
size_t card_index = 0;
|
||||
for (auto& card : m_stack)
|
||||
card.set_position(m_stack_positions.at(card_index++));
|
||||
card->set_position(m_stack_positions.at(card_index++));
|
||||
}
|
||||
|
||||
ErrorOr<void> CardStack::add_all_grabbed_cards(Gfx::IntPoint click_location, NonnullRefPtrVector<Card>& grabbed, MovementRule movement_rule)
|
||||
ErrorOr<void> CardStack::add_all_grabbed_cards(Gfx::IntPoint click_location, Vector<NonnullRefPtr<Card>>& grabbed, MovementRule movement_rule)
|
||||
{
|
||||
VERIFY(grabbed.is_empty());
|
||||
|
||||
|
@ -137,8 +137,8 @@ ErrorOr<void> CardStack::add_all_grabbed_cards(Gfx::IntPoint click_location, Non
|
|||
RefPtr<Card> last_intersect;
|
||||
|
||||
for (auto& card : m_stack) {
|
||||
if (card.rect().contains(click_location)) {
|
||||
if (card.is_upside_down())
|
||||
if (card->rect().contains(click_location)) {
|
||||
if (card->is_upside_down())
|
||||
continue;
|
||||
|
||||
last_intersect = card;
|
||||
|
@ -148,12 +148,12 @@ ErrorOr<void> CardStack::add_all_grabbed_cards(Gfx::IntPoint click_location, Non
|
|||
last_intersect->set_moving(true);
|
||||
}
|
||||
|
||||
if (card.is_upside_down()) {
|
||||
if (card->is_upside_down()) {
|
||||
grabbed.clear();
|
||||
return {};
|
||||
}
|
||||
|
||||
card.set_moving(true);
|
||||
card->set_moving(true);
|
||||
TRY(grabbed.try_append(card));
|
||||
}
|
||||
}
|
||||
|
@ -173,28 +173,28 @@ ErrorOr<void> CardStack::add_all_grabbed_cards(Gfx::IntPoint click_location, Non
|
|||
bool color_match;
|
||||
switch (movement_rule) {
|
||||
case MovementRule::Alternating:
|
||||
color_match = card.color() != last_color;
|
||||
color_match = card->color() != last_color;
|
||||
break;
|
||||
case MovementRule::Same:
|
||||
color_match = card.color() == last_color;
|
||||
color_match = card->color() == last_color;
|
||||
break;
|
||||
case MovementRule::Any:
|
||||
color_match = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!color_match || to_underlying(card.rank()) != last_value - 1) {
|
||||
if (!color_match || to_underlying(card->rank()) != last_value - 1) {
|
||||
valid_stack = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
last_value = to_underlying(card.rank());
|
||||
last_color = card.color();
|
||||
last_value = to_underlying(card->rank());
|
||||
last_color = card->color();
|
||||
}
|
||||
|
||||
if (!valid_stack) {
|
||||
for (auto& card : grabbed) {
|
||||
card.set_moving(false);
|
||||
card->set_moving(false);
|
||||
}
|
||||
grabbed.clear();
|
||||
}
|
||||
|
@ -257,9 +257,9 @@ bool CardStack::preview_card(Gfx::IntPoint click_location)
|
|||
RefPtr<Card> last_intersect;
|
||||
|
||||
for (auto& card : m_stack) {
|
||||
if (!card.rect().contains(click_location))
|
||||
if (!card->rect().contains(click_location))
|
||||
continue;
|
||||
if (card.is_upside_down())
|
||||
if (card->is_upside_down())
|
||||
continue;
|
||||
|
||||
last_intersect = card;
|
||||
|
@ -275,7 +275,7 @@ bool CardStack::preview_card(Gfx::IntPoint click_location)
|
|||
void CardStack::clear_card_preview()
|
||||
{
|
||||
for (auto& card : m_stack)
|
||||
card.set_previewed(false);
|
||||
card->set_previewed(false);
|
||||
}
|
||||
|
||||
bool CardStack::make_top_card_visible()
|
||||
|
@ -350,7 +350,7 @@ void CardStack::calculate_bounding_box()
|
|||
size_t card_position = 0;
|
||||
for (auto& card : m_stack) {
|
||||
if (card_position % m_rules.step == 0 && card_position != 0) {
|
||||
if (card.is_upside_down()) {
|
||||
if (card->is_upside_down()) {
|
||||
width += m_rules.shift_x;
|
||||
height += m_rules.shift_y_upside_down;
|
||||
} else {
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
|
||||
bool is_empty() const { return m_stack.is_empty(); }
|
||||
Type type() const { return m_type; }
|
||||
NonnullRefPtrVector<Card> const& stack() const { return m_stack; }
|
||||
Vector<NonnullRefPtr<Card>> const& stack() const { return m_stack; }
|
||||
size_t count() const { return m_stack.size(); }
|
||||
Card const& peek() const { return m_stack.last(); }
|
||||
Card& peek() { return m_stack.last(); }
|
||||
|
@ -49,7 +49,7 @@ public:
|
|||
void rebound_cards();
|
||||
|
||||
bool is_allowed_to_push(Card const&, size_t stack_size = 1, MovementRule movement_rule = MovementRule::Alternating) const;
|
||||
ErrorOr<void> add_all_grabbed_cards(Gfx::IntPoint click_location, NonnullRefPtrVector<Card>& grabbed, MovementRule movement_rule = MovementRule::Alternating);
|
||||
ErrorOr<void> add_all_grabbed_cards(Gfx::IntPoint click_location, Vector<NonnullRefPtr<Card>>& grabbed, MovementRule movement_rule = MovementRule::Alternating);
|
||||
|
||||
bool preview_card(Gfx::IntPoint click_location);
|
||||
void clear_card_preview();
|
||||
|
@ -91,7 +91,7 @@ private:
|
|||
// eg, in Solitaire the Play stack is positioned over the Waste stack.
|
||||
RefPtr<CardStack> m_covered_stack;
|
||||
|
||||
NonnullRefPtrVector<Card> m_stack;
|
||||
Vector<NonnullRefPtr<Card>> m_stack;
|
||||
Vector<Gfx::IntPoint> m_stack_positions;
|
||||
Gfx::IntPoint m_position;
|
||||
Gfx::IntRect m_bounding_box;
|
||||
|
|
|
@ -199,9 +199,9 @@ Vector<StringView> CppComprehensionEngine::scope_of_reference_to_symbol(ASTNode
|
|||
Vector<StringView> scope_parts;
|
||||
for (auto& scope_part : name->scope()) {
|
||||
// If the target node is part of a scope reference, we want to end the scope chain before it.
|
||||
if (&scope_part == &node)
|
||||
if (scope_part == &node)
|
||||
break;
|
||||
scope_parts.append(scope_part.name());
|
||||
scope_parts.append(scope_part->name());
|
||||
}
|
||||
return scope_parts;
|
||||
}
|
||||
|
@ -263,8 +263,8 @@ DeprecatedString CppComprehensionEngine::type_of_variable(Identifier const& iden
|
|||
ASTNode const* current = &identifier;
|
||||
while (current) {
|
||||
for (auto& decl : current->declarations()) {
|
||||
if (decl.is_variable_or_parameter_declaration()) {
|
||||
auto& var_or_param = verify_cast<VariableOrParameterDeclaration>(decl);
|
||||
if (decl->is_variable_or_parameter_declaration()) {
|
||||
auto& var_or_param = verify_cast<VariableOrParameterDeclaration>(*decl);
|
||||
if (var_or_param.full_name() == identifier.name() && var_or_param.type()->is_named_type()) {
|
||||
VERIFY(verify_cast<NamedType>(*var_or_param.type()).name());
|
||||
if (verify_cast<NamedType>(*var_or_param.type()).name())
|
||||
|
@ -326,7 +326,7 @@ Vector<CppComprehensionEngine::Symbol> CppComprehensionEngine::properties_of_typ
|
|||
Vector<StringView> scope(type_symbol.scope);
|
||||
scope.append(type_symbol.name);
|
||||
// FIXME: We don't have to create the Symbol here, it should already exist in the 'm_symbol' table of some DocumentData we already parsed.
|
||||
properties.append(Symbol::create(member.full_name(), scope, member, Symbol::IsLocal::No));
|
||||
properties.append(Symbol::create(member->full_name(), scope, member, Symbol::IsLocal::No));
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
@ -346,16 +346,16 @@ Vector<CppComprehensionEngine::Symbol> CppComprehensionEngine::get_child_symbols
|
|||
Vector<Symbol> symbols;
|
||||
|
||||
for (auto& decl : node.declarations()) {
|
||||
symbols.append(Symbol::create(decl.full_name(), scope, decl, is_local));
|
||||
symbols.append(Symbol::create(decl->full_name(), scope, decl, is_local));
|
||||
|
||||
bool should_recurse = decl.is_namespace() || decl.is_struct_or_class() || decl.is_function();
|
||||
bool are_child_symbols_local = decl.is_function();
|
||||
bool should_recurse = decl->is_namespace() || decl->is_struct_or_class() || decl->is_function();
|
||||
bool are_child_symbols_local = decl->is_function();
|
||||
|
||||
if (!should_recurse)
|
||||
continue;
|
||||
|
||||
auto new_scope = scope;
|
||||
new_scope.append(decl.full_name());
|
||||
new_scope.append(decl->full_name());
|
||||
symbols.extend(get_child_symbols(decl, new_scope, are_child_symbols_local ? Symbol::IsLocal::Yes : is_local));
|
||||
}
|
||||
|
||||
|
@ -864,7 +864,7 @@ Optional<CodeComprehensionEngine::FunctionParamsHint> CppComprehensionEngine::ge
|
|||
|
||||
Optional<size_t> invoked_arg_index;
|
||||
for (size_t arg_index = 0; arg_index < call_node->arguments().size(); ++arg_index) {
|
||||
if (&call_node->arguments()[arg_index] == node.ptr()) {
|
||||
if (call_node->arguments()[arg_index] == node.ptr()) {
|
||||
invoked_arg_index = arg_index;
|
||||
break;
|
||||
}
|
||||
|
@ -920,7 +920,7 @@ Optional<CppComprehensionEngine::FunctionParamsHint> CppComprehensionEngine::get
|
|||
hint.current_index = argument_index;
|
||||
for (auto& arg : func_decl.parameters()) {
|
||||
Vector<StringView> tokens_text;
|
||||
for (auto token : document_of_declaration->parser().tokens_in_range(arg.start(), arg.end())) {
|
||||
for (auto token : document_of_declaration->parser().tokens_in_range(arg->start(), arg->end())) {
|
||||
tokens_text.append(token.text());
|
||||
}
|
||||
hint.params.append(DeprecatedString::join(' ', tokens_text));
|
||||
|
|
|
@ -48,7 +48,7 @@ Object::~Object()
|
|||
// NOTE: We also unparent the children, so that they won't try to unparent
|
||||
// themselves in their own destructors.
|
||||
for (auto& child : children)
|
||||
child.m_parent = nullptr;
|
||||
child->m_parent = nullptr;
|
||||
|
||||
all_objects().remove(*this);
|
||||
stop_timer();
|
||||
|
@ -103,7 +103,7 @@ void Object::insert_child_before(Object& new_child, Object& before_child)
|
|||
void Object::remove_child(Object& object)
|
||||
{
|
||||
for (size_t i = 0; i < m_children.size(); ++i) {
|
||||
if (m_children.ptr_at(i).ptr() == &object) {
|
||||
if (m_children[i] == &object) {
|
||||
// NOTE: We protect the child so it survives the handling of ChildRemoved.
|
||||
NonnullRefPtr<Object> protector = object;
|
||||
object.m_parent = nullptr;
|
||||
|
@ -119,7 +119,7 @@ void Object::remove_child(Object& object)
|
|||
void Object::remove_all_children()
|
||||
{
|
||||
while (!m_children.is_empty())
|
||||
m_children.first().remove_from_parent();
|
||||
m_children.first()->remove_from_parent();
|
||||
}
|
||||
|
||||
void Object::timer_event(Core::TimerEvent&)
|
||||
|
|
|
@ -112,14 +112,14 @@ public:
|
|||
DeprecatedString const& name() const { return m_name; }
|
||||
void set_name(DeprecatedString name) { m_name = move(name); }
|
||||
|
||||
NonnullRefPtrVector<Object>& children() { return m_children; }
|
||||
NonnullRefPtrVector<Object> const& children() const { return m_children; }
|
||||
Vector<NonnullRefPtr<Object>>& children() { return m_children; }
|
||||
Vector<NonnullRefPtr<Object>> const& children() const { return m_children; }
|
||||
|
||||
template<typename Callback>
|
||||
void for_each_child(Callback callback)
|
||||
{
|
||||
for (auto& child : m_children) {
|
||||
if (callback(child) == IterationDecision::Break)
|
||||
if (callback(*child) == IterationDecision::Break)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ private:
|
|||
int m_timer_id { 0 };
|
||||
unsigned m_inspector_count { 0 };
|
||||
HashMap<DeprecatedString, NonnullOwnPtr<Property>> m_properties;
|
||||
NonnullRefPtrVector<Object> m_children;
|
||||
Vector<NonnullRefPtr<Object>> m_children;
|
||||
Function<bool(Core::Event&)> m_event_filter;
|
||||
};
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ void TranslationUnit::dump(FILE* output, size_t indent) const
|
|||
{
|
||||
ASTNode::dump(output, indent);
|
||||
for (auto const& child : m_declarations) {
|
||||
child.dump(output, indent + 1);
|
||||
child->dump(output, indent + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ void FunctionDeclaration::dump(FILE* output, size_t indent) const
|
|||
print_indent(output, indent + 1);
|
||||
outln(output, "(");
|
||||
for (auto const& arg : m_parameters) {
|
||||
arg.dump(output, indent + 1);
|
||||
arg->dump(output, indent + 1);
|
||||
}
|
||||
print_indent(output, indent + 1);
|
||||
outln(output, ")");
|
||||
|
@ -55,9 +55,9 @@ void FunctionDeclaration::dump(FILE* output, size_t indent) const
|
|||
}
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<Declaration const> FunctionDeclaration::declarations() const
|
||||
Vector<NonnullRefPtr<Declaration const>> FunctionDeclaration::declarations() const
|
||||
{
|
||||
NonnullRefPtrVector<Declaration const> declarations;
|
||||
Vector<NonnullRefPtr<Declaration const>> declarations;
|
||||
for (auto& arg : m_parameters) {
|
||||
declarations.append(arg);
|
||||
}
|
||||
|
@ -124,11 +124,11 @@ DeprecatedString FunctionType::to_deprecated_string() const
|
|||
first = false;
|
||||
else
|
||||
builder.append(", "sv);
|
||||
if (parameter.type())
|
||||
builder.append(parameter.type()->to_deprecated_string());
|
||||
if (parameter.name() && !parameter.full_name().is_empty()) {
|
||||
if (parameter->type())
|
||||
builder.append(parameter->type()->to_deprecated_string());
|
||||
if (parameter->name() && !parameter->full_name().is_empty()) {
|
||||
builder.append(' ');
|
||||
builder.append(parameter.full_name());
|
||||
builder.append(parameter->full_name());
|
||||
}
|
||||
}
|
||||
builder.append(')');
|
||||
|
@ -156,17 +156,17 @@ void FunctionDefinition::dump(FILE* output, size_t indent) const
|
|||
print_indent(output, indent);
|
||||
outln(output, "{{");
|
||||
for (auto const& statement : m_statements) {
|
||||
statement.dump(output, indent + 1);
|
||||
statement->dump(output, indent + 1);
|
||||
}
|
||||
print_indent(output, indent);
|
||||
outln(output, "}}");
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<Declaration const> FunctionDefinition::declarations() const
|
||||
Vector<NonnullRefPtr<Declaration const>> FunctionDefinition::declarations() const
|
||||
{
|
||||
NonnullRefPtrVector<Declaration const> declarations;
|
||||
Vector<NonnullRefPtr<Declaration const>> declarations;
|
||||
for (auto& statement : m_statements) {
|
||||
declarations.extend(statement.declarations());
|
||||
declarations.extend(statement->declarations());
|
||||
}
|
||||
return declarations;
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ void FunctionCall::dump(FILE* output, size_t indent) const
|
|||
ASTNode::dump(output, indent);
|
||||
m_callee->dump(output, indent + 1);
|
||||
for (auto const& arg : m_arguments) {
|
||||
arg.dump(output, indent + 1);
|
||||
arg->dump(output, indent + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -338,7 +338,7 @@ void StructOrClassDeclaration::dump(FILE* output, size_t indent) const
|
|||
outln(output, ":");
|
||||
for (size_t i = 0; i < m_baseclasses.size(); ++i) {
|
||||
auto& baseclass = m_baseclasses[i];
|
||||
baseclass.dump(output, indent + 1);
|
||||
baseclass->dump(output, indent + 1);
|
||||
if (i < m_baseclasses.size() - 1) {
|
||||
print_indent(output, indent + 1);
|
||||
outln(output, ",");
|
||||
|
@ -347,12 +347,12 @@ void StructOrClassDeclaration::dump(FILE* output, size_t indent) const
|
|||
}
|
||||
outln(output, "");
|
||||
for (auto& member : m_members) {
|
||||
member.dump(output, indent + 1);
|
||||
member->dump(output, indent + 1);
|
||||
}
|
||||
}
|
||||
NonnullRefPtrVector<Declaration const> StructOrClassDeclaration::declarations() const
|
||||
Vector<NonnullRefPtr<Declaration const>> StructOrClassDeclaration::declarations() const
|
||||
{
|
||||
NonnullRefPtrVector<Declaration const> declarations;
|
||||
Vector<NonnullRefPtr<Declaration const>> declarations;
|
||||
for (auto& member : m_members)
|
||||
declarations.append(member);
|
||||
return declarations;
|
||||
|
@ -425,7 +425,7 @@ void FunctionType::dump(FILE* output, size_t indent) const
|
|||
print_indent(output, indent + 1);
|
||||
outln("(");
|
||||
for (auto& parameter : m_parameters)
|
||||
parameter.dump(output, indent + 2);
|
||||
parameter->dump(output, indent + 2);
|
||||
print_indent(output, indent + 1);
|
||||
outln(")");
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ void BlockStatement::dump(FILE* output, size_t indent) const
|
|||
{
|
||||
ASTNode::dump(output, indent);
|
||||
for (auto& statement : m_statements) {
|
||||
statement.dump(output, indent + 1);
|
||||
statement->dump(output, indent + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -458,10 +458,10 @@ void ForStatement::dump(FILE* output, size_t indent) const
|
|||
m_body->dump(output, indent + 1);
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<Declaration const> Statement::declarations() const
|
||||
Vector<NonnullRefPtr<Declaration const>> Statement::declarations() const
|
||||
{
|
||||
if (is_declaration()) {
|
||||
NonnullRefPtrVector<Declaration const> vec;
|
||||
Vector<NonnullRefPtr<Declaration const>> vec;
|
||||
auto const& decl = static_cast<Declaration const&>(*this);
|
||||
vec.empend(const_cast<Declaration&>(decl));
|
||||
return vec;
|
||||
|
@ -469,9 +469,9 @@ NonnullRefPtrVector<Declaration const> Statement::declarations() const
|
|||
return {};
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<Declaration const> ForStatement::declarations() const
|
||||
Vector<NonnullRefPtr<Declaration const>> ForStatement::declarations() const
|
||||
{
|
||||
NonnullRefPtrVector<Declaration const> declarations;
|
||||
Vector<NonnullRefPtr<Declaration const>> declarations;
|
||||
if (m_init)
|
||||
declarations.extend(m_init->declarations());
|
||||
if (m_body)
|
||||
|
@ -479,11 +479,11 @@ NonnullRefPtrVector<Declaration const> ForStatement::declarations() const
|
|||
return declarations;
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<Declaration const> BlockStatement::declarations() const
|
||||
Vector<NonnullRefPtr<Declaration const>> BlockStatement::declarations() const
|
||||
{
|
||||
NonnullRefPtrVector<Declaration const> declarations;
|
||||
Vector<NonnullRefPtr<Declaration const>> declarations;
|
||||
for (auto& statement : m_statements) {
|
||||
declarations.extend(statement.declarations());
|
||||
declarations.extend(statement->declarations());
|
||||
}
|
||||
return declarations;
|
||||
}
|
||||
|
@ -508,9 +508,9 @@ void IfStatement::dump(FILE* output, size_t indent) const
|
|||
}
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<Declaration const> IfStatement::declarations() const
|
||||
Vector<NonnullRefPtr<Declaration const>> IfStatement::declarations() const
|
||||
{
|
||||
NonnullRefPtrVector<Declaration const> declarations;
|
||||
Vector<NonnullRefPtr<Declaration const>> declarations;
|
||||
if (m_predicate)
|
||||
declarations.extend(m_predicate->declarations());
|
||||
if (m_then)
|
||||
|
@ -526,7 +526,7 @@ void NamespaceDeclaration::dump(FILE* output, size_t indent) const
|
|||
print_indent(output, indent + 1);
|
||||
outln(output, "{}", full_name());
|
||||
for (auto& decl : m_declarations)
|
||||
decl.dump(output, indent + 1);
|
||||
decl->dump(output, indent + 1);
|
||||
}
|
||||
|
||||
void NullPointerLiteral::dump(FILE* output, size_t indent) const
|
||||
|
@ -549,7 +549,7 @@ StringView Name::full_name() const
|
|||
StringBuilder builder;
|
||||
if (!m_scope.is_empty()) {
|
||||
for (auto& scope : m_scope) {
|
||||
builder.appendff("{}::", scope.name());
|
||||
builder.appendff("{}::", scope->name());
|
||||
}
|
||||
}
|
||||
m_full_name = DeprecatedString::formatted("{}{}", builder.to_deprecated_string(), m_name.is_null() ? ""sv : m_name->name());
|
||||
|
@ -565,7 +565,7 @@ StringView TemplatizedName::full_name() const
|
|||
name.append(Name::full_name());
|
||||
name.append('<');
|
||||
for (auto& type : m_template_arguments) {
|
||||
name.append(type.to_deprecated_string());
|
||||
name.append(type->to_deprecated_string());
|
||||
}
|
||||
name.append('>');
|
||||
m_full_name = name.to_deprecated_string();
|
||||
|
@ -601,7 +601,7 @@ void BracedInitList::dump(FILE* output, size_t indent) const
|
|||
{
|
||||
ASTNode::dump(output, indent);
|
||||
for (auto& exp : m_expressions) {
|
||||
exp.dump(output, indent + 1);
|
||||
exp->dump(output, indent + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -621,7 +621,7 @@ void Constructor::dump(FILE* output, size_t indent) const
|
|||
print_indent(output, indent + 1);
|
||||
outln(output, "(");
|
||||
for (auto const& arg : parameters()) {
|
||||
arg.dump(output, indent + 1);
|
||||
arg->dump(output, indent + 1);
|
||||
}
|
||||
print_indent(output, indent + 1);
|
||||
outln(output, ")");
|
||||
|
@ -637,7 +637,7 @@ void Destructor::dump(FILE* output, size_t indent) const
|
|||
print_indent(output, indent + 1);
|
||||
outln(output, "(");
|
||||
for (auto const& arg : parameters()) {
|
||||
arg.dump(output, indent + 1);
|
||||
arg->dump(output, indent + 1);
|
||||
}
|
||||
print_indent(output, indent + 1);
|
||||
outln(output, ")");
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
void set_end(Position const& end) { m_end = end; }
|
||||
void set_parent(ASTNode const& parent) { m_parent = &parent; }
|
||||
|
||||
virtual NonnullRefPtrVector<Declaration const> declarations() const { return {}; }
|
||||
virtual Vector<NonnullRefPtr<Declaration const>> declarations() const { return {}; }
|
||||
|
||||
virtual bool is_identifier() const { return false; }
|
||||
virtual bool is_member_expression() const { return false; }
|
||||
|
@ -87,17 +87,17 @@ public:
|
|||
virtual ~TranslationUnit() override = default;
|
||||
virtual StringView class_name() const override { return "TranslationUnit"sv; }
|
||||
virtual void dump(FILE* = stdout, size_t indent = 0) const override;
|
||||
virtual NonnullRefPtrVector<Declaration const> declarations() const override { return m_declarations; }
|
||||
virtual Vector<NonnullRefPtr<Declaration const>> declarations() const override { return m_declarations; }
|
||||
|
||||
TranslationUnit(ASTNode const* parent, Optional<Position> start, Optional<Position> end, DeprecatedString const& filename)
|
||||
: ASTNode(parent, start, end, filename)
|
||||
{
|
||||
}
|
||||
|
||||
void set_declarations(NonnullRefPtrVector<Declaration const>&& declarations) { m_declarations = move(declarations); }
|
||||
void set_declarations(Vector<NonnullRefPtr<Declaration const>>&& declarations) { m_declarations = move(declarations); }
|
||||
|
||||
private:
|
||||
NonnullRefPtrVector<Declaration const> m_declarations;
|
||||
Vector<NonnullRefPtr<Declaration const>> m_declarations;
|
||||
};
|
||||
|
||||
class Statement : public ASTNode {
|
||||
|
@ -105,7 +105,7 @@ public:
|
|||
virtual ~Statement() override = default;
|
||||
virtual StringView class_name() const override { return "Statement"sv; }
|
||||
|
||||
virtual NonnullRefPtrVector<Declaration const> declarations() const override;
|
||||
virtual Vector<NonnullRefPtr<Declaration const>> declarations() const override;
|
||||
|
||||
protected:
|
||||
Statement(ASTNode const* parent, Optional<Position> start, Optional<Position> end, DeprecatedString const& filename)
|
||||
|
@ -167,20 +167,20 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual NonnullRefPtrVector<Declaration const> declarations() const override;
|
||||
virtual Vector<NonnullRefPtr<Declaration const>> declarations() const override;
|
||||
Vector<StringView> const& qualifiers() const { return m_qualifiers; }
|
||||
void set_qualifiers(Vector<StringView> const& qualifiers) { m_qualifiers = qualifiers; }
|
||||
Type const* return_type() const { return m_return_type.ptr(); }
|
||||
void set_return_type(RefPtr<Type const> const& return_type) { m_return_type = return_type; }
|
||||
NonnullRefPtrVector<Parameter const> const& parameters() const { return m_parameters; }
|
||||
void set_parameters(NonnullRefPtrVector<Parameter const> const& parameters) { m_parameters = parameters; }
|
||||
Vector<NonnullRefPtr<Parameter const>> const& parameters() const { return m_parameters; }
|
||||
void set_parameters(Vector<NonnullRefPtr<Parameter const>> const& parameters) { m_parameters = parameters; }
|
||||
FunctionDefinition const* definition() const { return m_definition.ptr(); }
|
||||
void set_definition(RefPtr<FunctionDefinition const>&& definition) { m_definition = move(definition); }
|
||||
|
||||
private:
|
||||
Vector<StringView> m_qualifiers;
|
||||
RefPtr<Type const> m_return_type;
|
||||
NonnullRefPtrVector<Parameter const> m_parameters;
|
||||
Vector<NonnullRefPtr<Parameter const>> m_parameters;
|
||||
RefPtr<FunctionDefinition const> m_definition;
|
||||
};
|
||||
|
||||
|
@ -325,11 +325,11 @@ public:
|
|||
}
|
||||
|
||||
void set_return_type(Type& type) { m_return_type = type; }
|
||||
void set_parameters(NonnullRefPtrVector<Parameter const> parameters) { m_parameters = move(parameters); }
|
||||
void set_parameters(Vector<NonnullRefPtr<Parameter const>> parameters) { m_parameters = move(parameters); }
|
||||
|
||||
private:
|
||||
RefPtr<Type const> m_return_type;
|
||||
NonnullRefPtrVector<Parameter const> m_parameters;
|
||||
Vector<NonnullRefPtr<Parameter const>> m_parameters;
|
||||
};
|
||||
|
||||
class FunctionDefinition : public ASTNode {
|
||||
|
@ -343,12 +343,12 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual NonnullRefPtrVector<Declaration const> declarations() const override;
|
||||
NonnullRefPtrVector<Statement const> const& statements() { return m_statements; }
|
||||
virtual Vector<NonnullRefPtr<Declaration const>> declarations() const override;
|
||||
Vector<NonnullRefPtr<Statement const>> const& statements() { return m_statements; }
|
||||
void add_statement(NonnullRefPtr<Statement const>&& statement) { m_statements.append(move(statement)); }
|
||||
|
||||
private:
|
||||
NonnullRefPtrVector<Statement const> m_statements;
|
||||
Vector<NonnullRefPtr<Statement const>> m_statements;
|
||||
};
|
||||
|
||||
class InvalidStatement : public Statement {
|
||||
|
@ -444,13 +444,13 @@ public:
|
|||
|
||||
Identifier const* name() const { return m_name.ptr(); }
|
||||
void set_name(RefPtr<Identifier const>&& name) { m_name = move(name); }
|
||||
NonnullRefPtrVector<Identifier const> const& scope() const { return m_scope; }
|
||||
void set_scope(NonnullRefPtrVector<Identifier const> scope) { m_scope = move(scope); }
|
||||
Vector<NonnullRefPtr<Identifier const>> const& scope() const { return m_scope; }
|
||||
void set_scope(Vector<NonnullRefPtr<Identifier const>> scope) { m_scope = move(scope); }
|
||||
void add_to_scope(NonnullRefPtr<Identifier const>&& part) { m_scope.append(move(part)); }
|
||||
|
||||
private:
|
||||
RefPtr<Identifier const> m_name;
|
||||
NonnullRefPtrVector<Identifier const> m_scope;
|
||||
Vector<NonnullRefPtr<Identifier const>> m_scope;
|
||||
mutable Optional<DeprecatedString> m_full_name;
|
||||
};
|
||||
|
||||
|
@ -469,7 +469,7 @@ public:
|
|||
void add_template_argument(NonnullRefPtr<Type const>&& type) { m_template_arguments.append(move(type)); }
|
||||
|
||||
private:
|
||||
NonnullRefPtrVector<Type const> m_template_arguments;
|
||||
Vector<NonnullRefPtr<Type const>> m_template_arguments;
|
||||
mutable Optional<DeprecatedString> m_full_name;
|
||||
};
|
||||
|
||||
|
@ -609,11 +609,11 @@ public:
|
|||
void set_callee(RefPtr<Expression const>&& callee) { m_callee = move(callee); }
|
||||
|
||||
void add_argument(NonnullRefPtr<Expression const>&& arg) { m_arguments.append(move(arg)); }
|
||||
NonnullRefPtrVector<Expression const> const& arguments() const { return m_arguments; }
|
||||
Vector<NonnullRefPtr<Expression const>> const& arguments() const { return m_arguments; }
|
||||
|
||||
private:
|
||||
RefPtr<Expression const> m_callee;
|
||||
NonnullRefPtrVector<Expression const> m_arguments;
|
||||
Vector<NonnullRefPtr<Expression const>> m_arguments;
|
||||
};
|
||||
|
||||
class StringLiteral final : public Expression {
|
||||
|
@ -689,7 +689,7 @@ public:
|
|||
virtual bool is_struct_or_class() const override { return true; }
|
||||
virtual bool is_struct() const override { return m_type == Type::Struct; }
|
||||
virtual bool is_class() const override { return m_type == Type::Class; }
|
||||
virtual NonnullRefPtrVector<Declaration const> declarations() const override;
|
||||
virtual Vector<NonnullRefPtr<Declaration const>> declarations() const override;
|
||||
|
||||
enum class Type {
|
||||
Struct,
|
||||
|
@ -702,16 +702,16 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<Declaration const> const& members() const { return m_members; }
|
||||
void set_members(NonnullRefPtrVector<Declaration const>&& members) { m_members = move(members); }
|
||||
Vector<NonnullRefPtr<Declaration const>> const& members() const { return m_members; }
|
||||
void set_members(Vector<NonnullRefPtr<Declaration const>>&& members) { m_members = move(members); }
|
||||
|
||||
NonnullRefPtrVector<Name const> const& baseclasses() const { return m_baseclasses; }
|
||||
void set_baseclasses(NonnullRefPtrVector<Name const>&& baseclasses) { m_baseclasses = move(baseclasses); }
|
||||
Vector<NonnullRefPtr<Name const>> const& baseclasses() const { return m_baseclasses; }
|
||||
void set_baseclasses(Vector<NonnullRefPtr<Name const>>&& baseclasses) { m_baseclasses = move(baseclasses); }
|
||||
|
||||
private:
|
||||
StructOrClassDeclaration::Type m_type;
|
||||
NonnullRefPtrVector<Declaration const> m_members;
|
||||
NonnullRefPtrVector<Name const> m_baseclasses;
|
||||
Vector<NonnullRefPtr<Declaration const>> m_members;
|
||||
Vector<NonnullRefPtr<Name const>> m_baseclasses;
|
||||
};
|
||||
|
||||
enum class UnaryOp {
|
||||
|
@ -776,7 +776,7 @@ public:
|
|||
virtual StringView class_name() const override { return "ForStatement"sv; }
|
||||
virtual void dump(FILE* = stdout, size_t indent = 0) const override;
|
||||
|
||||
virtual NonnullRefPtrVector<Declaration const> declarations() const override;
|
||||
virtual Vector<NonnullRefPtr<Declaration const>> declarations() const override;
|
||||
|
||||
void set_init(RefPtr<VariableDeclaration const>&& init) { m_init = move(init); }
|
||||
void set_test(RefPtr<Expression const>&& test) { m_test = move(test); }
|
||||
|
@ -802,12 +802,12 @@ public:
|
|||
virtual StringView class_name() const override { return "BlockStatement"sv; }
|
||||
virtual void dump(FILE* = stdout, size_t indent = 0) const override;
|
||||
|
||||
virtual NonnullRefPtrVector<Declaration const> declarations() const override;
|
||||
virtual Vector<NonnullRefPtr<Declaration const>> declarations() const override;
|
||||
|
||||
void add_statement(NonnullRefPtr<Statement const>&& statement) { m_statements.append(move(statement)); }
|
||||
|
||||
private:
|
||||
NonnullRefPtrVector<Statement const> m_statements;
|
||||
Vector<NonnullRefPtr<Statement const>> m_statements;
|
||||
};
|
||||
|
||||
class Comment final : public Statement {
|
||||
|
@ -831,7 +831,7 @@ public:
|
|||
virtual ~IfStatement() override = default;
|
||||
virtual StringView class_name() const override { return "IfStatement"sv; }
|
||||
virtual void dump(FILE* = stdout, size_t indent = 0) const override;
|
||||
virtual NonnullRefPtrVector<Declaration const> declarations() const override;
|
||||
virtual Vector<NonnullRefPtr<Declaration const>> declarations() const override;
|
||||
|
||||
void set_predicate(RefPtr<Expression const>&& predicate) { m_predicate = move(predicate); }
|
||||
void set_then_statement(RefPtr<Statement const>&& then) { m_then = move(then); }
|
||||
|
@ -858,11 +858,11 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual NonnullRefPtrVector<Declaration const> declarations() const override { return m_declarations; }
|
||||
virtual Vector<NonnullRefPtr<Declaration const>> declarations() const override { return m_declarations; }
|
||||
void add_declaration(NonnullRefPtr<Declaration const>&& declaration) { m_declarations.append(move(declaration)); }
|
||||
|
||||
private:
|
||||
NonnullRefPtrVector<Declaration const> m_declarations;
|
||||
Vector<NonnullRefPtr<Declaration const>> m_declarations;
|
||||
};
|
||||
|
||||
class CppCastExpression : public Expression {
|
||||
|
@ -936,7 +936,7 @@ public:
|
|||
void add_expression(NonnullRefPtr<Expression const>&& exp) { m_expressions.append(move(exp)); }
|
||||
|
||||
private:
|
||||
NonnullRefPtrVector<Expression const> m_expressions;
|
||||
Vector<NonnullRefPtr<Expression const>> m_expressions;
|
||||
};
|
||||
|
||||
class DummyAstNode : public ASTNode {
|
||||
|
|
|
@ -37,9 +37,9 @@ NonnullRefPtr<TranslationUnit> Parser::parse()
|
|||
return unit;
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<Declaration const> Parser::parse_declarations_in_translation_unit(ASTNode const& parent)
|
||||
Vector<NonnullRefPtr<Declaration const>> Parser::parse_declarations_in_translation_unit(ASTNode const& parent)
|
||||
{
|
||||
NonnullRefPtrVector<Declaration const> declarations;
|
||||
Vector<NonnullRefPtr<Declaration const>> declarations;
|
||||
while (!eof()) {
|
||||
auto declaration = parse_single_declaration_in_translation_unit(parent);
|
||||
if (declaration) {
|
||||
|
@ -259,13 +259,13 @@ bool Parser::match_template_arguments()
|
|||
return peek().type() == Token::Type::Greater;
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<Type const> Parser::parse_template_arguments(ASTNode const& parent)
|
||||
Vector<NonnullRefPtr<Type const>> Parser::parse_template_arguments(ASTNode const& parent)
|
||||
{
|
||||
LOG_SCOPE();
|
||||
|
||||
consume(Token::Type::Less);
|
||||
|
||||
NonnullRefPtrVector<Type const> template_arguments;
|
||||
Vector<NonnullRefPtr<Type const>> template_arguments;
|
||||
while (!eof() && peek().type() != Token::Type::Greater) {
|
||||
template_arguments.append(parse_type(parent));
|
||||
}
|
||||
|
@ -350,7 +350,7 @@ NonnullRefPtr<Expression const> Parser::parse_expression(ASTNode const& parent)
|
|||
return expression;
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<Expression const> secondary_expressions;
|
||||
Vector<NonnullRefPtr<Expression const>> secondary_expressions;
|
||||
|
||||
while (match_secondary_expression()) {
|
||||
// FIXME: Handle operator precedence
|
||||
|
@ -359,7 +359,7 @@ NonnullRefPtr<Expression const> Parser::parse_expression(ASTNode const& parent)
|
|||
}
|
||||
|
||||
for (size_t i = 0; secondary_expressions.size() != 0 && i < secondary_expressions.size() - 1; ++i) {
|
||||
const_cast<Expression&>(secondary_expressions[i]).set_parent(secondary_expressions[i + 1]);
|
||||
const_cast<Expression&>(*secondary_expressions[i]).set_parent(secondary_expressions[i + 1]);
|
||||
}
|
||||
|
||||
return expression;
|
||||
|
@ -748,10 +748,10 @@ bool Parser::match_function_declaration()
|
|||
return false;
|
||||
}
|
||||
|
||||
Optional<NonnullRefPtrVector<Parameter const>> Parser::parse_parameter_list(ASTNode const& parent)
|
||||
Optional<Vector<NonnullRefPtr<Parameter const>>> Parser::parse_parameter_list(ASTNode const& parent)
|
||||
{
|
||||
LOG_SCOPE();
|
||||
NonnullRefPtrVector<Parameter const> parameters;
|
||||
Vector<NonnullRefPtr<Parameter const>> parameters;
|
||||
while (peek().type() != Token::Type::RightParen && !eof()) {
|
||||
if (match_ellipsis()) {
|
||||
auto param = create_ast_node<Parameter>(parent, position(), {}, RefPtr<Name> {});
|
||||
|
@ -981,7 +981,7 @@ Optional<size_t> Parser::index_of_node_at(Position pos) const
|
|||
|
||||
for (size_t node_index = 0; node_index < m_nodes.size(); ++node_index) {
|
||||
auto& node = m_nodes[node_index];
|
||||
if (node.start() > pos || node.end() < pos)
|
||||
if (node->start() > pos || node->end() < pos)
|
||||
continue;
|
||||
|
||||
if (!match_node_index.has_value() || (node_span(node) <= node_span(m_nodes[match_node_index.value()])))
|
||||
|
@ -1155,7 +1155,7 @@ NonnullRefPtr<StructOrClassDeclaration const> Parser::parse_class_declaration(AS
|
|||
|
||||
auto has_final = match_keyword("final");
|
||||
|
||||
NonnullRefPtrVector<Name const> baseclasses;
|
||||
Vector<NonnullRefPtr<Name const>> baseclasses;
|
||||
|
||||
// FIXME: Don't ignore this.
|
||||
if (peek(has_final ? 1 : 0).type() == Token::Type::Colon) {
|
||||
|
@ -1569,11 +1569,11 @@ NonnullRefPtr<BracedInitList const> Parser::parse_braced_init_list(ASTNode const
|
|||
init_list->set_end(position());
|
||||
return init_list;
|
||||
}
|
||||
NonnullRefPtrVector<Declaration const> Parser::parse_class_members(StructOrClassDeclaration& parent)
|
||||
Vector<NonnullRefPtr<Declaration const>> Parser::parse_class_members(StructOrClassDeclaration& parent)
|
||||
{
|
||||
auto class_name = parent.full_name();
|
||||
|
||||
NonnullRefPtrVector<Declaration const> members;
|
||||
Vector<NonnullRefPtr<Declaration const>> members;
|
||||
while (!eof() && peek().type() != Token::Type::RightCurly) {
|
||||
if (match_access_specifier())
|
||||
consume_access_specifier(); // FIXME: Do not ignore access specifiers
|
||||
|
|
|
@ -83,7 +83,7 @@ private:
|
|||
bool match_destructor(StringView class_name);
|
||||
bool match_using_namespace_declaration();
|
||||
|
||||
Optional<NonnullRefPtrVector<Parameter const>> parse_parameter_list(ASTNode const& parent);
|
||||
Optional<Vector<NonnullRefPtr<Parameter const>>> parse_parameter_list(ASTNode const& parent);
|
||||
Optional<Token> consume_whitespace();
|
||||
void consume_preprocessor();
|
||||
|
||||
|
@ -110,15 +110,15 @@ private:
|
|||
NonnullRefPtr<Comment const> parse_comment(ASTNode const& parent);
|
||||
NonnullRefPtr<IfStatement const> parse_if_statement(ASTNode const& parent);
|
||||
NonnullRefPtr<NamespaceDeclaration const> parse_namespace_declaration(ASTNode const& parent, bool is_nested_namespace = false);
|
||||
NonnullRefPtrVector<Declaration const> parse_declarations_in_translation_unit(ASTNode const& parent);
|
||||
Vector<NonnullRefPtr<Declaration const>> parse_declarations_in_translation_unit(ASTNode const& parent);
|
||||
RefPtr<Declaration const> parse_single_declaration_in_translation_unit(ASTNode const& parent);
|
||||
NonnullRefPtrVector<Type const> parse_template_arguments(ASTNode const& parent);
|
||||
Vector<NonnullRefPtr<Type const>> parse_template_arguments(ASTNode const& parent);
|
||||
NonnullRefPtr<Name const> parse_name(ASTNode const& parent);
|
||||
NonnullRefPtr<CppCastExpression const> parse_cpp_cast_expression(ASTNode const& parent);
|
||||
NonnullRefPtr<SizeofExpression const> parse_sizeof_expression(ASTNode const& parent);
|
||||
NonnullRefPtr<BracedInitList const> parse_braced_init_list(ASTNode const& parent);
|
||||
NonnullRefPtr<CStyleCastExpression const> parse_c_style_cast_expression(ASTNode const& parent);
|
||||
NonnullRefPtrVector<Declaration const> parse_class_members(StructOrClassDeclaration& parent);
|
||||
Vector<NonnullRefPtr<Declaration const>> parse_class_members(StructOrClassDeclaration& parent);
|
||||
NonnullRefPtr<Constructor const> parse_constructor(ASTNode const& parent);
|
||||
NonnullRefPtr<Destructor const> parse_destructor(ASTNode const& parent);
|
||||
NonnullRefPtr<UsingNamespaceDeclaration const> parse_using_namespace_declaration(ASTNode const& parent);
|
||||
|
@ -138,7 +138,7 @@ private:
|
|||
|
||||
struct State {
|
||||
size_t token_index { 0 };
|
||||
NonnullRefPtrVector<ASTNode> state_nodes;
|
||||
Vector<NonnullRefPtr<ASTNode>> state_nodes;
|
||||
};
|
||||
|
||||
void error(StringView message = {});
|
||||
|
@ -192,7 +192,7 @@ private:
|
|||
Vector<State> m_saved_states;
|
||||
RefPtr<TranslationUnit> m_root_node;
|
||||
Vector<DeprecatedString> m_errors;
|
||||
NonnullRefPtrVector<ASTNode> m_nodes;
|
||||
Vector<NonnullRefPtr<ASTNode>> m_nodes;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -33,22 +33,22 @@ bool Track::check_processor_chain_valid_with_initial_type(SignalType initial_typ
|
|||
for (auto& processor : m_processor_chain) {
|
||||
// The first processor must have the given initial signal type as input.
|
||||
if (previous_processor == nullptr) {
|
||||
if (processor.input_type() != initial_type)
|
||||
if (processor->input_type() != initial_type)
|
||||
return false;
|
||||
} else if (previous_processor->output_type() != processor.input_type())
|
||||
} else if (previous_processor->output_type() != processor->input_type())
|
||||
return false;
|
||||
previous_processor = &processor;
|
||||
previous_processor = processor.ptr();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
NonnullRefPtr<Synthesizers::Classic> Track::synth()
|
||||
{
|
||||
return static_ptr_cast<Synthesizers::Classic>(m_processor_chain.ptr_at(0));
|
||||
return static_ptr_cast<Synthesizers::Classic>(m_processor_chain[0]);
|
||||
}
|
||||
NonnullRefPtr<Effects::Delay> Track::delay()
|
||||
{
|
||||
return static_ptr_cast<Effects::Delay>(m_processor_chain.ptr_at(1));
|
||||
return static_ptr_cast<Effects::Delay>(m_processor_chain[1]);
|
||||
}
|
||||
|
||||
bool AudioTrack::check_processor_chain_valid() const
|
||||
|
@ -81,11 +81,11 @@ void Track::current_signal(FixedArray<Sample>& output_signal)
|
|||
|
||||
for (auto& processor : m_processor_chain) {
|
||||
// Depending on what the processor needs to have as output, we need to place either a pre-allocated note hash map or a pre-allocated sample buffer in the target signal.
|
||||
if (processor.output_type() == SignalType::Note)
|
||||
if (processor->output_type() == SignalType::Note)
|
||||
target_signal = &m_secondary_note_buffer;
|
||||
else
|
||||
target_signal = &m_secondary_sample_buffer;
|
||||
processor.process(*source_signal, *target_signal);
|
||||
processor->process(*source_signal, *target_signal);
|
||||
swap(source_signal, target_signal);
|
||||
}
|
||||
VERIFY(source_signal->type() == SignalType::Sample);
|
||||
|
@ -109,9 +109,9 @@ void NoteTrack::compute_current_clips_signal()
|
|||
for (auto& clip : m_clips) {
|
||||
// A clip is playing if its start time or end time fall in the current time range.
|
||||
// Or, if they both enclose the current time range.
|
||||
if ((clip.start() <= start_time && clip.end() >= end_time)
|
||||
|| (clip.start() >= start_time && clip.start() < end_time)
|
||||
|| (clip.end() > start_time && clip.end() <= end_time)) {
|
||||
if ((clip->start() <= start_time && clip->end() >= end_time)
|
||||
|| (clip->start() >= start_time && clip->start() < end_time)
|
||||
|| (clip->end() > start_time && clip->end() <= end_time)) {
|
||||
VERIFY(playing_clips_index < playing_clips.size());
|
||||
playing_clips[playing_clips_index++] = clip;
|
||||
}
|
||||
|
@ -149,8 +149,8 @@ void AudioTrack::compute_current_clips_signal()
|
|||
Optional<RollNote> NoteTrack::note_at(u32 time, u8 pitch) const
|
||||
{
|
||||
for (auto& clip : m_clips) {
|
||||
if (time >= clip.start() && time <= clip.end())
|
||||
return clip.note_at(time, pitch);
|
||||
if (time >= clip->start() && time <= clip->end())
|
||||
return clip->note_at(time, pitch);
|
||||
}
|
||||
|
||||
return {};
|
||||
|
@ -159,15 +159,15 @@ Optional<RollNote> NoteTrack::note_at(u32 time, u8 pitch) const
|
|||
void NoteTrack::set_note(RollNote note)
|
||||
{
|
||||
for (auto& clip : m_clips) {
|
||||
if (clip.start() <= note.on_sample && clip.end() >= note.on_sample)
|
||||
clip.set_note(note);
|
||||
if (clip->start() <= note.on_sample && clip->end() >= note.on_sample)
|
||||
clip->set_note(note);
|
||||
}
|
||||
}
|
||||
|
||||
void NoteTrack::remove_note(RollNote note)
|
||||
{
|
||||
for (auto& clip : m_clips)
|
||||
clip.remove_note(note);
|
||||
clip->remove_note(note);
|
||||
}
|
||||
|
||||
void NoteTrack::add_clip(u32 start_time, u32 end_time)
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
// We are informed of an audio buffer size change. This happens off-audio-thread so we can allocate.
|
||||
ErrorOr<void> resize_internal_buffers_to(size_t buffer_size);
|
||||
|
||||
NonnullRefPtrVector<Processor> const& processor_chain() const { return m_processor_chain; }
|
||||
Vector<NonnullRefPtr<Processor>> const& processor_chain() const { return m_processor_chain; }
|
||||
NonnullRefPtr<Transport const> transport() const { return m_transport; }
|
||||
NonnullRefPtr<DSP::Effects::Mastering> track_mastering() { return m_track_mastering; }
|
||||
|
||||
|
@ -53,7 +53,7 @@ protected:
|
|||
// Subclasses override to provide the base signal to the processing chain
|
||||
virtual void compute_current_clips_signal() = 0;
|
||||
|
||||
NonnullRefPtrVector<Processor> m_processor_chain;
|
||||
Vector<NonnullRefPtr<Processor>> m_processor_chain;
|
||||
NonnullRefPtr<Transport> m_transport;
|
||||
NonnullRefPtr<Effects::Mastering> m_track_mastering;
|
||||
NonnullRefPtr<Keyboard> m_keyboard;
|
||||
|
@ -90,7 +90,7 @@ protected:
|
|||
void compute_current_clips_signal() override;
|
||||
|
||||
private:
|
||||
NonnullRefPtrVector<NoteClip> m_clips;
|
||||
Vector<NonnullRefPtr<NoteClip>> m_clips;
|
||||
};
|
||||
|
||||
class AudioTrack final : public Track {
|
||||
|
@ -103,13 +103,13 @@ public:
|
|||
}
|
||||
|
||||
bool check_processor_chain_valid() const override;
|
||||
NonnullRefPtrVector<AudioClip> const& clips() const { return m_clips; }
|
||||
Vector<NonnullRefPtr<AudioClip>> const& clips() const { return m_clips; }
|
||||
|
||||
protected:
|
||||
void compute_current_clips_signal() override;
|
||||
|
||||
private:
|
||||
NonnullRefPtrVector<AudioClip> m_clips;
|
||||
Vector<NonnullRefPtr<AudioClip>> m_clips;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -102,10 +102,10 @@ Vector<DeprecatedString> Launcher::get_handlers_for_url(const URL& url)
|
|||
return connection().get_handlers_for_url(url.to_deprecated_string());
|
||||
}
|
||||
|
||||
auto Launcher::get_handlers_with_details_for_url(const URL& url) -> NonnullRefPtrVector<Details>
|
||||
auto Launcher::get_handlers_with_details_for_url(const URL& url) -> Vector<NonnullRefPtr<Details>>
|
||||
{
|
||||
auto details = connection().get_handlers_with_details_for_url(url.to_deprecated_string());
|
||||
NonnullRefPtrVector<Details> handlers_with_details;
|
||||
Vector<NonnullRefPtr<Details>> handlers_with_details;
|
||||
for (auto& value : details) {
|
||||
handlers_with_details.append(Details::from_details_str(value));
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
static bool open(const URL&, DeprecatedString const& handler_name = {});
|
||||
static bool open(const URL&, Details const& details);
|
||||
static Vector<DeprecatedString> get_handlers_for_url(const URL&);
|
||||
static NonnullRefPtrVector<Details> get_handlers_with_details_for_url(const URL&);
|
||||
static Vector<NonnullRefPtr<Details>> get_handlers_with_details_for_url(const URL&);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -348,12 +348,12 @@ static void for_each_unfinished_dependency_of(DeprecatedString const& path, Hash
|
|||
callback(*s_loaders.get(path).value());
|
||||
}
|
||||
|
||||
static NonnullRefPtrVector<DynamicLoader> collect_loaders_for_library(DeprecatedString const& path)
|
||||
static Vector<NonnullRefPtr<DynamicLoader>> collect_loaders_for_library(DeprecatedString const& path)
|
||||
{
|
||||
VERIFY(path.starts_with('/'));
|
||||
|
||||
HashTable<DeprecatedString> seen_names;
|
||||
NonnullRefPtrVector<DynamicLoader> loaders;
|
||||
Vector<NonnullRefPtr<DynamicLoader>> loaders;
|
||||
for_each_unfinished_dependency_of(path, seen_names, [&](auto& loader) {
|
||||
loaders.append(loader);
|
||||
});
|
||||
|
@ -386,37 +386,37 @@ static Result<void, DlErrorMessage> link_main_library(DeprecatedString const& pa
|
|||
auto loaders = collect_loaders_for_library(path);
|
||||
|
||||
for (auto& loader : loaders) {
|
||||
auto dynamic_object = loader.map();
|
||||
auto dynamic_object = loader->map();
|
||||
if (dynamic_object)
|
||||
s_global_objects.set(dynamic_object->filepath(), *dynamic_object);
|
||||
}
|
||||
|
||||
for (auto& loader : loaders) {
|
||||
bool success = loader.link(flags);
|
||||
bool success = loader->link(flags);
|
||||
if (!success) {
|
||||
return DlErrorMessage { DeprecatedString::formatted("Failed to link library {}", loader.filepath()) };
|
||||
return DlErrorMessage { DeprecatedString::formatted("Failed to link library {}", loader->filepath()) };
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& loader : loaders) {
|
||||
auto result = loader.load_stage_3(flags);
|
||||
auto result = loader->load_stage_3(flags);
|
||||
VERIFY(!result.is_error());
|
||||
auto& object = result.value();
|
||||
|
||||
if (loader.filepath().ends_with("/libc.so"sv)) {
|
||||
if (loader->filepath().ends_with("/libc.so"sv)) {
|
||||
initialize_libc(*object);
|
||||
}
|
||||
|
||||
if (loader.filepath().ends_with("/libsystem.so"sv)) {
|
||||
VERIFY(!loader.text_segments().is_empty());
|
||||
for (auto const& segment : loader.text_segments()) {
|
||||
if (loader->filepath().ends_with("/libsystem.so"sv)) {
|
||||
VERIFY(!loader->text_segments().is_empty());
|
||||
for (auto const& segment : loader->text_segments()) {
|
||||
auto flags = static_cast<int>(VirtualMemoryRangeFlags::SyscallCode) | static_cast<int>(VirtualMemoryRangeFlags::Immutable);
|
||||
if (syscall(SC_annotate_mapping, segment.address().get(), flags)) {
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (auto const& segment : loader.text_segments()) {
|
||||
for (auto const& segment : loader->text_segments()) {
|
||||
auto flags = static_cast<int>(VirtualMemoryRangeFlags::Immutable);
|
||||
if (syscall(SC_annotate_mapping, segment.address().get(), flags)) {
|
||||
VERIFY_NOT_REACHED();
|
||||
|
@ -428,7 +428,7 @@ static Result<void, DlErrorMessage> link_main_library(DeprecatedString const& pa
|
|||
drop_loader_promise("prot_exec"sv);
|
||||
|
||||
for (auto& loader : loaders) {
|
||||
loader.load_stage_4();
|
||||
loader->load_stage_4();
|
||||
}
|
||||
|
||||
return {};
|
||||
|
|
|
@ -152,7 +152,7 @@ public:
|
|||
class Object : public ValueNode {
|
||||
public:
|
||||
Object() = default;
|
||||
Object(DeprecatedString name, NonnullRefPtrVector<Node const> properties, NonnullRefPtrVector<Node const> sub_objects)
|
||||
Object(DeprecatedString name, Vector<NonnullRefPtr<Node const>> properties, Vector<NonnullRefPtr<Node const>> sub_objects)
|
||||
: m_properties(move(properties))
|
||||
, m_sub_objects(move(sub_objects))
|
||||
, m_name(move(name))
|
||||
|
@ -182,7 +182,7 @@ public:
|
|||
{
|
||||
for (auto const& child : m_properties) {
|
||||
if (is<KeyValuePair>(child)) {
|
||||
auto const& property = static_cast<KeyValuePair const&>(child);
|
||||
auto const& property = static_cast<KeyValuePair const&>(*child);
|
||||
if (property.key() != "layout" && is<JsonValueNode>(property.value().ptr()))
|
||||
callback(property.key(), static_ptr_cast<JsonValueNode>(property.value()));
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ public:
|
|||
for (auto const& child : m_sub_objects) {
|
||||
// doesn't capture layout as intended, as that's behind a kv-pair
|
||||
if (is<Object>(child)) {
|
||||
TRY(callback(static_cast<Object const&>(child)));
|
||||
TRY(callback(static_cast<Object const&>(*child)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,7 @@ public:
|
|||
{
|
||||
for (auto const& child : m_properties) {
|
||||
if (is<KeyValuePair>(child)) {
|
||||
auto const& property = static_cast<KeyValuePair const&>(child);
|
||||
auto const& property = static_cast<KeyValuePair const&>(*child);
|
||||
if (property.key() == "layout") {
|
||||
VERIFY(is<Object>(property.value().ptr()));
|
||||
return static_cast<Object const&>(*property.value());
|
||||
|
@ -232,7 +232,7 @@ public:
|
|||
{
|
||||
for (auto const& child : m_properties) {
|
||||
if (is<KeyValuePair>(child)) {
|
||||
auto const& property = static_cast<KeyValuePair const&>(child);
|
||||
auto const& property = static_cast<KeyValuePair const&>(*child);
|
||||
if (property.key() == property_name)
|
||||
return property.value();
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ public:
|
|||
builder.append('\n');
|
||||
|
||||
for (auto const& property : m_properties)
|
||||
property.format(builder, indentation + 1, false);
|
||||
property->format(builder, indentation + 1, false);
|
||||
|
||||
if (!m_properties.is_empty() && !m_sub_objects.is_empty())
|
||||
builder.append('\n');
|
||||
|
@ -259,7 +259,7 @@ public:
|
|||
// This loop is necessary as we need to know what the last child is.
|
||||
for (size_t i = 0; i < m_sub_objects.size(); ++i) {
|
||||
auto const& child = m_sub_objects[i];
|
||||
child.format(builder, indentation + 1, false);
|
||||
child->format(builder, indentation + 1, false);
|
||||
|
||||
if (is<Object>(child) && i != m_sub_objects.size() - 1)
|
||||
builder.append('\n');
|
||||
|
@ -274,9 +274,9 @@ public:
|
|||
|
||||
private:
|
||||
// Properties and comments
|
||||
NonnullRefPtrVector<Node const> m_properties;
|
||||
Vector<NonnullRefPtr<Node const>> m_properties;
|
||||
// Sub objects and comments
|
||||
NonnullRefPtrVector<Node const> m_sub_objects;
|
||||
Vector<NonnullRefPtr<Node const>> m_sub_objects;
|
||||
DeprecatedString m_name {};
|
||||
};
|
||||
|
||||
|
@ -304,18 +304,18 @@ public:
|
|||
|
||||
bool has_main_class() const { return m_main_class != nullptr; }
|
||||
|
||||
NonnullRefPtrVector<Comment const> leading_comments() const { return m_leading_comments; }
|
||||
Vector<NonnullRefPtr<Comment const>> leading_comments() const { return m_leading_comments; }
|
||||
Object const& main_class() const
|
||||
{
|
||||
VERIFY(!m_main_class.is_null());
|
||||
return *m_main_class.ptr();
|
||||
}
|
||||
NonnullRefPtrVector<Comment const> trailing_comments() const { return m_trailing_comments; }
|
||||
Vector<NonnullRefPtr<Comment const>> trailing_comments() const { return m_trailing_comments; }
|
||||
|
||||
virtual void format(StringBuilder& builder, size_t indentation, [[maybe_unused]] bool is_inline) const override
|
||||
{
|
||||
for (auto const& comment : m_leading_comments)
|
||||
comment.format(builder, indentation, false);
|
||||
comment->format(builder, indentation, false);
|
||||
|
||||
if (!m_leading_comments.is_empty())
|
||||
builder.append('\n');
|
||||
|
@ -324,13 +324,13 @@ public:
|
|||
builder.append('\n');
|
||||
|
||||
for (auto const& comment : m_trailing_comments)
|
||||
comment.format(builder, indentation, false);
|
||||
comment->format(builder, indentation, false);
|
||||
}
|
||||
|
||||
private:
|
||||
NonnullRefPtrVector<Comment const> m_leading_comments;
|
||||
Vector<NonnullRefPtr<Comment const>> m_leading_comments;
|
||||
RefPtr<Object const> m_main_class;
|
||||
NonnullRefPtrVector<Comment const> m_trailing_comments;
|
||||
Vector<NonnullRefPtr<Comment const>> m_trailing_comments;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ static ErrorOr<NonnullRefPtr<Object>> parse_gml_object(Queue<Token>& tokens)
|
|||
|
||||
tokens.dequeue();
|
||||
|
||||
NonnullRefPtrVector<Comment> pending_comments;
|
||||
Vector<NonnullRefPtr<Comment>> pending_comments;
|
||||
for (;;) {
|
||||
if (peek() == Token::Type::RightCurly) {
|
||||
// End of object
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
private:
|
||||
Menubar() = default;
|
||||
|
||||
NonnullRefPtrVector<Menu> m_menus;
|
||||
Vector<NonnullRefPtr<Menu>> m_menus;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -63,46 +63,46 @@ void Statusbar::set_segment_count(size_t count)
|
|||
void Statusbar::update_segment(size_t index)
|
||||
{
|
||||
auto& segment = m_segments.at(index);
|
||||
if (segment.mode() == Segment::Mode::Auto) {
|
||||
if (segment.restored_text().is_empty())
|
||||
segment.set_visible(false);
|
||||
if (segment->mode() == Segment::Mode::Auto) {
|
||||
if (segment->restored_text().is_empty())
|
||||
segment->set_visible(false);
|
||||
else {
|
||||
constexpr auto horizontal_padding { 10 };
|
||||
auto width = font().width(segment.restored_text()) + horizontal_padding;
|
||||
segment.set_restored_width(width);
|
||||
segment.set_fixed_width(width);
|
||||
auto width = font().width(segment->restored_text()) + horizontal_padding;
|
||||
segment->set_restored_width(width);
|
||||
segment->set_fixed_width(width);
|
||||
}
|
||||
} else if (segment.mode() == Segment::Mode::Fixed) {
|
||||
if (segment.max_width().is_int()) {
|
||||
segment.set_restored_width(segment.max_width().as_int());
|
||||
segment.set_fixed_width(segment.max_width());
|
||||
} else if (segment->mode() == Segment::Mode::Fixed) {
|
||||
if (segment->max_width().is_int()) {
|
||||
segment->set_restored_width(segment->max_width().as_int());
|
||||
segment->set_fixed_width(segment->max_width());
|
||||
}
|
||||
}
|
||||
|
||||
if (segment.override_text().is_null()) {
|
||||
if (segment->override_text().is_null()) {
|
||||
for (size_t i = 1; i < m_segments.size(); i++) {
|
||||
if (!text(i).is_empty())
|
||||
m_segments[i].set_visible(true);
|
||||
m_segments[i]->set_visible(true);
|
||||
}
|
||||
segment.set_text(String::from_utf8(segment.restored_text()).release_value_but_fixme_should_propagate_errors());
|
||||
segment.set_frame_shape(Gfx::FrameShape::Panel);
|
||||
if (segment.mode() != Segment::Mode::Proportional)
|
||||
segment.set_fixed_width(segment.restored_width());
|
||||
segment->set_text(String::from_utf8(segment->restored_text()).release_value_but_fixme_should_propagate_errors());
|
||||
segment->set_frame_shape(Gfx::FrameShape::Panel);
|
||||
if (segment->mode() != Segment::Mode::Proportional)
|
||||
segment->set_fixed_width(segment->restored_width());
|
||||
} else {
|
||||
for (size_t i = 1; i < m_segments.size(); i++) {
|
||||
if (!m_segments[i].is_clickable())
|
||||
m_segments[i].set_visible(false);
|
||||
if (!m_segments[i]->is_clickable())
|
||||
m_segments[i]->set_visible(false);
|
||||
}
|
||||
segment.set_text(String::from_utf8(segment.override_text()).release_value_but_fixme_should_propagate_errors());
|
||||
segment.set_frame_shape(Gfx::FrameShape::NoFrame);
|
||||
if (segment.mode() != Segment::Mode::Proportional)
|
||||
segment.set_fixed_width(SpecialDimension::Grow);
|
||||
segment->set_text(String::from_utf8(segment->override_text()).release_value_but_fixme_should_propagate_errors());
|
||||
segment->set_frame_shape(Gfx::FrameShape::NoFrame);
|
||||
if (segment->mode() != Segment::Mode::Proportional)
|
||||
segment->set_fixed_width(SpecialDimension::Grow);
|
||||
}
|
||||
}
|
||||
|
||||
DeprecatedString Statusbar::text(size_t index) const
|
||||
{
|
||||
return m_segments.at(index).text().to_deprecated_string();
|
||||
return m_segments[index]->text().to_deprecated_string();
|
||||
}
|
||||
|
||||
void Statusbar::set_text(DeprecatedString text)
|
||||
|
@ -112,13 +112,13 @@ void Statusbar::set_text(DeprecatedString text)
|
|||
|
||||
void Statusbar::set_text(size_t index, DeprecatedString text)
|
||||
{
|
||||
m_segments.at(index).m_restored_text = move(text);
|
||||
m_segments[index]->m_restored_text = move(text);
|
||||
update_segment(index);
|
||||
}
|
||||
|
||||
void Statusbar::set_override_text(DeprecatedString override_text)
|
||||
{
|
||||
m_segments.at(0).m_override_text = move(override_text);
|
||||
m_segments[0]->m_override_text = move(override_text);
|
||||
update_segment(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ private:
|
|||
|
||||
virtual void child_event(Core::ChildEvent&) override;
|
||||
|
||||
NonnullRefPtrVector<Segment> m_segments;
|
||||
Vector<NonnullRefPtr<Segment>> m_segments;
|
||||
RefPtr<ResizeCorner> m_corner;
|
||||
};
|
||||
|
||||
|
|
|
@ -414,7 +414,7 @@ private:
|
|||
RefPtr<Action> m_select_all_action;
|
||||
RefPtr<Action> m_insert_emoji_action;
|
||||
Core::ElapsedTimer m_triple_click_timer;
|
||||
NonnullRefPtrVector<Action> m_custom_context_menu_actions;
|
||||
Vector<NonnullRefPtr<Action>> m_custom_context_menu_actions;
|
||||
|
||||
size_t m_reflow_deferred { 0 };
|
||||
bool m_reflow_requested { false };
|
||||
|
|
|
@ -32,12 +32,12 @@ ModelIndex TreeViewModel::parent_index(ModelIndex const& index) const
|
|||
return {};
|
||||
if (parent_node->parent_node() == nullptr) {
|
||||
for (size_t row = 0; row < m_nodes.size(); row++)
|
||||
if (m_nodes.ptr_at(row).ptr() == parent_node)
|
||||
if (m_nodes[row] == parent_node)
|
||||
return create_index(static_cast<int>(row), 0, parent_node);
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
for (size_t row = 0; row < parent_node->parent_node()->child_nodes().size(); row++) {
|
||||
auto const* child_node_at_row = parent_node->parent_node()->child_nodes().ptr_at(row).ptr();
|
||||
auto const* child_node_at_row = parent_node->parent_node()->child_nodes()[row].ptr();
|
||||
if (child_node_at_row == parent_node)
|
||||
return create_index(static_cast<int>(row), 0, parent_node);
|
||||
}
|
||||
|
|
|
@ -59,18 +59,18 @@ public:
|
|||
Node const* parent_node() const { return m_parent_node; }
|
||||
Node* parent_node() { return m_parent_node; }
|
||||
|
||||
NonnullRefPtrVector<Node> const& child_nodes() const { return m_child_nodes; }
|
||||
NonnullRefPtrVector<Node>& child_nodes() { return m_child_nodes; }
|
||||
Vector<NonnullRefPtr<Node>> const& child_nodes() const { return m_child_nodes; }
|
||||
Vector<NonnullRefPtr<Node>>& child_nodes() { return m_child_nodes; }
|
||||
|
||||
private:
|
||||
DeprecatedString m_text;
|
||||
Optional<Icon> m_icon;
|
||||
WeakPtr<Node> m_parent_node;
|
||||
NonnullRefPtrVector<Node> m_child_nodes;
|
||||
Vector<NonnullRefPtr<Node>> m_child_nodes;
|
||||
};
|
||||
|
||||
NonnullRefPtrVector<Node> const& nodes() const { return m_nodes; }
|
||||
NonnullRefPtrVector<Node>& nodes() { return m_nodes; }
|
||||
Vector<NonnullRefPtr<Node>> const& nodes() const { return m_nodes; }
|
||||
Vector<NonnullRefPtr<Node>>& nodes() { return m_nodes; }
|
||||
|
||||
template<typename NodeType = Node, typename... Args>
|
||||
NonnullRefPtr<NodeType> add_node(DeprecatedString text, Optional<Icon> icon, Args&&... args)
|
||||
|
@ -86,7 +86,7 @@ public:
|
|||
private:
|
||||
TreeViewModel() = default;
|
||||
|
||||
NonnullRefPtrVector<Node> m_nodes;
|
||||
Vector<NonnullRefPtr<Node>> m_nodes;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -702,7 +702,7 @@ Widget* Widget::child_at(Gfx::IntPoint point) const
|
|||
for (int i = children().size() - 1; i >= 0; --i) {
|
||||
if (!is<Widget>(children()[i]))
|
||||
continue;
|
||||
auto& child = verify_cast<Widget>(children()[i]);
|
||||
auto& child = verify_cast<Widget>(*children()[i]);
|
||||
if (!child.is_visible())
|
||||
continue;
|
||||
if (child.relative_non_grabbable_rect().contains(point))
|
||||
|
@ -976,7 +976,7 @@ bool Widget::is_frontmost() const
|
|||
auto* parent = parent_widget();
|
||||
if (!parent)
|
||||
return true;
|
||||
return &parent->children().last() == this;
|
||||
return parent->children().last() == this;
|
||||
}
|
||||
|
||||
bool Widget::is_backmost() const
|
||||
|
@ -984,7 +984,7 @@ bool Widget::is_backmost() const
|
|||
auto* parent = parent_widget();
|
||||
if (!parent)
|
||||
return true;
|
||||
return &parent->children().first() == this;
|
||||
return parent->children().first() == this;
|
||||
}
|
||||
|
||||
Action* Widget::action_for_shortcut(Shortcut const& shortcut)
|
||||
|
@ -1036,8 +1036,8 @@ Vector<Widget&> Widget::child_widgets() const
|
|||
Vector<Widget&> widgets;
|
||||
widgets.ensure_capacity(children().size());
|
||||
for (auto& child : const_cast<Widget*>(this)->children()) {
|
||||
if (is<Widget>(child))
|
||||
widgets.append(static_cast<Widget&>(child));
|
||||
if (is<Widget>(*child))
|
||||
widgets.append(static_cast<Widget&>(*child));
|
||||
}
|
||||
return widgets;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ WizardDialog::WizardDialog(Window* parent_window)
|
|||
void WizardDialog::push_page(AbstractWizardPage& page)
|
||||
{
|
||||
if (!m_page_stack.is_empty())
|
||||
m_page_stack.last().page_leave();
|
||||
m_page_stack.last()->page_leave();
|
||||
|
||||
m_page_stack.append(page);
|
||||
m_page_container_widget->remove_all_children();
|
||||
|
@ -111,7 +111,7 @@ void WizardDialog::pop_page()
|
|||
m_page_container_widget->add_child(m_page_stack.last());
|
||||
|
||||
update_navigation();
|
||||
m_page_stack.last().page_enter();
|
||||
m_page_stack.last()->page_enter();
|
||||
}
|
||||
|
||||
void WizardDialog::update_navigation()
|
||||
|
|
|
@ -49,6 +49,6 @@ private:
|
|||
RefPtr<Button> m_next_button;
|
||||
RefPtr<Button> m_cancel_button;
|
||||
|
||||
NonnullRefPtrVector<AbstractWizardPage> m_page_stack;
|
||||
Vector<NonnullRefPtr<AbstractWizardPage>> m_page_stack;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -232,52 +232,52 @@ void AntiAliasingPainter::stroke_path(Path const& path, Color color, float thick
|
|||
Optional<FloatLine> first_line;
|
||||
|
||||
for (auto& segment : path.segments()) {
|
||||
switch (segment.type()) {
|
||||
switch (segment->type()) {
|
||||
case Segment::Type::Invalid:
|
||||
VERIFY_NOT_REACHED();
|
||||
case Segment::Type::MoveTo:
|
||||
cursor = segment.point();
|
||||
cursor = segment->point();
|
||||
break;
|
||||
case Segment::Type::LineTo:
|
||||
draw_line(cursor, segment.point(), color, thickness);
|
||||
draw_line(cursor, segment->point(), color, thickness);
|
||||
if (thickness > 1) {
|
||||
if (!first_line.has_value())
|
||||
first_line = FloatLine(cursor, segment.point());
|
||||
first_line = FloatLine(cursor, segment->point());
|
||||
if (previous_was_line)
|
||||
stroke_segment_intersection(cursor, segment.point(), last_line, color, thickness);
|
||||
stroke_segment_intersection(cursor, segment->point(), last_line, color, thickness);
|
||||
last_line.set_a(cursor);
|
||||
last_line.set_b(segment.point());
|
||||
last_line.set_b(segment->point());
|
||||
}
|
||||
cursor = segment.point();
|
||||
cursor = segment->point();
|
||||
break;
|
||||
case Segment::Type::QuadraticBezierCurveTo: {
|
||||
auto through = static_cast<QuadraticBezierCurveSegment const&>(segment).through();
|
||||
draw_quadratic_bezier_curve(through, cursor, segment.point(), color, thickness);
|
||||
cursor = segment.point();
|
||||
auto through = static_cast<QuadraticBezierCurveSegment const&>(*segment).through();
|
||||
draw_quadratic_bezier_curve(through, cursor, segment->point(), color, thickness);
|
||||
cursor = segment->point();
|
||||
break;
|
||||
}
|
||||
case Segment::Type::CubicBezierCurveTo: {
|
||||
auto& curve = static_cast<CubicBezierCurveSegment const&>(segment);
|
||||
auto& curve = static_cast<CubicBezierCurveSegment const&>(*segment);
|
||||
auto through_0 = curve.through_0();
|
||||
auto through_1 = curve.through_1();
|
||||
draw_cubic_bezier_curve(through_0, through_1, cursor, segment.point(), color, thickness);
|
||||
cursor = segment.point();
|
||||
draw_cubic_bezier_curve(through_0, through_1, cursor, segment->point(), color, thickness);
|
||||
cursor = segment->point();
|
||||
break;
|
||||
}
|
||||
case Segment::Type::EllipticalArcTo:
|
||||
auto& arc = static_cast<EllipticalArcSegment const&>(segment);
|
||||
draw_elliptical_arc(cursor, segment.point(), arc.center(), arc.radii(), arc.x_axis_rotation(), arc.theta_1(), arc.theta_delta(), color, thickness);
|
||||
cursor = segment.point();
|
||||
auto& arc = static_cast<EllipticalArcSegment const&>(*segment);
|
||||
draw_elliptical_arc(cursor, segment->point(), arc.center(), arc.radii(), arc.x_axis_rotation(), arc.theta_1(), arc.theta_delta(), color, thickness);
|
||||
cursor = segment->point();
|
||||
break;
|
||||
}
|
||||
|
||||
previous_was_line = segment.type() == Segment::Type::LineTo;
|
||||
previous_was_line = segment->type() == Segment::Type::LineTo;
|
||||
}
|
||||
|
||||
// Check if the figure was started and closed as line at the same position.
|
||||
if (thickness > 1 && previous_was_line && path.segments().size() >= 2 && path.segments().first().point() == cursor
|
||||
&& (path.segments().first().type() == Segment::Type::LineTo
|
||||
|| (path.segments().first().type() == Segment::Type::MoveTo && path.segments()[1].type() == Segment::Type::LineTo))) {
|
||||
if (thickness > 1 && previous_was_line && path.segments().size() >= 2 && path.segments().first()->point() == cursor
|
||||
&& (path.segments().first()->type() == Segment::Type::LineTo
|
||||
|| (path.segments().first()->type() == Segment::Type::MoveTo && path.segments()[1]->type() == Segment::Type::LineTo))) {
|
||||
stroke_segment_intersection(first_line.value().a(), first_line.value().b(), last_line, color, thickness);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2356,35 +2356,35 @@ void Painter::stroke_path(Path const& path, Color color, int thickness)
|
|||
FloatPoint cursor;
|
||||
|
||||
for (auto& segment : path.segments()) {
|
||||
switch (segment.type()) {
|
||||
switch (segment->type()) {
|
||||
case Segment::Type::Invalid:
|
||||
VERIFY_NOT_REACHED();
|
||||
break;
|
||||
case Segment::Type::MoveTo:
|
||||
cursor = segment.point();
|
||||
cursor = segment->point();
|
||||
break;
|
||||
case Segment::Type::LineTo:
|
||||
draw_line(cursor.to_type<int>(), segment.point().to_type<int>(), color, thickness);
|
||||
cursor = segment.point();
|
||||
draw_line(cursor.to_type<int>(), segment->point().to_type<int>(), color, thickness);
|
||||
cursor = segment->point();
|
||||
break;
|
||||
case Segment::Type::QuadraticBezierCurveTo: {
|
||||
auto through = static_cast<QuadraticBezierCurveSegment const&>(segment).through();
|
||||
draw_quadratic_bezier_curve(through.to_type<int>(), cursor.to_type<int>(), segment.point().to_type<int>(), color, thickness);
|
||||
cursor = segment.point();
|
||||
auto through = static_cast<QuadraticBezierCurveSegment const&>(*segment).through();
|
||||
draw_quadratic_bezier_curve(through.to_type<int>(), cursor.to_type<int>(), segment->point().to_type<int>(), color, thickness);
|
||||
cursor = segment->point();
|
||||
break;
|
||||
}
|
||||
case Segment::Type::CubicBezierCurveTo: {
|
||||
auto& curve = static_cast<CubicBezierCurveSegment const&>(segment);
|
||||
auto& curve = static_cast<CubicBezierCurveSegment const&>(*segment);
|
||||
auto through_0 = curve.through_0();
|
||||
auto through_1 = curve.through_1();
|
||||
draw_cubic_bezier_curve(through_0.to_type<int>(), through_1.to_type<int>(), cursor.to_type<int>(), segment.point().to_type<int>(), color, thickness);
|
||||
cursor = segment.point();
|
||||
draw_cubic_bezier_curve(through_0.to_type<int>(), through_1.to_type<int>(), cursor.to_type<int>(), segment->point().to_type<int>(), color, thickness);
|
||||
cursor = segment->point();
|
||||
break;
|
||||
}
|
||||
case Segment::Type::EllipticalArcTo:
|
||||
auto& arc = static_cast<EllipticalArcSegment const&>(segment);
|
||||
draw_elliptical_arc(cursor.to_type<int>(), segment.point().to_type<int>(), arc.center().to_type<int>(), arc.radii(), arc.x_axis_rotation(), arc.theta_1(), arc.theta_delta(), color, thickness);
|
||||
cursor = segment.point();
|
||||
auto& arc = static_cast<EllipticalArcSegment const&>(*segment);
|
||||
draw_elliptical_arc(cursor.to_type<int>(), segment->point().to_type<int>(), arc.center().to_type<int>(), arc.radii(), arc.x_axis_rotation(), arc.theta_1(), arc.theta_delta(), color, thickness);
|
||||
cursor = segment->point();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ void Path::elliptical_arc_to(FloatPoint point, FloatSize radii, double x_axis_ro
|
|||
// Find the last point
|
||||
FloatPoint last_point { 0, 0 };
|
||||
if (!m_segments.is_empty())
|
||||
last_point = m_segments.last().point();
|
||||
last_point = m_segments.last()->point();
|
||||
|
||||
// Step 1 of out-of-range radii correction
|
||||
if (rx == 0.0 || ry == 0.0) {
|
||||
|
@ -120,14 +120,14 @@ void Path::close()
|
|||
if (m_segments.size() <= 1)
|
||||
return;
|
||||
|
||||
auto last_point = m_segments.last().point();
|
||||
auto last_point = m_segments.last()->point();
|
||||
|
||||
for (ssize_t i = m_segments.size() - 1; i >= 0; --i) {
|
||||
auto& segment = m_segments[i];
|
||||
if (segment.type() == Segment::Type::MoveTo) {
|
||||
if (last_point == segment.point())
|
||||
if (segment->type() == Segment::Type::MoveTo) {
|
||||
if (last_point == segment->point())
|
||||
return;
|
||||
append_segment<LineSegment>(segment.point());
|
||||
append_segment<LineSegment>(segment->point());
|
||||
invalidate_split_lines();
|
||||
return;
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ void Path::close_all_subpaths()
|
|||
bool is_first_point_in_subpath { false };
|
||||
|
||||
for (auto& segment : m_segments) {
|
||||
switch (segment.type()) {
|
||||
switch (segment->type()) {
|
||||
case Segment::Type::MoveTo: {
|
||||
if (cursor.has_value() && !is_first_point_in_subpath) {
|
||||
// This is a move from a subpath to another
|
||||
|
@ -157,7 +157,7 @@ void Path::close_all_subpaths()
|
|||
append_segment<LineSegment>(start_of_subpath.value());
|
||||
}
|
||||
is_first_point_in_subpath = true;
|
||||
cursor = segment.point();
|
||||
cursor = segment->point();
|
||||
break;
|
||||
}
|
||||
case Segment::Type::LineTo:
|
||||
|
@ -168,7 +168,7 @@ void Path::close_all_subpaths()
|
|||
start_of_subpath = cursor;
|
||||
is_first_point_in_subpath = false;
|
||||
}
|
||||
cursor = segment.point();
|
||||
cursor = segment->point();
|
||||
break;
|
||||
case Segment::Type::Invalid:
|
||||
VERIFY_NOT_REACHED();
|
||||
|
@ -182,7 +182,7 @@ DeprecatedString Path::to_deprecated_string() const
|
|||
StringBuilder builder;
|
||||
builder.append("Path { "sv);
|
||||
for (auto& segment : m_segments) {
|
||||
switch (segment.type()) {
|
||||
switch (segment->type()) {
|
||||
case Segment::Type::MoveTo:
|
||||
builder.append("MoveTo"sv);
|
||||
break;
|
||||
|
@ -202,21 +202,21 @@ DeprecatedString Path::to_deprecated_string() const
|
|||
builder.append("Invalid"sv);
|
||||
break;
|
||||
}
|
||||
builder.appendff("({}", segment.point());
|
||||
builder.appendff("({}", segment->point());
|
||||
|
||||
switch (segment.type()) {
|
||||
switch (segment->type()) {
|
||||
case Segment::Type::QuadraticBezierCurveTo:
|
||||
builder.append(", "sv);
|
||||
builder.append(static_cast<QuadraticBezierCurveSegment const&>(segment).through().to_deprecated_string());
|
||||
builder.append(static_cast<QuadraticBezierCurveSegment const&>(*segment).through().to_deprecated_string());
|
||||
break;
|
||||
case Segment::Type::CubicBezierCurveTo:
|
||||
builder.append(", "sv);
|
||||
builder.append(static_cast<CubicBezierCurveSegment const&>(segment).through_0().to_deprecated_string());
|
||||
builder.append(static_cast<CubicBezierCurveSegment const&>(*segment).through_0().to_deprecated_string());
|
||||
builder.append(", "sv);
|
||||
builder.append(static_cast<CubicBezierCurveSegment const&>(segment).through_1().to_deprecated_string());
|
||||
builder.append(static_cast<CubicBezierCurveSegment const&>(*segment).through_1().to_deprecated_string());
|
||||
break;
|
||||
case Segment::Type::EllipticalArcTo: {
|
||||
auto& arc = static_cast<EllipticalArcSegment const&>(segment);
|
||||
auto& arc = static_cast<EllipticalArcSegment const&>(*segment);
|
||||
builder.appendff(", {}, {}, {}, {}, {}",
|
||||
arc.radii().to_deprecated_string().characters(),
|
||||
arc.center().to_deprecated_string().characters(),
|
||||
|
@ -273,47 +273,47 @@ void Path::segmentize_path()
|
|||
bool first = true;
|
||||
|
||||
for (auto& segment : m_segments) {
|
||||
switch (segment.type()) {
|
||||
switch (segment->type()) {
|
||||
case Segment::Type::MoveTo:
|
||||
if (first) {
|
||||
min_x = segment.point().x();
|
||||
min_y = segment.point().y();
|
||||
max_x = segment.point().x();
|
||||
max_y = segment.point().y();
|
||||
min_x = segment->point().x();
|
||||
min_y = segment->point().y();
|
||||
max_x = segment->point().x();
|
||||
max_y = segment->point().y();
|
||||
} else {
|
||||
add_point_to_bbox(segment.point());
|
||||
add_point_to_bbox(segment->point());
|
||||
}
|
||||
cursor = segment.point();
|
||||
cursor = segment->point();
|
||||
break;
|
||||
case Segment::Type::LineTo: {
|
||||
add_line(cursor, segment.point());
|
||||
cursor = segment.point();
|
||||
add_line(cursor, segment->point());
|
||||
cursor = segment->point();
|
||||
break;
|
||||
}
|
||||
case Segment::Type::QuadraticBezierCurveTo: {
|
||||
auto control = static_cast<QuadraticBezierCurveSegment const&>(segment).through();
|
||||
Painter::for_each_line_segment_on_bezier_curve(control, cursor, segment.point(), [&](FloatPoint p0, FloatPoint p1) {
|
||||
auto control = static_cast<QuadraticBezierCurveSegment const&>(*segment).through();
|
||||
Painter::for_each_line_segment_on_bezier_curve(control, cursor, segment->point(), [&](FloatPoint p0, FloatPoint p1) {
|
||||
add_line(p0, p1);
|
||||
});
|
||||
cursor = segment.point();
|
||||
cursor = segment->point();
|
||||
break;
|
||||
}
|
||||
case Segment::Type::CubicBezierCurveTo: {
|
||||
auto& curve = static_cast<CubicBezierCurveSegment const&>(segment);
|
||||
auto& curve = static_cast<CubicBezierCurveSegment const&>(*segment);
|
||||
auto control_0 = curve.through_0();
|
||||
auto control_1 = curve.through_1();
|
||||
Painter::for_each_line_segment_on_cubic_bezier_curve(control_0, control_1, cursor, segment.point(), [&](FloatPoint p0, FloatPoint p1) {
|
||||
Painter::for_each_line_segment_on_cubic_bezier_curve(control_0, control_1, cursor, segment->point(), [&](FloatPoint p0, FloatPoint p1) {
|
||||
add_line(p0, p1);
|
||||
});
|
||||
cursor = segment.point();
|
||||
cursor = segment->point();
|
||||
break;
|
||||
}
|
||||
case Segment::Type::EllipticalArcTo: {
|
||||
auto& arc = static_cast<EllipticalArcSegment const&>(segment);
|
||||
auto& arc = static_cast<EllipticalArcSegment const&>(*segment);
|
||||
Painter::for_each_line_segment_on_elliptical_arc(cursor, arc.point(), arc.center(), arc.radii(), arc.x_axis_rotation(), arc.theta_1(), arc.theta_delta(), [&](FloatPoint p0, FloatPoint p1) {
|
||||
add_line(p0, p1);
|
||||
});
|
||||
cursor = segment.point();
|
||||
cursor = segment->point();
|
||||
break;
|
||||
}
|
||||
case Segment::Type::Invalid:
|
||||
|
@ -337,28 +337,28 @@ Path Path::copy_transformed(Gfx::AffineTransform const& transform) const
|
|||
Path result;
|
||||
|
||||
for (auto const& segment : m_segments) {
|
||||
switch (segment.type()) {
|
||||
switch (segment->type()) {
|
||||
case Segment::Type::MoveTo:
|
||||
result.move_to(transform.map(segment.point()));
|
||||
result.move_to(transform.map(segment->point()));
|
||||
break;
|
||||
case Segment::Type::LineTo: {
|
||||
result.line_to(transform.map(segment.point()));
|
||||
result.line_to(transform.map(segment->point()));
|
||||
break;
|
||||
}
|
||||
case Segment::Type::QuadraticBezierCurveTo: {
|
||||
auto const& quadratic_segment = static_cast<QuadraticBezierCurveSegment const&>(segment);
|
||||
result.quadratic_bezier_curve_to(transform.map(quadratic_segment.through()), transform.map(segment.point()));
|
||||
auto const& quadratic_segment = static_cast<QuadraticBezierCurveSegment const&>(*segment);
|
||||
result.quadratic_bezier_curve_to(transform.map(quadratic_segment.through()), transform.map(segment->point()));
|
||||
break;
|
||||
}
|
||||
case Segment::Type::CubicBezierCurveTo: {
|
||||
auto const& cubic_segment = static_cast<CubicBezierCurveSegment const&>(segment);
|
||||
result.cubic_bezier_curve_to(transform.map(cubic_segment.through_0()), transform.map(cubic_segment.through_1()), transform.map(segment.point()));
|
||||
auto const& cubic_segment = static_cast<CubicBezierCurveSegment const&>(*segment);
|
||||
result.cubic_bezier_curve_to(transform.map(cubic_segment.through_0()), transform.map(cubic_segment.through_1()), transform.map(segment->point()));
|
||||
break;
|
||||
}
|
||||
case Segment::Type::EllipticalArcTo: {
|
||||
auto const& arc_segment = static_cast<EllipticalArcSegment const&>(segment);
|
||||
auto const& arc_segment = static_cast<EllipticalArcSegment const&>(*segment);
|
||||
result.elliptical_arc_to(
|
||||
transform.map(segment.point()),
|
||||
transform.map(segment->point()),
|
||||
transform.map(arc_segment.center()),
|
||||
transform.map(arc_segment.radii()),
|
||||
arc_segment.x_axis_rotation(),
|
||||
|
|
|
@ -160,7 +160,7 @@ public:
|
|||
{
|
||||
float previous_y = 0;
|
||||
if (!m_segments.is_empty())
|
||||
previous_y = m_segments.last().point().y();
|
||||
previous_y = m_segments.last()->point().y();
|
||||
line_to({ x, previous_y });
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ public:
|
|||
{
|
||||
float previous_x = 0;
|
||||
if (!m_segments.is_empty())
|
||||
previous_x = m_segments.last().point().x();
|
||||
previous_x = m_segments.last()->point().x();
|
||||
line_to({ previous_x, y });
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,7 @@ public:
|
|||
float x;
|
||||
};
|
||||
|
||||
NonnullRefPtrVector<Segment const> const& segments() const { return m_segments; }
|
||||
Vector<NonnullRefPtr<Segment const>> const& segments() const { return m_segments; }
|
||||
auto& split_lines() const
|
||||
{
|
||||
if (!m_split_lines.has_value()) {
|
||||
|
@ -269,7 +269,7 @@ private:
|
|||
m_segments.append(adopt_ref(*new T(forward<Args>(args)...)));
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<Segment const> m_segments {};
|
||||
Vector<NonnullRefPtr<Segment const>> m_segments {};
|
||||
|
||||
Optional<Vector<SplitLineSegment>> m_split_lines {};
|
||||
Optional<Gfx::FloatRect> m_bounding_box;
|
||||
|
|
|
@ -166,7 +166,7 @@ Optional<Interface&> Parser::resolve_import(auto path)
|
|||
NonnullRefPtr<Type const> Parser::parse_type()
|
||||
{
|
||||
if (lexer.consume_specific('(')) {
|
||||
NonnullRefPtrVector<Type const> union_member_types;
|
||||
Vector<NonnullRefPtr<Type const>> union_member_types;
|
||||
union_member_types.append(parse_type());
|
||||
consume_whitespace();
|
||||
assert_string("or"sv);
|
||||
|
@ -203,7 +203,7 @@ NonnullRefPtr<Type const> Parser::parse_type()
|
|||
name = "long long"sv;
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<Type const> parameters;
|
||||
Vector<NonnullRefPtr<Type const>> parameters;
|
||||
bool is_parameterized_type = false;
|
||||
if (lexer.consume_specific('<')) {
|
||||
is_parameterized_type = true;
|
||||
|
|
|
@ -61,7 +61,7 @@ bool Type::includes_undefined() const
|
|||
// - the type is a union type and one of its member types includes undefined.
|
||||
if (is_union()) {
|
||||
for (auto& type : as_union().member_types()) {
|
||||
if (type.includes_undefined())
|
||||
if (type->includes_undefined())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ bool Type::is_distinguishable_from(IDL::Type const& other) const
|
|||
|
||||
for (auto& this_member_type : this_union.member_types()) {
|
||||
for (auto& other_member_type : other_union.member_types()) {
|
||||
if (!this_member_type.is_distinguishable_from(other_member_type))
|
||||
if (!this_member_type->is_distinguishable_from(other_member_type))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ int EffectiveOverloadSet::distinguishing_argument_index()
|
|||
|
||||
for (auto first_item_index = 0u; first_item_index < m_items.size(); ++first_item_index) {
|
||||
for (auto second_item_index = first_item_index + 1; second_item_index < m_items.size(); ++second_item_index) {
|
||||
if (!m_items[first_item_index].types[argument_index].is_distinguishable_from(m_items[second_item_index].types[argument_index])) {
|
||||
if (!m_items[first_item_index].types[argument_index]->is_distinguishable_from(m_items[second_item_index].types[argument_index])) {
|
||||
found_indistinguishable = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -222,7 +222,7 @@ class Interface;
|
|||
|
||||
class ParameterizedType : public Type {
|
||||
public:
|
||||
ParameterizedType(DeprecatedString name, bool nullable, NonnullRefPtrVector<Type const> parameters)
|
||||
ParameterizedType(DeprecatedString name, bool nullable, Vector<NonnullRefPtr<Type const>> parameters)
|
||||
: Type(Kind::Parameterized, move(name), nullable)
|
||||
, m_parameters(move(parameters))
|
||||
{
|
||||
|
@ -232,11 +232,11 @@ public:
|
|||
|
||||
void generate_sequence_from_iterable(SourceGenerator& generator, DeprecatedString const& cpp_name, DeprecatedString const& iterable_cpp_name, DeprecatedString const& iterator_method_cpp_name, IDL::Interface const&, size_t recursion_depth) const;
|
||||
|
||||
NonnullRefPtrVector<Type const> const& parameters() const { return m_parameters; }
|
||||
NonnullRefPtrVector<Type const>& parameters() { return m_parameters; }
|
||||
Vector<NonnullRefPtr<Type const>> const& parameters() const { return m_parameters; }
|
||||
Vector<NonnullRefPtr<Type const>>& parameters() { return m_parameters; }
|
||||
|
||||
private:
|
||||
NonnullRefPtrVector<Type const> m_parameters;
|
||||
Vector<NonnullRefPtr<Type const>> m_parameters;
|
||||
};
|
||||
|
||||
static inline size_t get_shortest_function_length(Vector<Function&> const& overload_set)
|
||||
|
@ -318,7 +318,7 @@ public:
|
|||
|
||||
class UnionType : public Type {
|
||||
public:
|
||||
UnionType(DeprecatedString name, bool nullable, NonnullRefPtrVector<Type const> member_types)
|
||||
UnionType(DeprecatedString name, bool nullable, Vector<NonnullRefPtr<Type const>> member_types)
|
||||
: Type(Kind::Union, move(name), nullable)
|
||||
, m_member_types(move(member_types))
|
||||
{
|
||||
|
@ -326,16 +326,16 @@ public:
|
|||
|
||||
virtual ~UnionType() override = default;
|
||||
|
||||
NonnullRefPtrVector<Type const> const& member_types() const { return m_member_types; }
|
||||
NonnullRefPtrVector<Type const>& member_types() { return m_member_types; }
|
||||
Vector<NonnullRefPtr<Type const>> const& member_types() const { return m_member_types; }
|
||||
Vector<NonnullRefPtr<Type const>>& member_types() { return m_member_types; }
|
||||
|
||||
// https://webidl.spec.whatwg.org/#dfn-flattened-union-member-types
|
||||
NonnullRefPtrVector<Type const> flattened_member_types() const
|
||||
Vector<NonnullRefPtr<Type const>> flattened_member_types() const
|
||||
{
|
||||
// 1. Let T be the union type.
|
||||
|
||||
// 2. Initialize S to ∅.
|
||||
NonnullRefPtrVector<Type const> types;
|
||||
Vector<NonnullRefPtr<Type const>> types;
|
||||
|
||||
// 3. For each member type U of T:
|
||||
for (auto& type : m_member_types) {
|
||||
|
@ -344,8 +344,8 @@ public:
|
|||
// 2. If U is a nullable type, then set U to be the inner type of U. (NOTE: Not necessary as nullable is stored with Type and not as a separate struct)
|
||||
|
||||
// 3. If U is a union type, then add to S the flattened member types of U.
|
||||
if (type.is_union()) {
|
||||
auto& union_member_type = type.as_union();
|
||||
if (type->is_union()) {
|
||||
auto& union_member_type = type->as_union();
|
||||
types.extend(union_member_type.flattened_member_types());
|
||||
} else {
|
||||
// 4. Otherwise, U is not a union type. Add U to S.
|
||||
|
@ -368,7 +368,7 @@ public:
|
|||
// 3. For each member type U of T:
|
||||
for (auto& type : m_member_types) {
|
||||
// 1. If U is a nullable type, then:
|
||||
if (type.is_nullable()) {
|
||||
if (type->is_nullable()) {
|
||||
// 1. Set n to n + 1.
|
||||
++num_nullable_member_types;
|
||||
|
||||
|
@ -376,8 +376,8 @@ public:
|
|||
}
|
||||
|
||||
// 2. If U is a union type, then:
|
||||
if (type.is_union()) {
|
||||
auto& union_member_type = type.as_union();
|
||||
if (type->is_union()) {
|
||||
auto& union_member_type = type->as_union();
|
||||
|
||||
// 1. Let m be the number of nullable member types of U.
|
||||
// 2. Set n to n + m.
|
||||
|
@ -390,7 +390,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
NonnullRefPtrVector<Type const> m_member_types;
|
||||
Vector<NonnullRefPtr<Type const>> m_member_types;
|
||||
};
|
||||
|
||||
// https://webidl.spec.whatwg.org/#dfn-optionality-value
|
||||
|
@ -405,7 +405,7 @@ class EffectiveOverloadSet {
|
|||
public:
|
||||
struct Item {
|
||||
int callable_id;
|
||||
NonnullRefPtrVector<Type const> types;
|
||||
Vector<NonnullRefPtr<Type const>> types;
|
||||
Vector<Optionality> optionality_values;
|
||||
};
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ ErrorOr<void> ConnectionBase::post_message(MessageBuffer buffer)
|
|||
TRY(buffer.data.try_prepend(reinterpret_cast<u8 const*>(&message_size), sizeof(message_size)));
|
||||
|
||||
for (auto& fd : buffer.fds) {
|
||||
if (auto result = fd_passing_socket().send_fd(fd.value()); result.is_error()) {
|
||||
if (auto result = fd_passing_socket().send_fd(fd->value()); result.is_error()) {
|
||||
shutdown_with_error(result.error());
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Error.h>
|
||||
#include <AK/NonnullRefPtrVector.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <unistd.h>
|
||||
|
@ -36,7 +35,7 @@ private:
|
|||
|
||||
struct MessageBuffer {
|
||||
Vector<u8, 1024> data;
|
||||
NonnullRefPtrVector<AutoCloseFileDescriptor, 1> fds;
|
||||
Vector<NonnullRefPtr<AutoCloseFileDescriptor>, 1> fds;
|
||||
};
|
||||
|
||||
enum class ErrorCode : u32 {
|
||||
|
|
|
@ -107,7 +107,7 @@ Completion ScopeNode::evaluate_statements(Interpreter& interpreter) const
|
|||
{
|
||||
auto completion = normal_completion({});
|
||||
for (auto const& node : children()) {
|
||||
completion = node.execute(interpreter).update_empty(completion.value());
|
||||
completion = node->execute(interpreter).update_empty(completion.value());
|
||||
if (completion.is_abrupt())
|
||||
break;
|
||||
}
|
||||
|
@ -958,12 +958,12 @@ struct ForInOfHeadState {
|
|||
VERIFY(expression_lhs);
|
||||
if (is<VariableDeclaration>(*expression_lhs)) {
|
||||
auto& declaration = static_cast<VariableDeclaration const&>(*expression_lhs);
|
||||
VERIFY(declaration.declarations().first().target().has<NonnullRefPtr<Identifier const>>());
|
||||
lhs_reference = TRY(declaration.declarations().first().target().get<NonnullRefPtr<Identifier const>>()->to_reference(interpreter));
|
||||
VERIFY(declaration.declarations().first()->target().has<NonnullRefPtr<Identifier const>>());
|
||||
lhs_reference = TRY(declaration.declarations().first()->target().get<NonnullRefPtr<Identifier const>>()->to_reference(interpreter));
|
||||
} else if (is<UsingDeclaration>(*expression_lhs)) {
|
||||
auto& declaration = static_cast<UsingDeclaration const&>(*expression_lhs);
|
||||
VERIFY(declaration.declarations().first().target().has<NonnullRefPtr<Identifier const>>());
|
||||
lhs_reference = TRY(declaration.declarations().first().target().get<NonnullRefPtr<Identifier const>>()->to_reference(interpreter));
|
||||
VERIFY(declaration.declarations().first()->target().has<NonnullRefPtr<Identifier const>>());
|
||||
lhs_reference = TRY(declaration.declarations().first()->target().get<NonnullRefPtr<Identifier const>>()->to_reference(interpreter));
|
||||
} else {
|
||||
VERIFY(is<Identifier>(*expression_lhs) || is<MemberExpression>(*expression_lhs) || is<CallExpression>(*expression_lhs));
|
||||
auto& expression = static_cast<Expression const&>(*expression_lhs);
|
||||
|
@ -1032,7 +1032,7 @@ struct ForInOfHeadState {
|
|||
}
|
||||
VERIFY(expression_lhs && is<VariableDeclaration>(*expression_lhs));
|
||||
auto& for_declaration = static_cast<VariableDeclaration const&>(*expression_lhs);
|
||||
auto& binding_pattern = for_declaration.declarations().first().target().get<NonnullRefPtr<BindingPattern const>>();
|
||||
auto& binding_pattern = for_declaration.declarations().first()->target().get<NonnullRefPtr<BindingPattern const>>();
|
||||
VERIFY(lhs_kind == VarBinding || iteration_environment);
|
||||
|
||||
// At this point iteration_environment is undefined if lhs_kind == VarBinding which means this does both
|
||||
|
@ -1063,16 +1063,16 @@ static ThrowCompletionOr<ForInOfHeadState> for_in_of_head_execute(Interpreter& i
|
|||
if (is<VariableDeclaration>(ast_ptr->ptr())) {
|
||||
auto& variable_declaration = static_cast<VariableDeclaration const&>(*(*ast_ptr));
|
||||
VERIFY(variable_declaration.declarations().size() == 1);
|
||||
state.destructuring = variable_declaration.declarations().first().target().has<NonnullRefPtr<BindingPattern const>>();
|
||||
state.destructuring = variable_declaration.declarations().first()->target().has<NonnullRefPtr<BindingPattern const>>();
|
||||
if (variable_declaration.declaration_kind() == DeclarationKind::Var) {
|
||||
state.lhs_kind = ForInOfHeadState::VarBinding;
|
||||
auto& variable = variable_declaration.declarations().first();
|
||||
// B.3.5 Initializers in ForIn Statement Heads, https://tc39.es/ecma262/#sec-initializers-in-forin-statement-heads
|
||||
if (variable.init()) {
|
||||
VERIFY(variable.target().has<NonnullRefPtr<Identifier const>>());
|
||||
auto& binding_id = variable.target().get<NonnullRefPtr<Identifier const>>()->string();
|
||||
if (variable->init()) {
|
||||
VERIFY(variable->target().has<NonnullRefPtr<Identifier const>>());
|
||||
auto& binding_id = variable->target().get<NonnullRefPtr<Identifier const>>()->string();
|
||||
auto reference = TRY(interpreter.vm().resolve_binding(binding_id));
|
||||
auto result = TRY(interpreter.vm().named_evaluation_if_anonymous_function(*variable.init(), binding_id));
|
||||
auto result = TRY(interpreter.vm().named_evaluation_if_anonymous_function(*variable->init(), binding_id));
|
||||
TRY(reference.put_value(vm, result));
|
||||
}
|
||||
} else {
|
||||
|
@ -1950,7 +1950,7 @@ ThrowCompletionOr<ECMAScriptFunctionObject*> ClassExpression::class_definition_e
|
|||
auto class_private_environment = new_private_environment(vm, outer_private_environment);
|
||||
|
||||
for (auto const& element : m_elements) {
|
||||
auto opt_private_name = element.private_bound_identifier();
|
||||
auto opt_private_name = element->private_bound_identifier();
|
||||
if (opt_private_name.has_value())
|
||||
class_private_environment->add_private_name({}, opt_private_name.release_value());
|
||||
}
|
||||
|
@ -2026,10 +2026,10 @@ ThrowCompletionOr<ECMAScriptFunctionObject*> ClassExpression::class_definition_e
|
|||
|
||||
for (auto const& element : m_elements) {
|
||||
// Note: All ClassElementEvaluation start with evaluating the name (or we fake it).
|
||||
auto element_value = TRY(element.class_element_evaluation(interpreter, element.is_static() ? *class_constructor : *prototype));
|
||||
auto element_value = TRY(element->class_element_evaluation(interpreter, element->is_static() ? *class_constructor : *prototype));
|
||||
|
||||
if (element_value.has<PrivateElement>()) {
|
||||
auto& container = element.is_static() ? static_private_methods : instance_private_methods;
|
||||
auto& container = element->is_static() ? static_private_methods : instance_private_methods;
|
||||
|
||||
auto& private_element = element_value.get<PrivateElement>();
|
||||
|
||||
|
@ -2051,11 +2051,11 @@ ThrowCompletionOr<ECMAScriptFunctionObject*> ClassExpression::class_definition_e
|
|||
if (!added_to_existing)
|
||||
container.append(move(element_value.get<PrivateElement>()));
|
||||
} else if (auto* class_field_definition_ptr = element_value.get_pointer<ClassFieldDefinition>()) {
|
||||
if (element.is_static())
|
||||
if (element->is_static())
|
||||
static_elements.append(move(*class_field_definition_ptr));
|
||||
else
|
||||
instance_fields.append(move(*class_field_definition_ptr));
|
||||
} else if (element.class_element_kind() == ClassElement::ElementKind::StaticInitializer) {
|
||||
} else if (element->class_element_kind() == ClassElement::ElementKind::StaticInitializer) {
|
||||
// We use Completion to hold the ClassStaticBlockDefinition Record.
|
||||
VERIFY(element_value.has<Completion>() && element_value.get<Completion>().value().has_value());
|
||||
auto& element_object = element_value.get<Completion>().value()->as_object();
|
||||
|
@ -2108,28 +2108,28 @@ void ScopeNode::dump(int indent) const
|
|||
print_indent(indent + 1);
|
||||
outln("(Lexical declarations)");
|
||||
for (auto& declaration : m_lexical_declarations)
|
||||
declaration.dump(indent + 2);
|
||||
declaration->dump(indent + 2);
|
||||
}
|
||||
|
||||
if (!m_var_declarations.is_empty()) {
|
||||
print_indent(indent + 1);
|
||||
outln("(Variable declarations)");
|
||||
for (auto& declaration : m_var_declarations)
|
||||
declaration.dump(indent + 2);
|
||||
declaration->dump(indent + 2);
|
||||
}
|
||||
|
||||
if (!m_functions_hoistable_with_annexB_extension.is_empty()) {
|
||||
print_indent(indent + 1);
|
||||
outln("(Hoisted functions via annexB extension)");
|
||||
for (auto& declaration : m_functions_hoistable_with_annexB_extension)
|
||||
declaration.dump(indent + 2);
|
||||
declaration->dump(indent + 2);
|
||||
}
|
||||
|
||||
if (!m_children.is_empty()) {
|
||||
print_indent(indent + 1);
|
||||
outln("(Children)");
|
||||
for (auto& child : children())
|
||||
child.dump(indent + 2);
|
||||
child->dump(indent + 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2322,7 +2322,7 @@ void ClassExpression::dump(int indent) const
|
|||
print_indent(indent);
|
||||
outln("(Elements)");
|
||||
for (auto& method : m_elements)
|
||||
method.dump(indent + 1);
|
||||
method->dump(indent + 1);
|
||||
}
|
||||
|
||||
void ClassMethod::dump(int indent) const
|
||||
|
@ -3033,8 +3033,8 @@ Completion VariableDeclaration::execute(Interpreter& interpreter) const
|
|||
auto& vm = interpreter.vm();
|
||||
|
||||
for (auto& declarator : m_declarations) {
|
||||
if (auto* init = declarator.init()) {
|
||||
TRY(declarator.target().visit(
|
||||
if (auto* init = declarator->init()) {
|
||||
TRY(declarator->target().visit(
|
||||
[&](NonnullRefPtr<Identifier const> const& id) -> ThrowCompletionOr<void> {
|
||||
auto reference = TRY(id->to_reference(interpreter));
|
||||
auto initializer_result = TRY(interpreter.vm().named_evaluation_if_anonymous_function(*init, id->string()));
|
||||
|
@ -3053,8 +3053,8 @@ Completion VariableDeclaration::execute(Interpreter& interpreter) const
|
|||
return vm.binding_initialization(pattern, initializer_result, environment);
|
||||
}));
|
||||
} else if (m_declaration_kind != DeclarationKind::Var) {
|
||||
VERIFY(declarator.target().has<NonnullRefPtr<Identifier const>>());
|
||||
auto& identifier = declarator.target().get<NonnullRefPtr<Identifier const>>();
|
||||
VERIFY(declarator->target().has<NonnullRefPtr<Identifier const>>());
|
||||
auto& identifier = declarator->target().get<NonnullRefPtr<Identifier const>>();
|
||||
auto reference = TRY(identifier->to_reference(interpreter));
|
||||
TRY(reference.initialize_referenced_binding(vm, js_undefined()));
|
||||
}
|
||||
|
@ -3073,7 +3073,7 @@ Completion VariableDeclarator::execute(Interpreter& interpreter) const
|
|||
ThrowCompletionOr<void> VariableDeclaration::for_each_bound_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const
|
||||
{
|
||||
for (auto const& entry : declarations()) {
|
||||
TRY(entry.target().visit(
|
||||
TRY(entry->target().visit(
|
||||
[&](NonnullRefPtr<Identifier const> const& id) {
|
||||
return callback(id->string());
|
||||
},
|
||||
|
@ -3107,7 +3107,7 @@ void VariableDeclaration::dump(int indent) const
|
|||
outln("{}", declaration_kind_string);
|
||||
|
||||
for (auto& declarator : m_declarations)
|
||||
declarator.dump(indent + 1);
|
||||
declarator->dump(indent + 1);
|
||||
}
|
||||
|
||||
// 6.2.1.2 Runtime Semantics: Evaluation, https://tc39.es/proposal-explicit-resource-management/#sec-let-and-const-declarations-runtime-semantics-evaluation
|
||||
|
@ -3118,14 +3118,14 @@ Completion UsingDeclaration::execute(Interpreter& interpreter) const
|
|||
auto& vm = interpreter.vm();
|
||||
|
||||
for (auto& declarator : m_declarations) {
|
||||
VERIFY(declarator.target().has<NonnullRefPtr<Identifier const>>());
|
||||
VERIFY(declarator.init());
|
||||
VERIFY(declarator->target().has<NonnullRefPtr<Identifier const>>());
|
||||
VERIFY(declarator->init());
|
||||
|
||||
auto& id = declarator.target().get<NonnullRefPtr<Identifier const>>();
|
||||
auto& id = declarator->target().get<NonnullRefPtr<Identifier const>>();
|
||||
|
||||
// 2. ReturnIfAbrupt(next).
|
||||
auto reference = TRY(id->to_reference(interpreter));
|
||||
auto initializer_result = TRY(interpreter.vm().named_evaluation_if_anonymous_function(*declarator.init(), id->string()));
|
||||
auto initializer_result = TRY(interpreter.vm().named_evaluation_if_anonymous_function(*declarator->init(), id->string()));
|
||||
VERIFY(!initializer_result.is_empty());
|
||||
TRY(reference.initialize_referenced_binding(vm, initializer_result, Environment::InitializeBindingHint::SyncDispose));
|
||||
}
|
||||
|
@ -3137,8 +3137,8 @@ Completion UsingDeclaration::execute(Interpreter& interpreter) const
|
|||
ThrowCompletionOr<void> UsingDeclaration::for_each_bound_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const
|
||||
{
|
||||
for (auto const& entry : m_declarations) {
|
||||
VERIFY(entry.target().has<NonnullRefPtr<Identifier const>>());
|
||||
TRY(callback(entry.target().get<NonnullRefPtr<Identifier const>>()->string()));
|
||||
VERIFY(entry->target().has<NonnullRefPtr<Identifier const>>());
|
||||
TRY(callback(entry->target().get<NonnullRefPtr<Identifier const>>()->string()));
|
||||
}
|
||||
|
||||
return {};
|
||||
|
@ -3149,7 +3149,7 @@ void UsingDeclaration::dump(int indent) const
|
|||
ASTNode::dump(indent);
|
||||
print_indent(indent + 1);
|
||||
for (auto& declarator : m_declarations)
|
||||
declarator.dump(indent + 1);
|
||||
declarator->dump(indent + 1);
|
||||
}
|
||||
|
||||
void VariableDeclarator::dump(int indent) const
|
||||
|
@ -3178,7 +3178,7 @@ void ObjectExpression::dump(int indent) const
|
|||
{
|
||||
ASTNode::dump(indent);
|
||||
for (auto& property : m_properties) {
|
||||
property.dump(indent + 1);
|
||||
property->dump(indent + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3208,10 +3208,10 @@ Completion ObjectExpression::execute(Interpreter& interpreter) const
|
|||
|
||||
// 2. Perform ? PropertyDefinitionEvaluation of PropertyDefinitionList with argument obj.
|
||||
for (auto& property : m_properties) {
|
||||
auto key = TRY(property.key().execute(interpreter)).release_value();
|
||||
auto key = TRY(property->key().execute(interpreter)).release_value();
|
||||
|
||||
// PropertyDefinition : ... AssignmentExpression
|
||||
if (property.type() == ObjectProperty::Type::Spread) {
|
||||
if (property->type() == ObjectProperty::Type::Spread) {
|
||||
// 4. Perform ? CopyDataProperties(object, fromValue, excludedNames).
|
||||
TRY(object->copy_data_properties(vm, key, {}));
|
||||
|
||||
|
@ -3219,10 +3219,10 @@ Completion ObjectExpression::execute(Interpreter& interpreter) const
|
|||
continue;
|
||||
}
|
||||
|
||||
auto value = TRY(property.value().execute(interpreter)).release_value();
|
||||
auto value = TRY(property->value().execute(interpreter)).release_value();
|
||||
|
||||
// 8. If isProtoSetter is true, then
|
||||
if (property.type() == ObjectProperty::Type::ProtoSetter) {
|
||||
if (property->type() == ObjectProperty::Type::ProtoSetter) {
|
||||
// a. If Type(propValue) is either Object or Null, then
|
||||
if (value.is_object() || value.is_null()) {
|
||||
// i. Perform ! object.[[SetPrototypeOf]](propValue).
|
||||
|
@ -3234,21 +3234,21 @@ Completion ObjectExpression::execute(Interpreter& interpreter) const
|
|||
|
||||
auto property_key = TRY(PropertyKey::from_value(vm, key));
|
||||
|
||||
if (property.is_method()) {
|
||||
if (property->is_method()) {
|
||||
VERIFY(value.is_function());
|
||||
static_cast<ECMAScriptFunctionObject&>(value.as_function()).set_home_object(object);
|
||||
|
||||
auto name = MUST(get_function_property_name(property_key));
|
||||
if (property.type() == ObjectProperty::Type::Getter) {
|
||||
if (property->type() == ObjectProperty::Type::Getter) {
|
||||
name = DeprecatedString::formatted("get {}", name);
|
||||
} else if (property.type() == ObjectProperty::Type::Setter) {
|
||||
} else if (property->type() == ObjectProperty::Type::Setter) {
|
||||
name = DeprecatedString::formatted("set {}", name);
|
||||
}
|
||||
|
||||
update_function_name(value, name);
|
||||
}
|
||||
|
||||
switch (property.type()) {
|
||||
switch (property->type()) {
|
||||
case ObjectProperty::Type::Getter:
|
||||
VERIFY(value.is_function());
|
||||
object->define_direct_accessor(property_key, &value.as_function(), nullptr, Attribute::Configurable | Attribute::Enumerable);
|
||||
|
@ -3741,7 +3741,7 @@ void TemplateLiteral::dump(int indent) const
|
|||
{
|
||||
ASTNode::dump(indent);
|
||||
for (auto& expression : m_expressions)
|
||||
expression.dump(indent + 1);
|
||||
expression->dump(indent + 1);
|
||||
}
|
||||
|
||||
// 13.2.8.5 Runtime Semantics: Evaluation, https://tc39.es/ecma262/#sec-template-literals-runtime-semantics-evaluation
|
||||
|
@ -3757,7 +3757,7 @@ Completion TemplateLiteral::execute(Interpreter& interpreter) const
|
|||
|
||||
// 2. Let subRef be the result of evaluating Expression.
|
||||
// 3. Let sub be ? GetValue(subRef).
|
||||
auto sub = TRY(expression.execute(interpreter)).release_value();
|
||||
auto sub = TRY(expression->execute(interpreter)).release_value();
|
||||
|
||||
// 4. Let middle be ? ToString(sub).
|
||||
auto string = TRY(sub.to_deprecated_string(vm));
|
||||
|
@ -3835,7 +3835,7 @@ Completion TaggedTemplateLiteral::execute(Interpreter& interpreter) const
|
|||
// tag`foo${bar}baz${qux}` -> "foo", bar, "baz", qux, "" -> tag(["foo", "baz", ""], bar, qux)
|
||||
// So we want all the odd expressions
|
||||
for (size_t i = 1; i < expressions.size(); i += 2)
|
||||
arguments.append(TRY(expressions[i].execute(interpreter)).release_value());
|
||||
arguments.append(TRY(expressions[i]->execute(interpreter)).release_value());
|
||||
|
||||
// 5. Return ? EvaluateCall(tagFunc, tagRef, TemplateLiteral, tailCall).
|
||||
return call(vm, tag, tag_this_value, move(arguments));
|
||||
|
@ -3887,7 +3887,7 @@ ThrowCompletionOr<Value> TaggedTemplateLiteral::get_template_object(Interpreter&
|
|||
auto cooked_string_index = i * 2;
|
||||
// a. Let prop be ! ToString(𝔽(index)).
|
||||
// b. Let cookedValue be cookedStrings[index].
|
||||
auto cooked_value = TRY(expressions[cooked_string_index].execute(interpreter)).release_value();
|
||||
auto cooked_value = TRY(expressions[cooked_string_index]->execute(interpreter)).release_value();
|
||||
|
||||
// NOTE: If the string contains invalid escapes we get a null expression here,
|
||||
// which we then convert to the expected `undefined` TV. See
|
||||
|
@ -3900,7 +3900,7 @@ ThrowCompletionOr<Value> TaggedTemplateLiteral::get_template_object(Interpreter&
|
|||
|
||||
// d. Let rawValue be the String value rawStrings[index].
|
||||
// e. Perform ! DefinePropertyOrThrow(rawObj, prop, PropertyDescriptor { [[Value]]: rawValue, [[Writable]]: false, [[Enumerable]]: true, [[Configurable]]: false }).
|
||||
raw_obj->indexed_properties().append(TRY(raw_strings[i].execute(interpreter)).release_value());
|
||||
raw_obj->indexed_properties().append(TRY(raw_strings[i]->execute(interpreter)).release_value());
|
||||
|
||||
// f. Set index to index + 1.
|
||||
}
|
||||
|
@ -4108,11 +4108,11 @@ Completion SwitchStatement::execute_impl(Interpreter& interpreter) const
|
|||
// 14.12.3 CaseClauseIsSelected ( C, input ), https://tc39.es/ecma262/#sec-runtime-semantics-caseclauseisselected
|
||||
auto case_clause_is_selected = [&](auto const& case_clause, auto input) -> ThrowCompletionOr<bool> {
|
||||
// 1. Assert: C is an instance of the production CaseClause : case Expression : StatementList[opt] .
|
||||
VERIFY(case_clause.test());
|
||||
VERIFY(case_clause->test());
|
||||
|
||||
// 2. Let exprRef be the result of evaluating the Expression of C.
|
||||
// 3. Let clauseSelector be ? GetValue(exprRef).
|
||||
auto clause_selector = TRY(case_clause.test()->execute(interpreter)).release_value();
|
||||
auto clause_selector = TRY(case_clause->test()->execute(interpreter)).release_value();
|
||||
|
||||
// 4. Return IsStrictlyEqual(input, clauseSelector).
|
||||
return is_strictly_equal(input, clause_selector);
|
||||
|
@ -4126,11 +4126,11 @@ Completion SwitchStatement::execute_impl(Interpreter& interpreter) const
|
|||
return js_undefined();
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<SwitchCase const> case_clauses_1;
|
||||
NonnullRefPtrVector<SwitchCase const> case_clauses_2;
|
||||
Vector<NonnullRefPtr<SwitchCase const>> case_clauses_1;
|
||||
Vector<NonnullRefPtr<SwitchCase const>> case_clauses_2;
|
||||
RefPtr<SwitchCase const> default_clause;
|
||||
for (auto const& switch_case : m_cases) {
|
||||
if (!switch_case.test())
|
||||
if (!switch_case->test())
|
||||
default_clause = switch_case;
|
||||
else if (!default_clause)
|
||||
case_clauses_1.append(switch_case);
|
||||
|
@ -4163,7 +4163,7 @@ Completion SwitchStatement::execute_impl(Interpreter& interpreter) const
|
|||
// b. If found is true, then
|
||||
if (found) {
|
||||
// i. Let R be the result of evaluating C.
|
||||
auto result = case_clause.evaluate_statements(interpreter);
|
||||
auto result = case_clause->evaluate_statements(interpreter);
|
||||
|
||||
// ii. If R.[[Value]] is not empty, set V to R.[[Value]].
|
||||
if (result.value().has_value())
|
||||
|
@ -4203,7 +4203,7 @@ Completion SwitchStatement::execute_impl(Interpreter& interpreter) const
|
|||
// b. If found is true, then
|
||||
if (found) {
|
||||
// i. Let R be the result of evaluating C.
|
||||
auto result = case_clause.evaluate_statements(interpreter);
|
||||
auto result = case_clause->evaluate_statements(interpreter);
|
||||
|
||||
// ii. If R.[[Value]] is not empty, set V to R.[[Value]].
|
||||
if (result.value().has_value())
|
||||
|
@ -4237,7 +4237,7 @@ Completion SwitchStatement::execute_impl(Interpreter& interpreter) const
|
|||
// ii. If foundInB is true, then
|
||||
if (found_in_b) {
|
||||
// 1. Let R be the result of evaluating CaseClause C.
|
||||
auto result = case_clause.evaluate_statements(interpreter);
|
||||
auto result = case_clause->evaluate_statements(interpreter);
|
||||
|
||||
// 2. If R.[[Value]] is not empty, set V to R.[[Value]].
|
||||
if (result.value().has_value())
|
||||
|
@ -4269,7 +4269,7 @@ Completion SwitchStatement::execute_impl(Interpreter& interpreter) const
|
|||
// 15. For each CaseClause C of B, do
|
||||
for (auto const& case_clause : case_clauses_2) {
|
||||
// a. Let R be the result of evaluating CaseClause C.
|
||||
result = case_clause.evaluate_statements(interpreter);
|
||||
result = case_clause->evaluate_statements(interpreter);
|
||||
|
||||
// b. If R.[[Value]] is not empty, set V to R.[[Value]].
|
||||
if (result.value().has_value())
|
||||
|
@ -4375,7 +4375,7 @@ void SwitchStatement::dump(int indent) const
|
|||
ASTNode::dump(indent);
|
||||
m_discriminant->dump(indent + 1);
|
||||
for (auto& switch_case : m_cases) {
|
||||
switch_case.dump(indent + 1);
|
||||
switch_case->dump(indent + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4434,7 +4434,7 @@ void SequenceExpression::dump(int indent) const
|
|||
{
|
||||
ASTNode::dump(indent);
|
||||
for (auto& expression : m_expressions)
|
||||
expression.dump(indent + 1);
|
||||
expression->dump(indent + 1);
|
||||
}
|
||||
|
||||
// 13.16.1 Runtime Semantics: Evaluation, https://tc39.es/ecma262/#sec-comma-operator-runtime-semantics-evaluation
|
||||
|
@ -4449,7 +4449,7 @@ Completion SequenceExpression::execute(Interpreter& interpreter) const
|
|||
// 4. Return ? GetValue(rref).
|
||||
Value last_value;
|
||||
for (auto const& expression : m_expressions)
|
||||
last_value = TRY(expression.execute(interpreter)).release_value();
|
||||
last_value = TRY(expression->execute(interpreter)).release_value();
|
||||
return { move(last_value) };
|
||||
}
|
||||
|
||||
|
@ -4484,7 +4484,7 @@ ThrowCompletionOr<void> ScopeNode::for_each_lexically_scoped_declaration(ThrowCo
|
|||
ThrowCompletionOr<void> ScopeNode::for_each_lexically_declared_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const
|
||||
{
|
||||
for (auto const& declaration : m_lexical_declarations) {
|
||||
TRY(declaration.for_each_bound_name([&](auto const& name) {
|
||||
TRY(declaration->for_each_bound_name([&](auto const& name) {
|
||||
return callback(name);
|
||||
}));
|
||||
}
|
||||
|
@ -4494,7 +4494,7 @@ ThrowCompletionOr<void> ScopeNode::for_each_lexically_declared_name(ThrowComplet
|
|||
ThrowCompletionOr<void> ScopeNode::for_each_var_declared_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const
|
||||
{
|
||||
for (auto& declaration : m_var_declarations) {
|
||||
TRY(declaration.for_each_bound_name([&](auto const& name) {
|
||||
TRY(declaration->for_each_bound_name([&](auto const& name) {
|
||||
return callback(name);
|
||||
}));
|
||||
}
|
||||
|
@ -4506,7 +4506,7 @@ ThrowCompletionOr<void> ScopeNode::for_each_var_function_declaration_in_reverse_
|
|||
for (ssize_t i = m_var_declarations.size() - 1; i >= 0; i--) {
|
||||
auto& declaration = m_var_declarations[i];
|
||||
if (is<FunctionDeclaration>(declaration))
|
||||
TRY(callback(static_cast<FunctionDeclaration const&>(declaration)));
|
||||
TRY(callback(static_cast<FunctionDeclaration const&>(*declaration)));
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -4516,7 +4516,7 @@ ThrowCompletionOr<void> ScopeNode::for_each_var_scoped_variable_declaration(Thro
|
|||
for (auto& declaration : m_var_declarations) {
|
||||
if (!is<FunctionDeclaration>(declaration)) {
|
||||
VERIFY(is<VariableDeclaration>(declaration));
|
||||
TRY(callback(static_cast<VariableDeclaration const&>(declaration)));
|
||||
TRY(callback(static_cast<VariableDeclaration const&>(*declaration)));
|
||||
}
|
||||
}
|
||||
return {};
|
||||
|
@ -4526,7 +4526,7 @@ ThrowCompletionOr<void> ScopeNode::for_each_function_hoistable_with_annexB_exten
|
|||
{
|
||||
for (auto& function : m_functions_hoistable_with_annexB_extension) {
|
||||
// We need const_cast here since it might have to set a property on function declaration.
|
||||
TRY(callback(const_cast<FunctionDeclaration&>(function)));
|
||||
TRY(callback(const_cast<FunctionDeclaration&>(*function)));
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -272,7 +272,7 @@ public:
|
|||
{
|
||||
auto child = create_ast_node<T>(range, forward<Args>(args)...);
|
||||
m_children.append(move(child));
|
||||
return static_cast<T&>(m_children.last());
|
||||
return static_cast<T&>(*m_children.last());
|
||||
}
|
||||
void append(NonnullRefPtr<Statement const> child)
|
||||
{
|
||||
|
@ -287,7 +287,7 @@ public:
|
|||
m_functions_hoistable_with_annexB_extension.shrink_to_fit();
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<Statement const> const& children() const { return m_children; }
|
||||
Vector<NonnullRefPtr<Statement const>> const& children() const { return m_children; }
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -324,11 +324,11 @@ protected:
|
|||
private:
|
||||
virtual bool is_scope_node() const final { return true; }
|
||||
|
||||
NonnullRefPtrVector<Statement const> m_children;
|
||||
NonnullRefPtrVector<Declaration const> m_lexical_declarations;
|
||||
NonnullRefPtrVector<Declaration const> m_var_declarations;
|
||||
Vector<NonnullRefPtr<Statement const>> m_children;
|
||||
Vector<NonnullRefPtr<Declaration const>> m_lexical_declarations;
|
||||
Vector<NonnullRefPtr<Declaration const>> m_var_declarations;
|
||||
|
||||
NonnullRefPtrVector<FunctionDeclaration const> m_functions_hoistable_with_annexB_extension;
|
||||
Vector<NonnullRefPtr<FunctionDeclaration const>> m_functions_hoistable_with_annexB_extension;
|
||||
};
|
||||
|
||||
// ImportEntry Record, https://tc39.es/ecma262/#table-importentry-record-fields
|
||||
|
@ -526,11 +526,11 @@ public:
|
|||
append(export_statement);
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<ImportStatement const> const& imports() const { return m_imports; }
|
||||
NonnullRefPtrVector<ExportStatement const> const& exports() const { return m_exports; }
|
||||
Vector<NonnullRefPtr<ImportStatement const>> const& imports() const { return m_imports; }
|
||||
Vector<NonnullRefPtr<ExportStatement const>> const& exports() const { return m_exports; }
|
||||
|
||||
NonnullRefPtrVector<ImportStatement const>& imports() { return m_imports; }
|
||||
NonnullRefPtrVector<ExportStatement const>& exports() { return m_exports; }
|
||||
Vector<NonnullRefPtr<ImportStatement const>>& imports() { return m_imports; }
|
||||
Vector<NonnullRefPtr<ExportStatement const>>& exports() { return m_exports; }
|
||||
|
||||
bool has_top_level_await() const { return m_has_top_level_await; }
|
||||
void set_has_top_level_await() { m_has_top_level_await = true; }
|
||||
|
@ -543,8 +543,8 @@ private:
|
|||
bool m_is_strict_mode { false };
|
||||
Type m_type { Type::Script };
|
||||
|
||||
NonnullRefPtrVector<ImportStatement const> m_imports;
|
||||
NonnullRefPtrVector<ExportStatement const> m_exports;
|
||||
Vector<NonnullRefPtr<ImportStatement const>> m_imports;
|
||||
Vector<NonnullRefPtr<ExportStatement const>> m_exports;
|
||||
bool m_has_top_level_await { false };
|
||||
};
|
||||
|
||||
|
@ -1101,7 +1101,7 @@ private:
|
|||
|
||||
class SequenceExpression final : public Expression {
|
||||
public:
|
||||
SequenceExpression(SourceRange source_range, NonnullRefPtrVector<Expression const> expressions)
|
||||
SequenceExpression(SourceRange source_range, Vector<NonnullRefPtr<Expression const>> expressions)
|
||||
: Expression(source_range)
|
||||
, m_expressions(move(expressions))
|
||||
{
|
||||
|
@ -1113,7 +1113,7 @@ public:
|
|||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
private:
|
||||
NonnullRefPtrVector<Expression const> m_expressions;
|
||||
Vector<NonnullRefPtr<Expression const>> m_expressions;
|
||||
};
|
||||
|
||||
class Literal : public Expression {
|
||||
|
@ -1395,7 +1395,7 @@ public:
|
|||
|
||||
class ClassExpression final : public Expression {
|
||||
public:
|
||||
ClassExpression(SourceRange source_range, DeprecatedString name, DeprecatedString source_text, RefPtr<FunctionExpression const> constructor, RefPtr<Expression const> super_class, NonnullRefPtrVector<ClassElement const> elements)
|
||||
ClassExpression(SourceRange source_range, DeprecatedString name, DeprecatedString source_text, RefPtr<FunctionExpression const> constructor, RefPtr<Expression const> super_class, Vector<NonnullRefPtr<ClassElement const>> elements)
|
||||
: Expression(source_range)
|
||||
, m_name(move(name))
|
||||
, m_source_text(move(source_text))
|
||||
|
@ -1424,7 +1424,7 @@ private:
|
|||
DeprecatedString m_source_text;
|
||||
RefPtr<FunctionExpression const> m_constructor;
|
||||
RefPtr<Expression const> m_super_class;
|
||||
NonnullRefPtrVector<ClassElement const> m_elements;
|
||||
Vector<NonnullRefPtr<ClassElement const>> m_elements;
|
||||
};
|
||||
|
||||
class ClassDeclaration final : public Declaration {
|
||||
|
@ -1691,7 +1691,7 @@ private:
|
|||
|
||||
class VariableDeclaration final : public Declaration {
|
||||
public:
|
||||
VariableDeclaration(SourceRange source_range, DeclarationKind declaration_kind, NonnullRefPtrVector<VariableDeclarator const> declarations)
|
||||
VariableDeclaration(SourceRange source_range, DeclarationKind declaration_kind, Vector<NonnullRefPtr<VariableDeclarator const>> declarations)
|
||||
: Declaration(source_range)
|
||||
, m_declaration_kind(declaration_kind)
|
||||
, m_declarations(move(declarations))
|
||||
|
@ -1704,7 +1704,7 @@ public:
|
|||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
NonnullRefPtrVector<VariableDeclarator const> const& declarations() const { return m_declarations; }
|
||||
Vector<NonnullRefPtr<VariableDeclarator const>> const& declarations() const { return m_declarations; }
|
||||
|
||||
virtual ThrowCompletionOr<void> for_each_bound_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const override;
|
||||
|
||||
|
@ -1716,12 +1716,12 @@ private:
|
|||
virtual bool is_variable_declaration() const override { return true; }
|
||||
|
||||
DeclarationKind m_declaration_kind;
|
||||
NonnullRefPtrVector<VariableDeclarator const> m_declarations;
|
||||
Vector<NonnullRefPtr<VariableDeclarator const>> m_declarations;
|
||||
};
|
||||
|
||||
class UsingDeclaration final : public Declaration {
|
||||
public:
|
||||
UsingDeclaration(SourceRange source_range, NonnullRefPtrVector<VariableDeclarator const> declarations)
|
||||
UsingDeclaration(SourceRange source_range, Vector<NonnullRefPtr<VariableDeclarator const>> declarations)
|
||||
: Declaration(move(source_range))
|
||||
, m_declarations(move(declarations))
|
||||
{
|
||||
|
@ -1736,10 +1736,10 @@ public:
|
|||
|
||||
virtual bool is_lexical_declaration() const override { return true; }
|
||||
|
||||
NonnullRefPtrVector<VariableDeclarator const> const& declarations() const { return m_declarations; }
|
||||
Vector<NonnullRefPtr<VariableDeclarator const>> const& declarations() const { return m_declarations; }
|
||||
|
||||
private:
|
||||
NonnullRefPtrVector<VariableDeclarator const> m_declarations;
|
||||
Vector<NonnullRefPtr<VariableDeclarator const>> m_declarations;
|
||||
};
|
||||
|
||||
class ObjectProperty final : public ASTNode {
|
||||
|
@ -1783,7 +1783,7 @@ private:
|
|||
|
||||
class ObjectExpression final : public Expression {
|
||||
public:
|
||||
explicit ObjectExpression(SourceRange source_range, NonnullRefPtrVector<ObjectProperty> properties = {})
|
||||
explicit ObjectExpression(SourceRange source_range, Vector<NonnullRefPtr<ObjectProperty>> properties = {})
|
||||
: Expression(source_range)
|
||||
, m_properties(move(properties))
|
||||
{
|
||||
|
@ -1796,7 +1796,7 @@ public:
|
|||
private:
|
||||
virtual bool is_object_expression() const override { return true; }
|
||||
|
||||
NonnullRefPtrVector<ObjectProperty> m_properties;
|
||||
Vector<NonnullRefPtr<ObjectProperty>> m_properties;
|
||||
};
|
||||
|
||||
class ArrayExpression final : public Expression {
|
||||
|
@ -1821,13 +1821,13 @@ private:
|
|||
|
||||
class TemplateLiteral final : public Expression {
|
||||
public:
|
||||
TemplateLiteral(SourceRange source_range, NonnullRefPtrVector<Expression const> expressions)
|
||||
TemplateLiteral(SourceRange source_range, Vector<NonnullRefPtr<Expression const>> expressions)
|
||||
: Expression(source_range)
|
||||
, m_expressions(move(expressions))
|
||||
{
|
||||
}
|
||||
|
||||
TemplateLiteral(SourceRange source_range, NonnullRefPtrVector<Expression const> expressions, NonnullRefPtrVector<Expression const> raw_strings)
|
||||
TemplateLiteral(SourceRange source_range, Vector<NonnullRefPtr<Expression const>> expressions, Vector<NonnullRefPtr<Expression const>> raw_strings)
|
||||
: Expression(source_range)
|
||||
, m_expressions(move(expressions))
|
||||
, m_raw_strings(move(raw_strings))
|
||||
|
@ -1838,12 +1838,12 @@ public:
|
|||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
NonnullRefPtrVector<Expression const> const& expressions() const { return m_expressions; }
|
||||
NonnullRefPtrVector<Expression const> const& raw_strings() const { return m_raw_strings; }
|
||||
Vector<NonnullRefPtr<Expression const>> const& expressions() const { return m_expressions; }
|
||||
Vector<NonnullRefPtr<Expression const>> const& raw_strings() const { return m_raw_strings; }
|
||||
|
||||
private:
|
||||
NonnullRefPtrVector<Expression const> const m_expressions;
|
||||
NonnullRefPtrVector<Expression const> const m_raw_strings;
|
||||
Vector<NonnullRefPtr<Expression const>> const m_expressions;
|
||||
Vector<NonnullRefPtr<Expression const>> const m_raw_strings;
|
||||
};
|
||||
|
||||
class TaggedTemplateLiteral final : public Expression {
|
||||
|
@ -2110,7 +2110,7 @@ public:
|
|||
|
||||
private:
|
||||
NonnullRefPtr<Expression const> m_discriminant;
|
||||
NonnullRefPtrVector<SwitchCase const> m_cases;
|
||||
Vector<NonnullRefPtr<SwitchCase const>> m_cases;
|
||||
};
|
||||
|
||||
class BreakStatement final : public Statement {
|
||||
|
|
|
@ -291,7 +291,7 @@ Bytecode::CodeGenerationErrorOr<void> ScopeNode::generate_bytecode(Bytecode::Gen
|
|||
return maybe_error.release_value();
|
||||
|
||||
for (auto& child : children()) {
|
||||
TRY(child.generate_bytecode(generator));
|
||||
TRY(child->generate_bytecode(generator));
|
||||
if (generator.is_current_block_terminated())
|
||||
break;
|
||||
}
|
||||
|
@ -1085,7 +1085,7 @@ Bytecode::CodeGenerationErrorOr<void> ObjectExpression::generate_bytecode(Byteco
|
|||
|
||||
for (auto& property : m_properties) {
|
||||
Bytecode::Op::PropertyKind property_kind;
|
||||
switch (property.type()) {
|
||||
switch (property->type()) {
|
||||
case ObjectProperty::Type::KeyValue:
|
||||
property_kind = Bytecode::Op::PropertyKind::KeyValue;
|
||||
break;
|
||||
|
@ -1103,21 +1103,21 @@ Bytecode::CodeGenerationErrorOr<void> ObjectExpression::generate_bytecode(Byteco
|
|||
break;
|
||||
}
|
||||
|
||||
if (is<StringLiteral>(property.key())) {
|
||||
auto& string_literal = static_cast<StringLiteral const&>(property.key());
|
||||
if (is<StringLiteral>(property->key())) {
|
||||
auto& string_literal = static_cast<StringLiteral const&>(property->key());
|
||||
Bytecode::IdentifierTableIndex key_name = generator.intern_identifier(string_literal.value());
|
||||
|
||||
if (property_kind != Bytecode::Op::PropertyKind::Spread)
|
||||
TRY(property.value().generate_bytecode(generator));
|
||||
TRY(property->value().generate_bytecode(generator));
|
||||
|
||||
generator.emit<Bytecode::Op::PutById>(object_reg, key_name, property_kind);
|
||||
} else {
|
||||
TRY(property.key().generate_bytecode(generator));
|
||||
TRY(property->key().generate_bytecode(generator));
|
||||
auto property_reg = generator.allocate_register();
|
||||
generator.emit<Bytecode::Op::Store>(property_reg);
|
||||
|
||||
if (property_kind != Bytecode::Op::PropertyKind::Spread)
|
||||
TRY(property.value().generate_bytecode(generator));
|
||||
TRY(property->value().generate_bytecode(generator));
|
||||
|
||||
generator.emit<Bytecode::Op::PutByValue>(object_reg, property_reg, property_kind);
|
||||
}
|
||||
|
@ -1504,8 +1504,8 @@ static Bytecode::CodeGenerationErrorOr<void> assign_accumulator_to_variable_decl
|
|||
Bytecode::CodeGenerationErrorOr<void> VariableDeclaration::generate_bytecode(Bytecode::Generator& generator) const
|
||||
{
|
||||
for (auto& declarator : m_declarations) {
|
||||
if (declarator.init())
|
||||
TRY(declarator.init()->generate_bytecode(generator));
|
||||
if (declarator->init())
|
||||
TRY(declarator->init()->generate_bytecode(generator));
|
||||
else
|
||||
generator.emit<Bytecode::Op::LoadImmediate>(js_undefined());
|
||||
TRY(assign_accumulator_to_variable_declarator(generator, declarator, *this));
|
||||
|
@ -2026,7 +2026,7 @@ Bytecode::CodeGenerationErrorOr<void> ConditionalExpression::generate_bytecode(B
|
|||
Bytecode::CodeGenerationErrorOr<void> SequenceExpression::generate_bytecode(Bytecode::Generator& generator) const
|
||||
{
|
||||
for (auto& expression : m_expressions)
|
||||
TRY(expression.generate_bytecode(generator));
|
||||
TRY(expression->generate_bytecode(generator));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@ -2036,7 +2036,7 @@ Bytecode::CodeGenerationErrorOr<void> TemplateLiteral::generate_bytecode(Bytecod
|
|||
auto string_reg = generator.allocate_register();
|
||||
|
||||
for (size_t i = 0; i < m_expressions.size(); i++) {
|
||||
TRY(m_expressions[i].generate_bytecode(generator));
|
||||
TRY(m_expressions[i]->generate_bytecode(generator));
|
||||
if (i == 0) {
|
||||
generator.emit<Bytecode::Op::Store>(string_reg);
|
||||
} else {
|
||||
|
@ -2069,7 +2069,7 @@ Bytecode::CodeGenerationErrorOr<void> TaggedTemplateLiteral::generate_bytecode(B
|
|||
if (i % 2 != 0)
|
||||
continue;
|
||||
|
||||
TRY(expressions[i].generate_bytecode(generator));
|
||||
TRY(expressions[i]->generate_bytecode(generator));
|
||||
auto string_reg = string_regs[reg_index++];
|
||||
generator.emit<Bytecode::Op::Store>(string_reg);
|
||||
}
|
||||
|
@ -2089,7 +2089,7 @@ Bytecode::CodeGenerationErrorOr<void> TaggedTemplateLiteral::generate_bytecode(B
|
|||
|
||||
for (size_t i = 1; i < expressions.size(); i += 2) {
|
||||
auto string_reg = argument_regs[1 + i / 2];
|
||||
TRY(expressions[i].generate_bytecode(generator));
|
||||
TRY(expressions[i]->generate_bytecode(generator));
|
||||
generator.emit<Bytecode::Op::Store>(string_reg);
|
||||
}
|
||||
|
||||
|
@ -2099,7 +2099,7 @@ Bytecode::CodeGenerationErrorOr<void> TaggedTemplateLiteral::generate_bytecode(B
|
|||
|
||||
reg_index = 0;
|
||||
for (auto& raw_string : m_template_literal->raw_strings()) {
|
||||
TRY(raw_string.generate_bytecode(generator));
|
||||
TRY(raw_string->generate_bytecode(generator));
|
||||
auto raw_string_reg = string_regs[reg_index++];
|
||||
generator.emit<Bytecode::Op::Store>(raw_string_reg);
|
||||
raw_string_regs.append(raw_string_reg);
|
||||
|
@ -2292,9 +2292,9 @@ Bytecode::CodeGenerationErrorOr<void> SwitchStatement::generate_labelled_evaluat
|
|||
|
||||
for (auto& switch_case : m_cases) {
|
||||
auto& case_block = generator.make_block();
|
||||
if (switch_case.test()) {
|
||||
if (switch_case->test()) {
|
||||
generator.switch_to_basic_block(*next_test_block);
|
||||
TRY(switch_case.test()->generate_bytecode(generator));
|
||||
TRY(switch_case->test()->generate_bytecode(generator));
|
||||
generator.emit<Bytecode::Op::StrictlyEquals>(discriminant_reg);
|
||||
next_test_block = &generator.make_block();
|
||||
generator.emit<Bytecode::Op::JumpConditional>().set_targets(Bytecode::Label { case_block }, Bytecode::Label { *next_test_block });
|
||||
|
@ -2318,8 +2318,8 @@ Bytecode::CodeGenerationErrorOr<void> SwitchStatement::generate_labelled_evaluat
|
|||
generator.switch_to_basic_block(*current_block);
|
||||
|
||||
generator.emit<Bytecode::Op::LoadImmediate>(js_undefined());
|
||||
for (auto& statement : switch_case.children()) {
|
||||
TRY(statement.generate_bytecode(generator));
|
||||
for (auto& statement : switch_case->children()) {
|
||||
TRY(statement->generate_bytecode(generator));
|
||||
if (generator.is_current_block_terminated())
|
||||
break;
|
||||
}
|
||||
|
@ -2464,7 +2464,7 @@ static Bytecode::CodeGenerationErrorOr<ForInOfHeadEvaluationResult> for_in_of_he
|
|||
// ForInOfStatement : for ( ForDeclaration of AssignmentExpression ) Statement
|
||||
|
||||
auto& variable_declaration = static_cast<VariableDeclaration const&>(**ast_ptr);
|
||||
result.is_destructuring = variable_declaration.declarations().first().target().has<NonnullRefPtr<BindingPattern const>>();
|
||||
result.is_destructuring = variable_declaration.declarations().first()->target().has<NonnullRefPtr<BindingPattern const>>();
|
||||
result.lhs_kind = variable_declaration.is_lexical_declaration() ? LHSKind::LexicalBinding : LHSKind::VarBinding;
|
||||
|
||||
// 1. Let oldEnv be the running execution context's LexicalEnvironment.
|
||||
|
@ -2660,7 +2660,7 @@ static Bytecode::CodeGenerationErrorOr<void> for_in_of_body_evaluation(Bytecode:
|
|||
if (!destructuring) {
|
||||
// 1. Assert: lhs binds a single name.
|
||||
// 2. Let lhsName be the sole element of BoundNames of lhs.
|
||||
auto lhs_name = variable_declaration.declarations().first().target().get<NonnullRefPtr<Identifier const>>()->string();
|
||||
auto lhs_name = variable_declaration.declarations().first()->target().get<NonnullRefPtr<Identifier const>>()->string();
|
||||
// 3. Let lhsRef be ! ResolveBinding(lhsName).
|
||||
// NOTE: We're skipping all the completion stuff that the spec does, as the unwinding mechanism will take case of doing that.
|
||||
auto identifier = generator.intern_identifier(lhs_name);
|
||||
|
@ -2692,7 +2692,7 @@ static Bytecode::CodeGenerationErrorOr<void> for_in_of_body_evaluation(Bytecode:
|
|||
if (head_result.lhs_kind == LHSKind::VarBinding || head_result.lhs_kind == LHSKind::LexicalBinding) {
|
||||
auto& declaration = static_cast<VariableDeclaration const&>(*lhs.get<NonnullRefPtr<ASTNode const>>());
|
||||
VERIFY(declaration.declarations().size() == 1);
|
||||
auto& binding_pattern = declaration.declarations().first().target().get<NonnullRefPtr<BindingPattern const>>();
|
||||
auto& binding_pattern = declaration.declarations().first()->target().get<NonnullRefPtr<BindingPattern const>>();
|
||||
|
||||
auto value_register = generator.allocate_register();
|
||||
generator.emit<Bytecode::Op::Store>(value_register);
|
||||
|
|
|
@ -231,13 +231,13 @@ public:
|
|||
|
||||
for (size_t i = 0; i < m_functions_to_hoist.size(); i++) {
|
||||
auto const& function_declaration = m_functions_to_hoist[i];
|
||||
if (m_lexical_names.contains(function_declaration.name()) || m_forbidden_var_names.contains(function_declaration.name()))
|
||||
if (m_lexical_names.contains(function_declaration->name()) || m_forbidden_var_names.contains(function_declaration->name()))
|
||||
continue;
|
||||
if (is_top_level()) {
|
||||
m_node->add_hoisted_function(move(m_functions_to_hoist.ptr_at(i)));
|
||||
m_node->add_hoisted_function(move(m_functions_to_hoist[i]));
|
||||
} else {
|
||||
if (!m_parent_scope->m_lexical_names.contains(function_declaration.name()) && !m_parent_scope->m_function_names.contains(function_declaration.name()))
|
||||
m_parent_scope->m_functions_to_hoist.append(move(m_functions_to_hoist.ptr_at(i)));
|
||||
if (!m_parent_scope->m_lexical_names.contains(function_declaration->name()) && !m_parent_scope->m_function_names.contains(function_declaration->name()))
|
||||
m_parent_scope->m_functions_to_hoist.append(move(m_functions_to_hoist[i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -284,7 +284,7 @@ private:
|
|||
|
||||
HashTable<DeprecatedFlyString> m_forbidden_lexical_names;
|
||||
HashTable<DeprecatedFlyString> m_forbidden_var_names;
|
||||
NonnullRefPtrVector<FunctionDeclaration const> m_functions_to_hoist;
|
||||
Vector<NonnullRefPtr<FunctionDeclaration const>> m_functions_to_hoist;
|
||||
|
||||
Optional<Vector<FunctionParameter>> m_function_parameters;
|
||||
|
||||
|
@ -565,9 +565,9 @@ void Parser::parse_module(Program& program)
|
|||
program.set_has_top_level_await();
|
||||
|
||||
for (auto& export_statement : program.exports()) {
|
||||
if (export_statement.has_statement())
|
||||
if (export_statement->has_statement())
|
||||
continue;
|
||||
for (auto& entry : export_statement.entries()) {
|
||||
for (auto& entry : export_statement->entries()) {
|
||||
if (entry.is_module_request() || entry.kind == ExportEntry::Kind::EmptyNamedExport)
|
||||
return;
|
||||
|
||||
|
@ -586,14 +586,14 @@ void Parser::parse_module(Program& program)
|
|||
found = true;
|
||||
}));
|
||||
for (auto& import : program.imports()) {
|
||||
if (import.has_bound_name(exported_name)) {
|
||||
if (import->has_bound_name(exported_name)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
syntax_error(DeprecatedString::formatted("'{}' in export is not declared", exported_name), export_statement.source_range().start);
|
||||
syntax_error(DeprecatedString::formatted("'{}' in export is not declared", exported_name), export_statement->source_range().start);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1065,7 +1065,7 @@ NonnullRefPtr<ClassExpression const> Parser::parse_class_expression(bool expect_
|
|||
|
||||
consume(TokenType::Class);
|
||||
|
||||
NonnullRefPtrVector<ClassElement const> elements;
|
||||
Vector<NonnullRefPtr<ClassElement const>> elements;
|
||||
RefPtr<Expression const> super_class;
|
||||
RefPtr<FunctionExpression const> constructor;
|
||||
HashTable<DeprecatedFlyString> found_private_names;
|
||||
|
@ -1188,18 +1188,18 @@ NonnullRefPtr<ClassExpression const> Parser::parse_class_expression(bool expect_
|
|||
// and the getter and setter are either both static or both non-static.
|
||||
|
||||
for (auto& element : elements) {
|
||||
auto private_name = element.private_bound_identifier();
|
||||
auto private_name = element->private_bound_identifier();
|
||||
if (!private_name.has_value() || private_name.value() != name)
|
||||
continue;
|
||||
|
||||
if (element.class_element_kind() != ClassElement::ElementKind::Method
|
||||
|| element.is_static() != is_static) {
|
||||
if (element->class_element_kind() != ClassElement::ElementKind::Method
|
||||
|| element->is_static() != is_static) {
|
||||
syntax_error(DeprecatedString::formatted("Duplicate private field or method named '{}'", name));
|
||||
break;
|
||||
}
|
||||
|
||||
VERIFY(is<ClassMethod>(element));
|
||||
auto& class_method_element = static_cast<ClassMethod const&>(element);
|
||||
VERIFY(is<ClassMethod>(*element));
|
||||
auto& class_method_element = static_cast<ClassMethod const&>(*element);
|
||||
|
||||
if (class_method_element.kind() == ClassMethod::Kind::Method || class_method_element.kind() == method_kind) {
|
||||
syntax_error(DeprecatedString::formatted("Duplicate private field or method named '{}'", name));
|
||||
|
@ -1690,7 +1690,7 @@ NonnullRefPtr<ObjectExpression const> Parser::parse_object_expression()
|
|||
auto rule_start = push_start();
|
||||
consume(TokenType::CurlyOpen);
|
||||
|
||||
NonnullRefPtrVector<ObjectProperty> properties;
|
||||
Vector<NonnullRefPtr<ObjectProperty>> properties;
|
||||
ObjectProperty::Type property_type;
|
||||
Optional<SourceRange> invalid_object_literal_property_range;
|
||||
|
||||
|
@ -1908,8 +1908,8 @@ NonnullRefPtr<TemplateLiteral const> Parser::parse_template_literal(bool is_tagg
|
|||
auto rule_start = push_start();
|
||||
consume(TokenType::TemplateLiteralStart);
|
||||
|
||||
NonnullRefPtrVector<Expression const> expressions;
|
||||
NonnullRefPtrVector<Expression const> raw_strings;
|
||||
Vector<NonnullRefPtr<Expression const>> expressions;
|
||||
Vector<NonnullRefPtr<Expression const>> raw_strings;
|
||||
|
||||
auto append_empty_string = [this, &rule_start, &expressions, &raw_strings, is_tagged]() {
|
||||
auto string_literal = create_ast_node<StringLiteral>({ m_source_code, rule_start.position(), position() }, "");
|
||||
|
@ -2044,7 +2044,7 @@ NonnullRefPtr<Expression const> Parser::parse_expression(int min_precedence, Ass
|
|||
}
|
||||
|
||||
if (match(TokenType::Comma) && min_precedence <= 1) {
|
||||
NonnullRefPtrVector<Expression const> expressions;
|
||||
Vector<NonnullRefPtr<Expression const>> expressions;
|
||||
expressions.append(expression);
|
||||
while (match(TokenType::Comma)) {
|
||||
consume();
|
||||
|
@ -3024,7 +3024,7 @@ NonnullRefPtr<VariableDeclaration const> Parser::parse_variable_declaration(IsFo
|
|||
}
|
||||
consume();
|
||||
|
||||
NonnullRefPtrVector<VariableDeclarator const> declarations;
|
||||
Vector<NonnullRefPtr<VariableDeclarator const>> declarations;
|
||||
for (;;) {
|
||||
Variant<NonnullRefPtr<Identifier const>, NonnullRefPtr<BindingPattern const>, Empty> target {};
|
||||
if (auto pattern = parse_binding_pattern(declaration_kind != DeclarationKind::Var ? AllowDuplicates::No : AllowDuplicates::Yes, AllowMemberExpressions::No)) {
|
||||
|
@ -3096,7 +3096,7 @@ NonnullRefPtr<UsingDeclaration const> Parser::parse_using_declaration(IsForLoopV
|
|||
VERIFY(m_state.current_token.original_value() == "using"sv);
|
||||
consume(TokenType::Identifier);
|
||||
VERIFY(!m_state.current_token.trivia_contains_line_terminator());
|
||||
NonnullRefPtrVector<VariableDeclarator const> declarations;
|
||||
Vector<NonnullRefPtr<VariableDeclarator const>> declarations;
|
||||
|
||||
for (;;) {
|
||||
auto lexical_binding = parse_lexical_binding();
|
||||
|
@ -3385,7 +3385,7 @@ NonnullRefPtr<SwitchStatement const> Parser::parse_switch_statement()
|
|||
|
||||
consume(TokenType::CurlyOpen);
|
||||
|
||||
NonnullRefPtrVector<SwitchCase> cases;
|
||||
Vector<NonnullRefPtr<SwitchCase>> cases;
|
||||
|
||||
auto switch_statement = create_ast_node<SwitchStatement>({ m_source_code, rule_start.position(), position() }, move(determinant));
|
||||
|
||||
|
@ -3431,7 +3431,7 @@ NonnullRefPtr<SwitchCase const> Parser::parse_switch_case()
|
|||
|
||||
consume(TokenType::Colon);
|
||||
|
||||
NonnullRefPtrVector<Statement> consequent;
|
||||
Vector<NonnullRefPtr<Statement>> consequent;
|
||||
TemporaryChange break_change(m_state.in_break_context, true);
|
||||
auto switch_case = create_ast_node<SwitchCase>({ m_source_code, rule_start.position(), position() }, move(test));
|
||||
parse_statement_list(switch_case);
|
||||
|
@ -3609,7 +3609,7 @@ NonnullRefPtr<Statement const> Parser::parse_for_statement()
|
|||
if (match_of(m_state.current_token)) {
|
||||
if (declaration->declarations().size() != 1)
|
||||
syntax_error("Must have exactly one declaration in for using of");
|
||||
else if (declaration->declarations().first().init())
|
||||
else if (declaration->declarations().first()->init())
|
||||
syntax_error("Using declaration cannot have initializer");
|
||||
|
||||
return parse_for_in_of_statement(move(declaration), is_await_loop);
|
||||
|
@ -3643,7 +3643,7 @@ NonnullRefPtr<Statement const> Parser::parse_for_statement()
|
|||
}
|
||||
if (declaration->declaration_kind() == DeclarationKind::Const) {
|
||||
for (auto const& variable : declaration->declarations()) {
|
||||
if (!variable.init())
|
||||
if (!variable->init())
|
||||
syntax_error("Missing initializer in 'const' variable declaration");
|
||||
}
|
||||
}
|
||||
|
@ -3699,8 +3699,8 @@ NonnullRefPtr<Statement const> Parser::parse_for_in_of_statement(NonnullRefPtr<A
|
|||
if (!declaration.declarations().is_empty()) {
|
||||
// AnnexB extension B.3.5 Initializers in ForIn Statement Heads, https://tc39.es/ecma262/#sec-initializers-in-forin-statement-heads
|
||||
auto& variable = declaration.declarations().first();
|
||||
if (variable.init()) {
|
||||
if (m_state.strict_mode || declaration.declaration_kind() != DeclarationKind::Var || !variable.target().has<NonnullRefPtr<Identifier const>>())
|
||||
if (variable->init()) {
|
||||
if (m_state.strict_mode || declaration.declaration_kind() != DeclarationKind::Var || !variable->target().has<NonnullRefPtr<Identifier const>>())
|
||||
syntax_error("Variable initializer not allowed in for..in/of");
|
||||
else
|
||||
has_annexB_for_in_init_extension = true;
|
||||
|
@ -4441,7 +4441,7 @@ NonnullRefPtr<ImportStatement const> Parser::parse_import_statement(Program& pro
|
|||
|
||||
for (auto& entry : entries_with_location) {
|
||||
for (auto& import_statement : program.imports()) {
|
||||
if (import_statement.has_bound_name(entry.entry.local_name))
|
||||
if (import_statement->has_bound_name(entry.entry.local_name))
|
||||
syntax_error(DeprecatedString::formatted("Identifier '{}' already declared", entry.entry.local_name), entry.position);
|
||||
}
|
||||
|
||||
|
@ -4660,7 +4660,7 @@ NonnullRefPtr<ExportStatement const> Parser::parse_export_statement(Program& pro
|
|||
auto& variables = static_cast<VariableDeclaration const&>(*declaration);
|
||||
VERIFY(variables.is_lexical_declaration());
|
||||
for (auto& decl : variables.declarations()) {
|
||||
decl.target().visit(
|
||||
decl->target().visit(
|
||||
[&](NonnullRefPtr<Identifier const> const& identifier) {
|
||||
entries_with_location.append({ ExportEntry::named_export(identifier->string(), identifier->string()), identifier->source_range().start });
|
||||
},
|
||||
|
@ -4678,7 +4678,7 @@ NonnullRefPtr<ExportStatement const> Parser::parse_export_statement(Program& pro
|
|||
auto variable_declaration = parse_variable_declaration();
|
||||
m_state.current_scope_pusher->add_declaration(variable_declaration);
|
||||
for (auto& decl : variable_declaration->declarations()) {
|
||||
decl.target().visit(
|
||||
decl->target().visit(
|
||||
[&](NonnullRefPtr<Identifier const> const& identifier) {
|
||||
entries_with_location.append({ ExportEntry::named_export(identifier->string(), identifier->string()), identifier->source_range().start });
|
||||
},
|
||||
|
@ -4742,7 +4742,7 @@ NonnullRefPtr<ExportStatement const> Parser::parse_export_statement(Program& pro
|
|||
|
||||
for (auto& entry : entries_with_location) {
|
||||
for (auto& export_statement : program.exports()) {
|
||||
if (export_statement.has_export(entry.entry.export_name))
|
||||
if (export_statement->has_export(entry.entry.export_name))
|
||||
syntax_error(DeprecatedString::formatted("Duplicate export with name: '{}'", entry.entry.export_name), entry.position);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,13 +55,13 @@ static Vector<ModuleRequest> module_requests(Program& program, Vector<Deprecated
|
|||
Vector<RequestedModuleAndSourceIndex> requested_modules_with_indices;
|
||||
|
||||
for (auto& import_statement : program.imports())
|
||||
requested_modules_with_indices.empend(import_statement.start_offset(), &import_statement.module_request());
|
||||
requested_modules_with_indices.empend(import_statement->start_offset(), &import_statement->module_request());
|
||||
|
||||
for (auto& export_statement : program.exports()) {
|
||||
for (auto& export_entry : export_statement.entries()) {
|
||||
for (auto& export_entry : export_statement->entries()) {
|
||||
if (!export_entry.is_module_request())
|
||||
continue;
|
||||
requested_modules_with_indices.empend(export_statement.start_offset(), &export_statement.module_request());
|
||||
requested_modules_with_indices.empend(export_statement->start_offset(), &export_statement->module_request());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ Result<NonnullGCPtr<SourceTextModule>, Vector<ParserError>> SourceTextModule::pa
|
|||
// 4. Let importEntries be ImportEntries of body.
|
||||
Vector<ImportEntry> import_entries;
|
||||
for (auto const& import_statement : body->imports())
|
||||
import_entries.extend(import_statement.entries());
|
||||
import_entries.extend(import_statement->entries());
|
||||
|
||||
// 5. Let importedBoundNames be ImportedLocalNames(importEntries).
|
||||
// Note: Since we have to potentially extract the import entry we just use importEntries
|
||||
|
@ -163,12 +163,12 @@ Result<NonnullGCPtr<SourceTextModule>, Vector<ParserError>> SourceTextModule::pa
|
|||
// 10. For each ExportEntry Record ee of exportEntries, do
|
||||
for (auto const& export_statement : body->exports()) {
|
||||
|
||||
if (export_statement.is_default_export()) {
|
||||
if (export_statement->is_default_export()) {
|
||||
VERIFY(!default_export);
|
||||
VERIFY(export_statement.entries().size() == 1);
|
||||
VERIFY(export_statement.has_statement());
|
||||
VERIFY(export_statement->entries().size() == 1);
|
||||
VERIFY(export_statement->has_statement());
|
||||
|
||||
auto const& entry = export_statement.entries()[0];
|
||||
auto const& entry = export_statement->entries()[0];
|
||||
VERIFY(entry.kind == ExportEntry::Kind::NamedExport);
|
||||
VERIFY(!entry.is_module_request());
|
||||
VERIFY(import_entries.find_if(
|
||||
|
@ -179,12 +179,12 @@ Result<NonnullGCPtr<SourceTextModule>, Vector<ParserError>> SourceTextModule::pa
|
|||
default_export = export_statement;
|
||||
}
|
||||
|
||||
for (auto const& export_entry : export_statement.entries()) {
|
||||
for (auto const& export_entry : export_statement->entries()) {
|
||||
|
||||
// Special case, export {} from "module" should add "module" to
|
||||
// required_modules but not any import or export so skip here.
|
||||
if (export_entry.kind == ExportEntry::Kind::EmptyNamedExport) {
|
||||
VERIFY(export_statement.entries().size() == 1);
|
||||
VERIFY(export_statement->entries().size() == 1);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ Node const* PageNode::parent() const
|
|||
|
||||
ErrorOr<Span<NonnullRefPtr<Node const>>> PageNode::children() const
|
||||
{
|
||||
static NonnullRefPtrVector<Node const> empty_vector;
|
||||
static Vector<NonnullRefPtr<Node const>> empty_vector;
|
||||
return empty_vector.span();
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ protected:
|
|||
private:
|
||||
ErrorOr<void> reify_if_needed() const;
|
||||
|
||||
mutable NonnullRefPtrVector<Node const> m_children;
|
||||
mutable Vector<NonnullRefPtr<Node const>> m_children;
|
||||
mutable bool m_reified { false };
|
||||
bool m_open { false };
|
||||
};
|
||||
|
|
|
@ -17,7 +17,7 @@ DeprecatedString OutlineItem::to_deprecated_string(int indent) const
|
|||
StringBuilder child_builder;
|
||||
child_builder.append('[');
|
||||
for (auto& child : children)
|
||||
child_builder.appendff("{}\n", child.to_deprecated_string(indent + 1));
|
||||
child_builder.appendff("{}\n", child->to_deprecated_string(indent + 1));
|
||||
child_builder.appendff("{}]", indent_str);
|
||||
|
||||
StringBuilder builder;
|
||||
|
@ -335,7 +335,7 @@ PDFErrorOr<NonnullRefPtr<OutlineItem>> Document::build_outline_item(NonnullRefPt
|
|||
auto first_ref = outline_item_dict->get_value(CommonNames::First);
|
||||
auto children = TRY(build_outline_item_chain(first_ref, page_number_by_index_ref));
|
||||
for (auto& child : children) {
|
||||
child.parent = outline_item;
|
||||
child->parent = outline_item;
|
||||
}
|
||||
outline_item->children = move(children);
|
||||
}
|
||||
|
@ -390,7 +390,7 @@ PDFErrorOr<NonnullRefPtr<OutlineItem>> Document::build_outline_item(NonnullRefPt
|
|||
return outline_item;
|
||||
}
|
||||
|
||||
PDFErrorOr<NonnullRefPtrVector<OutlineItem>> Document::build_outline_item_chain(Value const& first_ref, HashMap<u32, u32> const& page_number_by_index_ref)
|
||||
PDFErrorOr<Vector<NonnullRefPtr<OutlineItem>>> Document::build_outline_item_chain(Value const& first_ref, HashMap<u32, u32> const& page_number_by_index_ref)
|
||||
{
|
||||
// We used to receive a last_ref parameter, which was what the parent of this chain
|
||||
// thought was this chain's last child. There are documents out there in the wild
|
||||
|
@ -399,7 +399,7 @@ PDFErrorOr<NonnullRefPtrVector<OutlineItem>> Document::build_outline_item_chain(
|
|||
// (we already ignore the /Parent attribute too, which can also be out of sync).
|
||||
VERIFY(first_ref.has<Reference>());
|
||||
|
||||
NonnullRefPtrVector<OutlineItem> children;
|
||||
Vector<NonnullRefPtr<OutlineItem>> children;
|
||||
|
||||
auto first_value = TRY(get_or_load_value(first_ref.as_ref_index())).get<NonnullRefPtr<Object>>();
|
||||
auto first_dict = first_value->cast<DictObject>();
|
||||
|
|
|
@ -56,7 +56,7 @@ struct Destination {
|
|||
|
||||
struct OutlineItem final : public RefCounted<OutlineItem> {
|
||||
RefPtr<OutlineItem> parent;
|
||||
NonnullRefPtrVector<OutlineItem> children;
|
||||
Vector<NonnullRefPtr<OutlineItem>> children;
|
||||
DeprecatedString title;
|
||||
i32 count { 0 };
|
||||
Destination dest;
|
||||
|
@ -70,7 +70,7 @@ struct OutlineItem final : public RefCounted<OutlineItem> {
|
|||
};
|
||||
|
||||
struct OutlineDict final : public RefCounted<OutlineDict> {
|
||||
NonnullRefPtrVector<OutlineItem> children;
|
||||
Vector<NonnullRefPtr<OutlineItem>> children;
|
||||
u32 count { 0 };
|
||||
|
||||
OutlineDict() = default;
|
||||
|
@ -138,7 +138,7 @@ private:
|
|||
|
||||
PDFErrorOr<void> build_outline();
|
||||
PDFErrorOr<NonnullRefPtr<OutlineItem>> build_outline_item(NonnullRefPtr<DictObject> const& outline_item_dict, HashMap<u32, u32> const&);
|
||||
PDFErrorOr<NonnullRefPtrVector<OutlineItem>> build_outline_item_chain(Value const& first_ref, HashMap<u32, u32> const&);
|
||||
PDFErrorOr<Vector<NonnullRefPtr<OutlineItem>>> build_outline_item_chain(Value const& first_ref, HashMap<u32, u32> const&);
|
||||
|
||||
PDFErrorOr<Destination> create_destination_from_parameters(NonnullRefPtr<ArrayObject>, HashMap<u32, u32> const&);
|
||||
PDFErrorOr<Destination> create_destination_from_dictionary_entry(NonnullRefPtr<Object> const& entry, HashMap<u32, u32> const& page_number_by_index_ref);
|
||||
|
@ -258,7 +258,7 @@ struct Formatter<PDF::OutlineDict> : Formatter<FormatString> {
|
|||
StringBuilder child_builder;
|
||||
child_builder.append('[');
|
||||
for (auto& child : dict.children)
|
||||
child_builder.appendff("{}\n", child.to_deprecated_string(2));
|
||||
child_builder.appendff("{}\n", child->to_deprecated_string(2));
|
||||
child_builder.append(" ]"sv);
|
||||
|
||||
return Formatter<FormatString>::format(builder,
|
||||
|
|
|
@ -238,7 +238,7 @@ RENDERER_HANDLER(path_cubic_bezier_curve_no_first_control)
|
|||
{
|
||||
VERIFY(args.size() == 4);
|
||||
VERIFY(!m_current_path.segments().is_empty());
|
||||
auto current_point = m_current_path.segments().rbegin()->point();
|
||||
auto current_point = (*m_current_path.segments().rbegin())->point();
|
||||
m_current_path.cubic_bezier_curve_to(
|
||||
current_point,
|
||||
map(args[0].to_float(), args[1].to_float()),
|
||||
|
|
|
@ -55,7 +55,7 @@ private:
|
|||
|
||||
class TypeName : public ASTNode {
|
||||
public:
|
||||
TypeName(DeprecatedString name, NonnullRefPtrVector<SignedNumber> signed_numbers)
|
||||
TypeName(DeprecatedString name, Vector<NonnullRefPtr<SignedNumber>> signed_numbers)
|
||||
: m_name(move(name))
|
||||
, m_signed_numbers(move(signed_numbers))
|
||||
{
|
||||
|
@ -63,11 +63,11 @@ public:
|
|||
}
|
||||
|
||||
DeprecatedString const& name() const { return m_name; }
|
||||
NonnullRefPtrVector<SignedNumber> const& signed_numbers() const { return m_signed_numbers; }
|
||||
Vector<NonnullRefPtr<SignedNumber>> const& signed_numbers() const { return m_signed_numbers; }
|
||||
|
||||
private:
|
||||
DeprecatedString m_name;
|
||||
NonnullRefPtrVector<SignedNumber> m_signed_numbers;
|
||||
Vector<NonnullRefPtr<SignedNumber>> m_signed_numbers;
|
||||
};
|
||||
|
||||
class ColumnDefinition : public ASTNode {
|
||||
|
@ -107,7 +107,7 @@ private:
|
|||
|
||||
class CommonTableExpressionList : public ASTNode {
|
||||
public:
|
||||
CommonTableExpressionList(bool recursive, NonnullRefPtrVector<CommonTableExpression> common_table_expressions)
|
||||
CommonTableExpressionList(bool recursive, Vector<NonnullRefPtr<CommonTableExpression>> common_table_expressions)
|
||||
: m_recursive(recursive)
|
||||
, m_common_table_expressions(move(common_table_expressions))
|
||||
{
|
||||
|
@ -115,11 +115,11 @@ public:
|
|||
}
|
||||
|
||||
bool recursive() const { return m_recursive; }
|
||||
NonnullRefPtrVector<CommonTableExpression> const& common_table_expressions() const { return m_common_table_expressions; }
|
||||
Vector<NonnullRefPtr<CommonTableExpression>> const& common_table_expressions() const { return m_common_table_expressions; }
|
||||
|
||||
private:
|
||||
bool m_recursive;
|
||||
NonnullRefPtrVector<CommonTableExpression> m_common_table_expressions;
|
||||
Vector<NonnullRefPtr<CommonTableExpression>> m_common_table_expressions;
|
||||
};
|
||||
|
||||
class QualifiedTableName : public ASTNode {
|
||||
|
@ -205,18 +205,18 @@ private:
|
|||
|
||||
class GroupByClause : public ASTNode {
|
||||
public:
|
||||
GroupByClause(NonnullRefPtrVector<Expression> group_by_list, RefPtr<Expression> having_clause)
|
||||
GroupByClause(Vector<NonnullRefPtr<Expression>> group_by_list, RefPtr<Expression> having_clause)
|
||||
: m_group_by_list(move(group_by_list))
|
||||
, m_having_clause(move(having_clause))
|
||||
{
|
||||
VERIFY(!m_group_by_list.is_empty());
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<Expression> const& group_by_list() const { return m_group_by_list; }
|
||||
Vector<NonnullRefPtr<Expression>> const& group_by_list() const { return m_group_by_list; }
|
||||
RefPtr<Expression> const& having_clause() const { return m_having_clause; }
|
||||
|
||||
private:
|
||||
NonnullRefPtrVector<Expression> m_group_by_list;
|
||||
Vector<NonnullRefPtr<Expression>> m_group_by_list;
|
||||
RefPtr<Expression> m_having_clause;
|
||||
};
|
||||
|
||||
|
@ -232,7 +232,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
explicit TableOrSubquery(NonnullRefPtrVector<TableOrSubquery> subqueries)
|
||||
explicit TableOrSubquery(Vector<NonnullRefPtr<TableOrSubquery>> subqueries)
|
||||
: m_is_subquery(!subqueries.is_empty())
|
||||
, m_subqueries(move(subqueries))
|
||||
{
|
||||
|
@ -244,7 +244,7 @@ public:
|
|||
DeprecatedString const& table_alias() const { return m_table_alias; }
|
||||
|
||||
bool is_subquery() const { return m_is_subquery; }
|
||||
NonnullRefPtrVector<TableOrSubquery> const& subqueries() const { return m_subqueries; }
|
||||
Vector<NonnullRefPtr<TableOrSubquery>> const& subqueries() const { return m_subqueries; }
|
||||
|
||||
private:
|
||||
bool m_is_table { false };
|
||||
|
@ -253,7 +253,7 @@ private:
|
|||
DeprecatedString m_table_alias {};
|
||||
|
||||
bool m_is_subquery { false };
|
||||
NonnullRefPtrVector<TableOrSubquery> m_subqueries {};
|
||||
Vector<NonnullRefPtr<TableOrSubquery>> m_subqueries {};
|
||||
};
|
||||
|
||||
class OrderingTerm : public ASTNode {
|
||||
|
@ -573,16 +573,16 @@ private:
|
|||
|
||||
class ChainedExpression : public Expression {
|
||||
public:
|
||||
explicit ChainedExpression(NonnullRefPtrVector<Expression> expressions)
|
||||
explicit ChainedExpression(Vector<NonnullRefPtr<Expression>> expressions)
|
||||
: m_expressions(move(expressions))
|
||||
{
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<Expression> const& expressions() const { return m_expressions; }
|
||||
Vector<NonnullRefPtr<Expression>> const& expressions() const { return m_expressions; }
|
||||
virtual ResultOr<Value> evaluate(ExecutionContext&) const override;
|
||||
|
||||
private:
|
||||
NonnullRefPtrVector<Expression> m_expressions;
|
||||
Vector<NonnullRefPtr<Expression>> m_expressions;
|
||||
};
|
||||
|
||||
class CastExpression : public NestedExpression {
|
||||
|
@ -800,7 +800,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
CreateTable(DeprecatedString schema_name, DeprecatedString table_name, NonnullRefPtrVector<ColumnDefinition> columns, bool is_temporary, bool is_error_if_table_exists)
|
||||
CreateTable(DeprecatedString schema_name, DeprecatedString table_name, Vector<NonnullRefPtr<ColumnDefinition>> columns, bool is_temporary, bool is_error_if_table_exists)
|
||||
: m_schema_name(move(schema_name))
|
||||
, m_table_name(move(table_name))
|
||||
, m_columns(move(columns))
|
||||
|
@ -816,7 +816,7 @@ public:
|
|||
RefPtr<Select> const& select_statement() const { return m_select_statement; }
|
||||
|
||||
bool has_columns() const { return !m_columns.is_empty(); }
|
||||
NonnullRefPtrVector<ColumnDefinition> const& columns() const { return m_columns; }
|
||||
Vector<NonnullRefPtr<ColumnDefinition>> const& columns() const { return m_columns; }
|
||||
|
||||
bool is_temporary() const { return m_is_temporary; }
|
||||
bool is_error_if_table_exists() const { return m_is_error_if_table_exists; }
|
||||
|
@ -827,7 +827,7 @@ private:
|
|||
DeprecatedString m_schema_name;
|
||||
DeprecatedString m_table_name;
|
||||
RefPtr<Select> m_select_statement;
|
||||
NonnullRefPtrVector<ColumnDefinition> m_columns;
|
||||
Vector<NonnullRefPtr<ColumnDefinition>> m_columns;
|
||||
bool m_is_temporary;
|
||||
bool m_is_error_if_table_exists;
|
||||
};
|
||||
|
@ -937,7 +937,7 @@ enum class ConflictResolution {
|
|||
|
||||
class Insert : public Statement {
|
||||
public:
|
||||
Insert(RefPtr<CommonTableExpressionList> common_table_expression_list, ConflictResolution conflict_resolution, DeprecatedString schema_name, DeprecatedString table_name, DeprecatedString alias, Vector<DeprecatedString> column_names, NonnullRefPtrVector<ChainedExpression> chained_expressions)
|
||||
Insert(RefPtr<CommonTableExpressionList> common_table_expression_list, ConflictResolution conflict_resolution, DeprecatedString schema_name, DeprecatedString table_name, DeprecatedString alias, Vector<DeprecatedString> column_names, Vector<NonnullRefPtr<ChainedExpression>> chained_expressions)
|
||||
: m_common_table_expression_list(move(common_table_expression_list))
|
||||
, m_conflict_resolution(conflict_resolution)
|
||||
, m_schema_name(move(schema_name))
|
||||
|
@ -979,7 +979,7 @@ public:
|
|||
bool default_values() const { return !has_expressions() && !has_selection(); };
|
||||
|
||||
bool has_expressions() const { return !m_chained_expressions.is_empty(); }
|
||||
NonnullRefPtrVector<ChainedExpression> const& chained_expressions() const { return m_chained_expressions; }
|
||||
Vector<NonnullRefPtr<ChainedExpression>> const& chained_expressions() const { return m_chained_expressions; }
|
||||
|
||||
bool has_selection() const { return !m_select_statement.is_null(); }
|
||||
RefPtr<Select> const& select_statement() const { return m_select_statement; }
|
||||
|
@ -993,7 +993,7 @@ private:
|
|||
DeprecatedString m_table_name;
|
||||
DeprecatedString m_alias;
|
||||
Vector<DeprecatedString> m_column_names;
|
||||
NonnullRefPtrVector<ChainedExpression> m_chained_expressions;
|
||||
Vector<NonnullRefPtr<ChainedExpression>> m_chained_expressions;
|
||||
RefPtr<Select> m_select_statement;
|
||||
};
|
||||
|
||||
|
@ -1004,7 +1004,7 @@ public:
|
|||
NonnullRefPtr<Expression> expression;
|
||||
};
|
||||
|
||||
Update(RefPtr<CommonTableExpressionList> common_table_expression_list, ConflictResolution conflict_resolution, NonnullRefPtr<QualifiedTableName> qualified_table_name, Vector<UpdateColumns> update_columns, NonnullRefPtrVector<TableOrSubquery> table_or_subquery_list, RefPtr<Expression> where_clause, RefPtr<ReturningClause> returning_clause)
|
||||
Update(RefPtr<CommonTableExpressionList> common_table_expression_list, ConflictResolution conflict_resolution, NonnullRefPtr<QualifiedTableName> qualified_table_name, Vector<UpdateColumns> update_columns, Vector<NonnullRefPtr<TableOrSubquery>> table_or_subquery_list, RefPtr<Expression> where_clause, RefPtr<ReturningClause> returning_clause)
|
||||
: m_common_table_expression_list(move(common_table_expression_list))
|
||||
, m_conflict_resolution(conflict_resolution)
|
||||
, m_qualified_table_name(move(qualified_table_name))
|
||||
|
@ -1019,7 +1019,7 @@ public:
|
|||
ConflictResolution conflict_resolution() const { return m_conflict_resolution; }
|
||||
NonnullRefPtr<QualifiedTableName> const& qualified_table_name() const { return m_qualified_table_name; }
|
||||
Vector<UpdateColumns> const& update_columns() const { return m_update_columns; }
|
||||
NonnullRefPtrVector<TableOrSubquery> const& table_or_subquery_list() const { return m_table_or_subquery_list; }
|
||||
Vector<NonnullRefPtr<TableOrSubquery>> const& table_or_subquery_list() const { return m_table_or_subquery_list; }
|
||||
RefPtr<Expression> const& where_clause() const { return m_where_clause; }
|
||||
RefPtr<ReturningClause> const& returning_clause() const { return m_returning_clause; }
|
||||
|
||||
|
@ -1030,7 +1030,7 @@ private:
|
|||
ConflictResolution m_conflict_resolution;
|
||||
NonnullRefPtr<QualifiedTableName> m_qualified_table_name;
|
||||
Vector<UpdateColumns> m_update_columns;
|
||||
NonnullRefPtrVector<TableOrSubquery> m_table_or_subquery_list;
|
||||
Vector<NonnullRefPtr<TableOrSubquery>> m_table_or_subquery_list;
|
||||
RefPtr<Expression> m_where_clause;
|
||||
RefPtr<ReturningClause> m_returning_clause;
|
||||
};
|
||||
|
@ -1061,7 +1061,7 @@ private:
|
|||
|
||||
class Select : public Statement {
|
||||
public:
|
||||
Select(RefPtr<CommonTableExpressionList> common_table_expression_list, bool select_all, NonnullRefPtrVector<ResultColumn> result_column_list, NonnullRefPtrVector<TableOrSubquery> table_or_subquery_list, RefPtr<Expression> where_clause, RefPtr<GroupByClause> group_by_clause, NonnullRefPtrVector<OrderingTerm> ordering_term_list, RefPtr<LimitClause> limit_clause)
|
||||
Select(RefPtr<CommonTableExpressionList> common_table_expression_list, bool select_all, Vector<NonnullRefPtr<ResultColumn>> result_column_list, Vector<NonnullRefPtr<TableOrSubquery>> table_or_subquery_list, RefPtr<Expression> where_clause, RefPtr<GroupByClause> group_by_clause, Vector<NonnullRefPtr<OrderingTerm>> ordering_term_list, RefPtr<LimitClause> limit_clause)
|
||||
: m_common_table_expression_list(move(common_table_expression_list))
|
||||
, m_select_all(move(select_all))
|
||||
, m_result_column_list(move(result_column_list))
|
||||
|
@ -1075,22 +1075,22 @@ public:
|
|||
|
||||
RefPtr<CommonTableExpressionList> const& common_table_expression_list() const { return m_common_table_expression_list; }
|
||||
bool select_all() const { return m_select_all; }
|
||||
NonnullRefPtrVector<ResultColumn> const& result_column_list() const { return m_result_column_list; }
|
||||
NonnullRefPtrVector<TableOrSubquery> const& table_or_subquery_list() const { return m_table_or_subquery_list; }
|
||||
Vector<NonnullRefPtr<ResultColumn>> const& result_column_list() const { return m_result_column_list; }
|
||||
Vector<NonnullRefPtr<TableOrSubquery>> const& table_or_subquery_list() const { return m_table_or_subquery_list; }
|
||||
RefPtr<Expression> const& where_clause() const { return m_where_clause; }
|
||||
RefPtr<GroupByClause> const& group_by_clause() const { return m_group_by_clause; }
|
||||
NonnullRefPtrVector<OrderingTerm> const& ordering_term_list() const { return m_ordering_term_list; }
|
||||
Vector<NonnullRefPtr<OrderingTerm>> const& ordering_term_list() const { return m_ordering_term_list; }
|
||||
RefPtr<LimitClause> const& limit_clause() const { return m_limit_clause; }
|
||||
ResultOr<ResultSet> execute(ExecutionContext&) const override;
|
||||
|
||||
private:
|
||||
RefPtr<CommonTableExpressionList> m_common_table_expression_list;
|
||||
bool m_select_all;
|
||||
NonnullRefPtrVector<ResultColumn> m_result_column_list;
|
||||
NonnullRefPtrVector<TableOrSubquery> m_table_or_subquery_list;
|
||||
Vector<NonnullRefPtr<ResultColumn>> m_result_column_list;
|
||||
Vector<NonnullRefPtr<TableOrSubquery>> m_table_or_subquery_list;
|
||||
RefPtr<Expression> m_where_clause;
|
||||
RefPtr<GroupByClause> m_group_by_clause;
|
||||
NonnullRefPtrVector<OrderingTerm> m_ordering_term_list;
|
||||
Vector<NonnullRefPtr<OrderingTerm>> m_ordering_term_list;
|
||||
RefPtr<LimitClause> m_limit_clause;
|
||||
};
|
||||
|
||||
|
|
|
@ -17,18 +17,18 @@ ResultOr<ResultSet> CreateTable::execute(ExecutionContext& context) const
|
|||
for (auto const& column : m_columns) {
|
||||
SQLType type;
|
||||
|
||||
if (column.type_name()->name().is_one_of("VARCHAR"sv, "TEXT"sv))
|
||||
if (column->type_name()->name().is_one_of("VARCHAR"sv, "TEXT"sv))
|
||||
type = SQLType::Text;
|
||||
else if (column.type_name()->name().is_one_of("INT"sv, "INTEGER"sv))
|
||||
else if (column->type_name()->name().is_one_of("INT"sv, "INTEGER"sv))
|
||||
type = SQLType::Integer;
|
||||
else if (column.type_name()->name().is_one_of("FLOAT"sv, "NUMBER"sv))
|
||||
else if (column->type_name()->name().is_one_of("FLOAT"sv, "NUMBER"sv))
|
||||
type = SQLType::Float;
|
||||
else if (column.type_name()->name().is_one_of("BOOL"sv, "BOOLEAN"sv))
|
||||
else if (column->type_name()->name().is_one_of("BOOL"sv, "BOOLEAN"sv))
|
||||
type = SQLType::Boolean;
|
||||
else
|
||||
return Result { SQLCommand::Create, SQLErrorCode::InvalidType, column.type_name()->name() };
|
||||
return Result { SQLCommand::Create, SQLErrorCode::InvalidType, column->type_name()->name() };
|
||||
|
||||
table_def->append_column(column.name(), type);
|
||||
table_def->append_column(column->name(), type);
|
||||
}
|
||||
|
||||
if (auto result = context.database->add_table(*table_def); result.is_error()) {
|
||||
|
|
|
@ -26,8 +26,8 @@ ResultOr<ResultSet> DescribeTable::execute(ExecutionContext& context) const
|
|||
|
||||
for (auto& column : table_def->columns()) {
|
||||
Tuple tuple(descriptor);
|
||||
tuple[0] = column.name();
|
||||
tuple[1] = SQLType_name(column.type());
|
||||
tuple[0] = column->name();
|
||||
tuple[1] = SQLType_name(column->type());
|
||||
|
||||
result.insert_row(tuple, Tuple {});
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ ResultOr<Value> ChainedExpression::evaluate(ExecutionContext& context) const
|
|||
TRY(values.try_ensure_capacity(expressions().size()));
|
||||
|
||||
for (auto& expression : expressions())
|
||||
values.unchecked_append(TRY(expression.evaluate(context)));
|
||||
values.unchecked_append(TRY(expression->evaluate(context)));
|
||||
|
||||
return Value::create_tuple(move(values));
|
||||
}
|
||||
|
|
|
@ -27,11 +27,11 @@ ResultOr<ResultSet> Insert::execute(ExecutionContext& context) const
|
|||
|
||||
for (auto& row_expr : m_chained_expressions) {
|
||||
for (auto& column_def : table_def->columns()) {
|
||||
if (!m_column_names.contains_slow(column_def.name()))
|
||||
row[column_def.name()] = column_def.default_value();
|
||||
if (!m_column_names.contains_slow(column_def->name()))
|
||||
row[column_def->name()] = column_def->default_value();
|
||||
}
|
||||
|
||||
auto row_value = TRY(row_expr.evaluate(context));
|
||||
auto row_value = TRY(row_expr->evaluate(context));
|
||||
VERIFY(row_value.type() == SQLType::Tuple);
|
||||
|
||||
auto values = row_value.to_vector().release_value();
|
||||
|
@ -46,7 +46,7 @@ ResultOr<ResultSet> Insert::execute(ExecutionContext& context) const
|
|||
auto element_type = tuple_descriptor[element_index].type;
|
||||
|
||||
if (!values[ix].is_type_compatible_with(element_type))
|
||||
return Result { SQLCommand::Insert, SQLErrorCode::InvalidValueType, table_def->columns()[element_index].name() };
|
||||
return Result { SQLCommand::Insert, SQLErrorCode::InvalidValueType, table_def->columns()[element_index]->name() };
|
||||
|
||||
row[element_index] = move(values[ix]);
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ NonnullRefPtr<CreateTable> Parser::parse_create_table_statement()
|
|||
return create_ast_node<CreateTable>(move(schema_name), move(table_name), move(select_statement), is_temporary, is_error_if_table_exists);
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<ColumnDefinition> column_definitions;
|
||||
Vector<NonnullRefPtr<ColumnDefinition>> column_definitions;
|
||||
parse_comma_separated_list(true, [&]() { column_definitions.append(parse_column_definition()); });
|
||||
|
||||
// FIXME: Parse "table-constraint".
|
||||
|
@ -213,7 +213,7 @@ NonnullRefPtr<Insert> Parser::parse_insert_statement(RefPtr<CommonTableExpressio
|
|||
if (match(TokenType::ParenOpen))
|
||||
parse_comma_separated_list(true, [&]() { column_names.append(consume(TokenType::Identifier).value()); });
|
||||
|
||||
NonnullRefPtrVector<ChainedExpression> chained_expressions;
|
||||
Vector<NonnullRefPtr<ChainedExpression>> chained_expressions;
|
||||
RefPtr<Select> select_statement;
|
||||
|
||||
if (consume_if(TokenType::Values)) {
|
||||
|
@ -271,7 +271,7 @@ NonnullRefPtr<Update> Parser::parse_update_statement(RefPtr<CommonTableExpressio
|
|||
update_columns.append({ move(column_names), parse_expression() });
|
||||
});
|
||||
|
||||
NonnullRefPtrVector<TableOrSubquery> table_or_subquery_list;
|
||||
Vector<NonnullRefPtr<TableOrSubquery>> table_or_subquery_list;
|
||||
if (consume_if(TokenType::From)) {
|
||||
// FIXME: Parse join-clause.
|
||||
parse_comma_separated_list(false, [&]() { table_or_subquery_list.append(parse_table_or_subquery()); });
|
||||
|
@ -314,10 +314,10 @@ NonnullRefPtr<Select> Parser::parse_select_statement(RefPtr<CommonTableExpressio
|
|||
bool select_all = !consume_if(TokenType::Distinct);
|
||||
consume_if(TokenType::All); // ALL is the default, so ignore it if specified.
|
||||
|
||||
NonnullRefPtrVector<ResultColumn> result_column_list;
|
||||
Vector<NonnullRefPtr<ResultColumn>> result_column_list;
|
||||
parse_comma_separated_list(false, [&]() { result_column_list.append(parse_result_column()); });
|
||||
|
||||
NonnullRefPtrVector<TableOrSubquery> table_or_subquery_list;
|
||||
Vector<NonnullRefPtr<TableOrSubquery>> table_or_subquery_list;
|
||||
if (consume_if(TokenType::From)) {
|
||||
// FIXME: Parse join-clause.
|
||||
parse_comma_separated_list(false, [&]() { table_or_subquery_list.append(parse_table_or_subquery()); });
|
||||
|
@ -331,7 +331,7 @@ NonnullRefPtr<Select> Parser::parse_select_statement(RefPtr<CommonTableExpressio
|
|||
if (consume_if(TokenType::Group)) {
|
||||
consume(TokenType::By);
|
||||
|
||||
NonnullRefPtrVector<Expression> group_by_list;
|
||||
Vector<NonnullRefPtr<Expression>> group_by_list;
|
||||
parse_comma_separated_list(false, [&]() { group_by_list.append(parse_expression()); });
|
||||
|
||||
if (!group_by_list.is_empty()) {
|
||||
|
@ -346,7 +346,7 @@ NonnullRefPtr<Select> Parser::parse_select_statement(RefPtr<CommonTableExpressio
|
|||
// FIXME: Parse 'WINDOW window-name AS window-defn'.
|
||||
// FIXME: Parse 'compound-operator'.
|
||||
|
||||
NonnullRefPtrVector<OrderingTerm> ordering_term_list;
|
||||
Vector<NonnullRefPtr<OrderingTerm>> ordering_term_list;
|
||||
if (consume_if(TokenType::Order)) {
|
||||
consume(TokenType::By);
|
||||
parse_comma_separated_list(false, [&]() { ordering_term_list.append(parse_ordering_term()); });
|
||||
|
@ -377,7 +377,7 @@ RefPtr<CommonTableExpressionList> Parser::parse_common_table_expression_list()
|
|||
consume(TokenType::With);
|
||||
bool recursive = consume_if(TokenType::Recursive);
|
||||
|
||||
NonnullRefPtrVector<CommonTableExpression> common_table_expression;
|
||||
Vector<NonnullRefPtr<CommonTableExpression>> common_table_expression;
|
||||
parse_comma_separated_list(false, [&]() { common_table_expression.append(parse_common_table_expression()); });
|
||||
|
||||
if (common_table_expression.is_empty()) {
|
||||
|
@ -670,7 +670,7 @@ RefPtr<Expression> Parser::parse_chained_expression()
|
|||
if (match(TokenType::Select))
|
||||
return parse_exists_expression(false, TokenType::Select);
|
||||
|
||||
NonnullRefPtrVector<Expression> expressions;
|
||||
Vector<NonnullRefPtr<Expression>> expressions;
|
||||
parse_comma_separated_list(false, [&]() { expressions.append(parse_expression()); });
|
||||
consume(TokenType::ParenClose);
|
||||
|
||||
|
@ -854,7 +854,7 @@ RefPtr<Expression> Parser::parse_in_expression(NonnullRefPtr<Expression> express
|
|||
|
||||
// FIXME: Consolidate this with parse_chained_expression(). That method consumes the opening paren as
|
||||
// well, and also requires at least one expression (whereas this allows for an empty chain).
|
||||
NonnullRefPtrVector<Expression> expressions;
|
||||
Vector<NonnullRefPtr<Expression>> expressions;
|
||||
if (!match(TokenType::ParenClose))
|
||||
parse_comma_separated_list(false, [&]() { expressions.append(parse_expression()); });
|
||||
|
||||
|
@ -884,7 +884,7 @@ NonnullRefPtr<ColumnDefinition> Parser::parse_column_definition()
|
|||
auto type_name = match(TokenType::Identifier)
|
||||
? parse_type_name()
|
||||
// https://www.sqlite.org/datatype3.html: If no type is specified then the column has affinity BLOB.
|
||||
: create_ast_node<TypeName>("BLOB", NonnullRefPtrVector<SignedNumber> {});
|
||||
: create_ast_node<TypeName>("BLOB", Vector<NonnullRefPtr<SignedNumber>> {});
|
||||
|
||||
// FIXME: Parse "column-constraint".
|
||||
|
||||
|
@ -895,7 +895,7 @@ NonnullRefPtr<TypeName> Parser::parse_type_name()
|
|||
{
|
||||
// https: //sqlite.org/syntax/type-name.html
|
||||
auto name = consume(TokenType::Identifier).value();
|
||||
NonnullRefPtrVector<SignedNumber> signed_numbers;
|
||||
Vector<NonnullRefPtr<SignedNumber>> signed_numbers;
|
||||
|
||||
if (consume_if(TokenType::ParenOpen)) {
|
||||
signed_numbers.append(parse_signed_number());
|
||||
|
@ -1038,7 +1038,7 @@ NonnullRefPtr<TableOrSubquery> Parser::parse_table_or_subquery()
|
|||
|
||||
// FIXME: Parse join-clause.
|
||||
|
||||
NonnullRefPtrVector<TableOrSubquery> subqueries;
|
||||
Vector<NonnullRefPtr<TableOrSubquery>> subqueries;
|
||||
parse_comma_separated_list(true, [&]() { subqueries.append(parse_table_or_subquery()); });
|
||||
|
||||
return create_ast_node<TableOrSubquery>(move(subqueries));
|
||||
|
|
|
@ -39,41 +39,41 @@ static DeprecatedString result_column_name(ResultColumn const& column, size_t co
|
|||
|
||||
ResultOr<ResultSet> Select::execute(ExecutionContext& context) const
|
||||
{
|
||||
NonnullRefPtrVector<ResultColumn const> columns;
|
||||
Vector<NonnullRefPtr<ResultColumn const>> columns;
|
||||
Vector<DeprecatedString> column_names;
|
||||
|
||||
auto const& result_column_list = this->result_column_list();
|
||||
VERIFY(!result_column_list.is_empty());
|
||||
|
||||
for (auto& table_descriptor : table_or_subquery_list()) {
|
||||
if (!table_descriptor.is_table())
|
||||
if (!table_descriptor->is_table())
|
||||
return Result { SQLCommand::Select, SQLErrorCode::NotYetImplemented, "Sub-selects are not yet implemented"sv };
|
||||
|
||||
auto table_def = TRY(context.database->get_table(table_descriptor.schema_name(), table_descriptor.table_name()));
|
||||
auto table_def = TRY(context.database->get_table(table_descriptor->schema_name(), table_descriptor->table_name()));
|
||||
|
||||
if (result_column_list.size() == 1 && result_column_list[0].type() == ResultType::All) {
|
||||
if (result_column_list.size() == 1 && result_column_list[0]->type() == ResultType::All) {
|
||||
TRY(columns.try_ensure_capacity(columns.size() + table_def->columns().size()));
|
||||
TRY(column_names.try_ensure_capacity(column_names.size() + table_def->columns().size()));
|
||||
|
||||
for (auto& col : table_def->columns()) {
|
||||
columns.unchecked_append(
|
||||
create_ast_node<ResultColumn>(
|
||||
create_ast_node<ColumnNameExpression>(table_def->parent()->name(), table_def->name(), col.name()),
|
||||
create_ast_node<ColumnNameExpression>(table_def->parent()->name(), table_def->name(), col->name()),
|
||||
""));
|
||||
|
||||
column_names.unchecked_append(col.name());
|
||||
column_names.unchecked_append(col->name());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result_column_list.size() != 1 || result_column_list[0].type() != ResultType::All) {
|
||||
if (result_column_list.size() != 1 || result_column_list[0]->type() != ResultType::All) {
|
||||
TRY(columns.try_ensure_capacity(result_column_list.size()));
|
||||
TRY(column_names.try_ensure_capacity(result_column_list.size()));
|
||||
|
||||
for (size_t i = 0; i < result_column_list.size(); ++i) {
|
||||
auto const& col = result_column_list[i];
|
||||
|
||||
if (col.type() == ResultType::All) {
|
||||
if (col->type() == ResultType::All) {
|
||||
// FIXME can have '*' for example in conjunction with computed columns
|
||||
return Result { SQLCommand::Select, SQLErrorCode::SyntaxError, "*"sv };
|
||||
}
|
||||
|
@ -93,10 +93,10 @@ ResultOr<ResultSet> Select::execute(ExecutionContext& context) const
|
|||
rows.append(tuple);
|
||||
|
||||
for (auto& table_descriptor : table_or_subquery_list()) {
|
||||
if (!table_descriptor.is_table())
|
||||
if (!table_descriptor->is_table())
|
||||
return Result { SQLCommand::Select, SQLErrorCode::NotYetImplemented, "Sub-selects are not yet implemented"sv };
|
||||
|
||||
auto table_def = TRY(context.database->get_table(table_descriptor.schema_name(), table_descriptor.table_name()));
|
||||
auto table_def = TRY(context.database->get_table(table_descriptor->schema_name(), table_descriptor->table_name()));
|
||||
if (table_def->num_columns() == 0)
|
||||
continue;
|
||||
|
||||
|
@ -118,7 +118,7 @@ ResultOr<ResultSet> Select::execute(ExecutionContext& context) const
|
|||
bool has_ordering { false };
|
||||
auto sort_descriptor = adopt_ref(*new TupleDescriptor);
|
||||
for (auto& term : m_ordering_term_list) {
|
||||
sort_descriptor->append(TupleElementDescriptor { .order = term.order() });
|
||||
sort_descriptor->append(TupleElementDescriptor { .order = term->order() });
|
||||
has_ordering = true;
|
||||
}
|
||||
Tuple sort_key(sort_descriptor);
|
||||
|
@ -135,14 +135,14 @@ ResultOr<ResultSet> Select::execute(ExecutionContext& context) const
|
|||
tuple.clear();
|
||||
|
||||
for (auto& col : columns) {
|
||||
auto value = TRY(col.expression()->evaluate(context));
|
||||
auto value = TRY(col->expression()->evaluate(context));
|
||||
tuple.append(value);
|
||||
}
|
||||
|
||||
if (has_ordering) {
|
||||
sort_key.clear();
|
||||
for (auto& term : m_ordering_term_list) {
|
||||
auto value = TRY(term.expression()->evaluate(context));
|
||||
auto value = TRY(term->expression()->evaluate(context));
|
||||
sort_key.append(value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ ResultOr<void> Database::add_table(TableDef& table)
|
|||
return Result { SQLCommand::Unknown, SQLErrorCode::TableExists, table.name() };
|
||||
|
||||
for (auto& column : table.columns()) {
|
||||
if (!m_table_columns->insert(column.key()))
|
||||
if (!m_table_columns->insert(column->key()))
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ NonnullRefPtr<TupleDescriptor> IndexDef::to_tuple_descriptor() const
|
|||
{
|
||||
NonnullRefPtr<TupleDescriptor> ret = adopt_ref(*new TupleDescriptor);
|
||||
for (auto& part : m_key_definition) {
|
||||
ret->append({ "", "", part.name(), part.type(), part.sort_order() });
|
||||
ret->append({ "", "", part->name(), part->type(), part->sort_order() });
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ NonnullRefPtr<TupleDescriptor> TableDef::to_tuple_descriptor() const
|
|||
{
|
||||
NonnullRefPtr<TupleDescriptor> ret = adopt_ref(*new TupleDescriptor);
|
||||
for (auto& part : m_columns) {
|
||||
ret->append({ parent()->name(), name(), part.name(), part.type(), Order::Ascending });
|
||||
ret->append({ parent()->name(), name(), part->name(), part->type(), Order::Ascending });
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ class IndexDef : public Relation {
|
|||
public:
|
||||
~IndexDef() override = default;
|
||||
|
||||
NonnullRefPtrVector<KeyPartDef> const& key_definition() const { return m_key_definition; }
|
||||
Vector<NonnullRefPtr<KeyPartDef>> const& key_definition() const { return m_key_definition; }
|
||||
bool unique() const { return m_unique; }
|
||||
[[nodiscard]] size_t size() const { return m_key_definition.size(); }
|
||||
void append_column(DeprecatedString, SQLType, Order = Order::Ascending);
|
||||
|
@ -123,7 +123,7 @@ private:
|
|||
IndexDef(TableDef*, DeprecatedString, bool unique = true, u32 pointer = 0);
|
||||
explicit IndexDef(DeprecatedString, bool unique = true, u32 pointer = 0);
|
||||
|
||||
NonnullRefPtrVector<KeyPartDef> m_key_definition;
|
||||
Vector<NonnullRefPtr<KeyPartDef>> m_key_definition;
|
||||
bool m_unique { false };
|
||||
|
||||
friend TableDef;
|
||||
|
@ -138,8 +138,8 @@ public:
|
|||
void append_column(Key const&);
|
||||
size_t num_columns() { return m_columns.size(); }
|
||||
size_t num_indexes() { return m_indexes.size(); }
|
||||
NonnullRefPtrVector<ColumnDef> const& columns() const { return m_columns; }
|
||||
NonnullRefPtrVector<IndexDef> const& indexes() const { return m_indexes; }
|
||||
Vector<NonnullRefPtr<ColumnDef>> const& columns() const { return m_columns; }
|
||||
Vector<NonnullRefPtr<IndexDef>> const& indexes() const { return m_indexes; }
|
||||
[[nodiscard]] NonnullRefPtr<TupleDescriptor> to_tuple_descriptor() const;
|
||||
|
||||
static NonnullRefPtr<IndexDef> index_def();
|
||||
|
@ -149,8 +149,8 @@ public:
|
|||
private:
|
||||
explicit TableDef(SchemaDef*, DeprecatedString);
|
||||
|
||||
NonnullRefPtrVector<ColumnDef> m_columns;
|
||||
NonnullRefPtrVector<IndexDef> m_indexes;
|
||||
Vector<NonnullRefPtr<ColumnDef>> m_columns;
|
||||
Vector<NonnullRefPtr<IndexDef>> m_indexes;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ int TestSuite::main(DeprecatedString const& suite_name, Span<StringView> argumen
|
|||
if (do_list_cases) {
|
||||
outln("Available cases for {}:", suite_name);
|
||||
for (auto const& test : matching_tests) {
|
||||
outln(" {}", test.name());
|
||||
outln(" {}", test->name());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -91,18 +91,18 @@ int TestSuite::main(DeprecatedString const& suite_name, Span<StringView> argumen
|
|||
return run(matching_tests);
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<TestCase> TestSuite::find_cases(DeprecatedString const& search, bool find_tests, bool find_benchmarks)
|
||||
Vector<NonnullRefPtr<TestCase>> TestSuite::find_cases(DeprecatedString const& search, bool find_tests, bool find_benchmarks)
|
||||
{
|
||||
NonnullRefPtrVector<TestCase> matches;
|
||||
Vector<NonnullRefPtr<TestCase>> matches;
|
||||
for (auto& t : m_cases) {
|
||||
if (!search.is_empty() && !t.name().matches(search, CaseSensitivity::CaseInsensitive)) {
|
||||
if (!search.is_empty() && !t->name().matches(search, CaseSensitivity::CaseInsensitive)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!find_tests && !t.is_benchmark()) {
|
||||
if (!find_tests && !t->is_benchmark()) {
|
||||
continue;
|
||||
}
|
||||
if (!find_benchmarks && t.is_benchmark()) {
|
||||
if (!find_benchmarks && t->is_benchmark()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ NonnullRefPtrVector<TestCase> TestSuite::find_cases(DeprecatedString const& sear
|
|||
return matches;
|
||||
}
|
||||
|
||||
int TestSuite::run(NonnullRefPtrVector<TestCase> const& tests)
|
||||
int TestSuite::run(Vector<NonnullRefPtr<TestCase>> const& tests)
|
||||
{
|
||||
size_t test_count = 0;
|
||||
size_t test_failed_count = 0;
|
||||
|
@ -119,18 +119,18 @@ int TestSuite::run(NonnullRefPtrVector<TestCase> const& tests)
|
|||
TestElapsedTimer global_timer;
|
||||
|
||||
for (auto const& t : tests) {
|
||||
auto const test_type = t.is_benchmark() ? "benchmark" : "test";
|
||||
auto const test_type = t->is_benchmark() ? "benchmark" : "test";
|
||||
|
||||
warnln("Running {} '{}'.", test_type, t.name());
|
||||
warnln("Running {} '{}'.", test_type, t->name());
|
||||
m_current_test_case_passed = true;
|
||||
|
||||
TestElapsedTimer timer;
|
||||
t.func()();
|
||||
t->func()();
|
||||
auto const time = timer.elapsed_milliseconds();
|
||||
|
||||
dbgln("{} {} '{}' in {}ms", m_current_test_case_passed ? "Completed" : "Failed", test_type, t.name(), time);
|
||||
dbgln("{} {} '{}' in {}ms", m_current_test_case_passed ? "Completed" : "Failed", test_type, t->name(), time);
|
||||
|
||||
if (t.is_benchmark()) {
|
||||
if (t->is_benchmark()) {
|
||||
m_benchtime += time;
|
||||
benchmark_count++;
|
||||
} else {
|
||||
|
|
|
@ -32,9 +32,9 @@ public:
|
|||
s_global = nullptr;
|
||||
}
|
||||
|
||||
int run(NonnullRefPtrVector<TestCase> const&);
|
||||
int run(Vector<NonnullRefPtr<TestCase>> const&);
|
||||
int main(DeprecatedString const& suite_name, Span<StringView> arguments);
|
||||
NonnullRefPtrVector<TestCase> find_cases(DeprecatedString const& search, bool find_tests, bool find_benchmarks);
|
||||
Vector<NonnullRefPtr<TestCase>> find_cases(DeprecatedString const& search, bool find_tests, bool find_benchmarks);
|
||||
void add_case(NonnullRefPtr<TestCase> const& test_case)
|
||||
{
|
||||
m_cases.append(test_case);
|
||||
|
@ -46,7 +46,7 @@ public:
|
|||
|
||||
private:
|
||||
static TestSuite* s_global;
|
||||
NonnullRefPtrVector<TestCase> m_cases;
|
||||
Vector<NonnullRefPtr<TestCase>> m_cases;
|
||||
u64 m_testtime = 0;
|
||||
u64 m_benchtime = 0;
|
||||
DeprecatedString m_suite_name;
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<CSSStyleRule>> CSSStyleRule::create(JS::Realm& realm, NonnullRefPtrVector<Web::CSS::Selector>&& selectors, CSSStyleDeclaration& declaration)
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<CSSStyleRule>> CSSStyleRule::create(JS::Realm& realm, Vector<NonnullRefPtr<Web::CSS::Selector>>&& selectors, CSSStyleDeclaration& declaration)
|
||||
{
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<CSSStyleRule>(realm, realm, move(selectors), declaration));
|
||||
}
|
||||
|
||||
CSSStyleRule::CSSStyleRule(JS::Realm& realm, NonnullRefPtrVector<Selector>&& selectors, CSSStyleDeclaration& declaration)
|
||||
CSSStyleRule::CSSStyleRule(JS::Realm& realm, Vector<NonnullRefPtr<Selector>>&& selectors, CSSStyleDeclaration& declaration)
|
||||
: CSSRule(realm)
|
||||
, m_selectors(move(selectors))
|
||||
, m_declaration(declaration)
|
||||
|
|
|
@ -19,11 +19,11 @@ class CSSStyleRule final : public CSSRule {
|
|||
WEB_PLATFORM_OBJECT(CSSStyleRule, CSSRule);
|
||||
|
||||
public:
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<CSSStyleRule>> create(JS::Realm&, NonnullRefPtrVector<Selector>&&, CSSStyleDeclaration&);
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<CSSStyleRule>> create(JS::Realm&, Vector<NonnullRefPtr<Selector>>&&, CSSStyleDeclaration&);
|
||||
|
||||
virtual ~CSSStyleRule() override = default;
|
||||
|
||||
NonnullRefPtrVector<Selector> const& selectors() const { return m_selectors; }
|
||||
Vector<NonnullRefPtr<Selector>> const& selectors() const { return m_selectors; }
|
||||
CSSStyleDeclaration const& declaration() const { return m_declaration; }
|
||||
|
||||
virtual Type type() const override { return Type::Style; };
|
||||
|
@ -34,13 +34,13 @@ public:
|
|||
CSSStyleDeclaration* style();
|
||||
|
||||
private:
|
||||
CSSStyleRule(JS::Realm&, NonnullRefPtrVector<Selector>&&, CSSStyleDeclaration&);
|
||||
CSSStyleRule(JS::Realm&, Vector<NonnullRefPtr<Selector>>&&, CSSStyleDeclaration&);
|
||||
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
virtual DeprecatedString serialized() const override;
|
||||
|
||||
NonnullRefPtrVector<Selector> m_selectors;
|
||||
Vector<NonnullRefPtr<Selector>> m_selectors;
|
||||
CSSStyleDeclaration& m_declaration;
|
||||
};
|
||||
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<MediaList>> MediaList::create(JS::Realm& realm, NonnullRefPtrVector<MediaQuery>&& media)
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<MediaList>> MediaList::create(JS::Realm& realm, Vector<NonnullRefPtr<MediaQuery>>&& media)
|
||||
{
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<MediaList>(realm, realm, move(media)));
|
||||
}
|
||||
|
||||
MediaList::MediaList(JS::Realm& realm, NonnullRefPtrVector<MediaQuery>&& media)
|
||||
MediaList::MediaList(JS::Realm& realm, Vector<NonnullRefPtr<MediaQuery>>&& media)
|
||||
: Bindings::LegacyPlatformObject(realm)
|
||||
, m_media(move(media))
|
||||
{
|
||||
|
@ -58,7 +58,7 @@ DeprecatedString MediaList::item(u32 index) const
|
|||
if (!is_supported_property_index(index))
|
||||
return {};
|
||||
|
||||
return m_media[index].to_string().release_value_but_fixme_should_propagate_errors().to_deprecated_string();
|
||||
return m_media[index]->to_string().release_value_but_fixme_should_propagate_errors().to_deprecated_string();
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/cssom-1/#dom-medialist-appendmedium
|
||||
|
@ -74,7 +74,7 @@ void MediaList::append_medium(DeprecatedString medium)
|
|||
// 3. If comparing m with any of the media queries in the collection of media queries returns true, then return.
|
||||
auto serialized = m->to_string().release_value_but_fixme_should_propagate_errors();
|
||||
for (auto& existing_medium : m_media) {
|
||||
if (existing_medium.to_string().release_value_but_fixme_should_propagate_errors() == serialized)
|
||||
if (existing_medium->to_string().release_value_but_fixme_should_propagate_errors() == serialized)
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ void MediaList::delete_medium(DeprecatedString medium)
|
|||
bool MediaList::evaluate(HTML::Window const& window)
|
||||
{
|
||||
for (auto& media : m_media)
|
||||
media.evaluate(window);
|
||||
media->evaluate(window);
|
||||
|
||||
return matches();
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ bool MediaList::matches() const
|
|||
}
|
||||
|
||||
for (auto& media : m_media) {
|
||||
if (media.matches())
|
||||
if (media->matches())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -119,7 +119,7 @@ WebIDL::ExceptionOr<JS::Value> MediaList::item_value(size_t index) const
|
|||
{
|
||||
if (index >= m_media.size())
|
||||
return JS::js_undefined();
|
||||
return JS::PrimitiveString::create(vm(), m_media[index].to_string().release_value_but_fixme_should_propagate_errors().to_deprecated_string());
|
||||
return JS::PrimitiveString::create(vm(), m_media[index]->to_string().release_value_but_fixme_should_propagate_errors().to_deprecated_string());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ class MediaList final : public Bindings::LegacyPlatformObject {
|
|||
WEB_PLATFORM_OBJECT(MediaList, Bindings::LegacyPlatformObject);
|
||||
|
||||
public:
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<MediaList>> create(JS::Realm&, NonnullRefPtrVector<MediaQuery>&& media);
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<MediaList>> create(JS::Realm&, Vector<NonnullRefPtr<MediaQuery>>&& media);
|
||||
~MediaList() = default;
|
||||
|
||||
DeprecatedString media_text() const;
|
||||
|
@ -38,7 +38,7 @@ public:
|
|||
bool matches() const;
|
||||
|
||||
private:
|
||||
MediaList(JS::Realm&, NonnullRefPtrVector<MediaQuery>&&);
|
||||
MediaList(JS::Realm&, Vector<NonnullRefPtr<MediaQuery>>&&);
|
||||
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
|
||||
|
@ -55,7 +55,7 @@ private:
|
|||
virtual bool named_property_setter_has_identifier() const override { return false; }
|
||||
virtual bool named_property_deleter_has_identifier() const override { return false; }
|
||||
|
||||
NonnullRefPtrVector<MediaQuery> m_media;
|
||||
Vector<NonnullRefPtr<MediaQuery>> m_media;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -379,7 +379,7 @@ bool MediaQuery::evaluate(HTML::Window const& window)
|
|||
}
|
||||
|
||||
// https://www.w3.org/TR/cssom-1/#serialize-a-media-query-list
|
||||
ErrorOr<String> serialize_a_media_query_list(NonnullRefPtrVector<MediaQuery> const& media_queries)
|
||||
ErrorOr<String> serialize_a_media_query_list(Vector<NonnullRefPtr<MediaQuery>> const& media_queries)
|
||||
{
|
||||
// 1. If the media query list is empty, then return the empty string.
|
||||
if (media_queries.is_empty())
|
||||
|
|
|
@ -254,7 +254,7 @@ private:
|
|||
bool m_matches { false };
|
||||
};
|
||||
|
||||
ErrorOr<String> serialize_a_media_query_list(NonnullRefPtrVector<MediaQuery> const&);
|
||||
ErrorOr<String> serialize_a_media_query_list(Vector<NonnullRefPtr<MediaQuery>> const&);
|
||||
|
||||
bool is_media_feature_name(StringView name);
|
||||
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<MediaQueryList>> MediaQueryList::create(DOM::Document& document, NonnullRefPtrVector<MediaQuery>&& media)
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<MediaQueryList>> MediaQueryList::create(DOM::Document& document, Vector<NonnullRefPtr<MediaQuery>>&& media)
|
||||
{
|
||||
return MUST_OR_THROW_OOM(document.heap().allocate<MediaQueryList>(document.realm(), document, move(media)));
|
||||
}
|
||||
|
||||
MediaQueryList::MediaQueryList(DOM::Document& document, NonnullRefPtrVector<MediaQuery>&& media)
|
||||
MediaQueryList::MediaQueryList(DOM::Document& document, Vector<NonnullRefPtr<MediaQuery>>&& media)
|
||||
: DOM::EventTarget(document.realm())
|
||||
, m_document(document)
|
||||
, m_media(move(media))
|
||||
|
@ -52,7 +52,7 @@ DeprecatedString MediaQueryList::media() const
|
|||
bool MediaQueryList::matches() const
|
||||
{
|
||||
for (auto& media : m_media) {
|
||||
if (media.matches())
|
||||
if (media->matches())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -62,7 +62,7 @@ bool MediaQueryList::evaluate()
|
|||
{
|
||||
bool now_matches = false;
|
||||
for (auto& media : m_media) {
|
||||
now_matches = now_matches || media.evaluate(m_document->window());
|
||||
now_matches = now_matches || media->evaluate(m_document->window());
|
||||
}
|
||||
|
||||
return now_matches;
|
||||
|
|
|
@ -17,7 +17,7 @@ class MediaQueryList final : public DOM::EventTarget {
|
|||
WEB_PLATFORM_OBJECT(MediaQueryList, DOM::EventTarget);
|
||||
|
||||
public:
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<MediaQueryList>> create(DOM::Document&, NonnullRefPtrVector<MediaQuery>&&);
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<MediaQueryList>> create(DOM::Document&, Vector<NonnullRefPtr<MediaQuery>>&&);
|
||||
|
||||
virtual ~MediaQueryList() override = default;
|
||||
|
||||
|
@ -32,13 +32,13 @@ public:
|
|||
WebIDL::CallbackType* onchange();
|
||||
|
||||
private:
|
||||
MediaQueryList(DOM::Document&, NonnullRefPtrVector<MediaQuery>&&);
|
||||
MediaQueryList(DOM::Document&, Vector<NonnullRefPtr<MediaQuery>>&&);
|
||||
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
JS::NonnullGCPtr<DOM::Document> m_document;
|
||||
NonnullRefPtrVector<MediaQuery> m_media;
|
||||
Vector<NonnullRefPtr<MediaQuery>> m_media;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ Parser::ParseErrorOr<SelectorList> Parser::parse_a_selector_list(TokenStream<T>&
|
|||
{
|
||||
auto comma_separated_lists = parse_a_comma_separated_list_of_component_values(tokens);
|
||||
|
||||
NonnullRefPtrVector<Selector> selectors;
|
||||
Vector<NonnullRefPtr<Selector>> selectors;
|
||||
for (auto& selector_parts : comma_separated_lists) {
|
||||
auto stream = TokenStream(selector_parts);
|
||||
auto selector = parse_complex_selector(stream, mode);
|
||||
|
@ -662,19 +662,19 @@ Parser::ParseErrorOr<Optional<Selector::SimpleSelector>> Parser::parse_simple_se
|
|||
return ParseError::SyntaxError;
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<MediaQuery> Parser::parse_as_media_query_list()
|
||||
Vector<NonnullRefPtr<MediaQuery>> Parser::parse_as_media_query_list()
|
||||
{
|
||||
return parse_a_media_query_list(m_token_stream);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NonnullRefPtrVector<MediaQuery> Parser::parse_a_media_query_list(TokenStream<T>& tokens)
|
||||
Vector<NonnullRefPtr<MediaQuery>> Parser::parse_a_media_query_list(TokenStream<T>& tokens)
|
||||
{
|
||||
// https://www.w3.org/TR/mediaqueries-4/#mq-list
|
||||
|
||||
auto comma_separated_lists = parse_a_comma_separated_list_of_component_values(tokens);
|
||||
|
||||
AK::NonnullRefPtrVector<MediaQuery> media_queries;
|
||||
AK::Vector<NonnullRefPtr<MediaQuery>> media_queries;
|
||||
for (auto& media_query_parts : comma_separated_lists) {
|
||||
auto stream = TokenStream(media_query_parts);
|
||||
media_queries.append(parse_media_query(stream));
|
||||
|
@ -1443,12 +1443,12 @@ Optional<GeneralEnclosed> Parser::parse_general_enclosed(TokenStream<ComponentVa
|
|||
// 5.4.1. Consume a list of rules
|
||||
// https://www.w3.org/TR/css-syntax-3/#consume-list-of-rules
|
||||
template<typename T>
|
||||
NonnullRefPtrVector<Rule> Parser::consume_a_list_of_rules(TokenStream<T>& tokens, TopLevel top_level)
|
||||
Vector<NonnullRefPtr<Rule>> Parser::consume_a_list_of_rules(TokenStream<T>& tokens, TopLevel top_level)
|
||||
{
|
||||
// To consume a list of rules, given a top-level flag:
|
||||
|
||||
// Create an initially empty list of rules.
|
||||
NonnullRefPtrVector<Rule> rules;
|
||||
Vector<NonnullRefPtr<Rule>> rules;
|
||||
|
||||
// Repeatedly consume the next input token:
|
||||
for (;;) {
|
||||
|
@ -2075,7 +2075,7 @@ RefPtr<Rule> Parser::parse_a_rule(TokenStream<T>& tokens)
|
|||
// 5.3.4. Parse a list of rules
|
||||
// https://www.w3.org/TR/css-syntax-3/#parse-list-of-rules
|
||||
template<typename T>
|
||||
NonnullRefPtrVector<Rule> Parser::parse_a_list_of_rules(TokenStream<T>& tokens)
|
||||
Vector<NonnullRefPtr<Rule>> Parser::parse_a_list_of_rules(TokenStream<T>& tokens)
|
||||
{
|
||||
// To parse a list of rules from input:
|
||||
|
||||
|
@ -7443,7 +7443,7 @@ RefPtr<CSS::MediaQuery> parse_media_query(CSS::Parser::ParsingContext const& con
|
|||
return parser.parse_as_media_query();
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<CSS::MediaQuery> parse_media_query_list(CSS::Parser::ParsingContext const& context, StringView string)
|
||||
Vector<NonnullRefPtr<CSS::MediaQuery>> parse_media_query_list(CSS::Parser::ParsingContext const& context, StringView string)
|
||||
{
|
||||
CSS::Parser::Parser parser(context, string);
|
||||
return parser.parse_as_media_query_list();
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
Optional<SelectorList> parse_as_selector(SelectorParsingMode = SelectorParsingMode::Standard);
|
||||
Optional<SelectorList> parse_as_relative_selector(SelectorParsingMode = SelectorParsingMode::Standard);
|
||||
|
||||
NonnullRefPtrVector<MediaQuery> parse_as_media_query_list();
|
||||
Vector<NonnullRefPtr<MediaQuery>> parse_as_media_query_list();
|
||||
RefPtr<MediaQuery> parse_as_media_query();
|
||||
|
||||
RefPtr<Supports> parse_as_supports();
|
||||
|
@ -99,14 +99,14 @@ private:
|
|||
// "Parse a stylesheet" is intended to be the normal parser entry point, for parsing stylesheets.
|
||||
struct ParsedStyleSheet {
|
||||
Optional<AK::URL> location;
|
||||
NonnullRefPtrVector<Rule> rules;
|
||||
Vector<NonnullRefPtr<Rule>> rules;
|
||||
};
|
||||
template<typename T>
|
||||
ParsedStyleSheet parse_a_stylesheet(TokenStream<T>&, Optional<AK::URL> location);
|
||||
|
||||
// "Parse a list of rules" is intended for the content of at-rules such as @media. It differs from "Parse a stylesheet" in the handling of <CDO-token> and <CDC-token>.
|
||||
template<typename T>
|
||||
NonnullRefPtrVector<Rule> parse_a_list_of_rules(TokenStream<T>&);
|
||||
Vector<NonnullRefPtr<Rule>> parse_a_list_of_rules(TokenStream<T>&);
|
||||
|
||||
// "Parse a rule" is intended for use by the CSSStyleSheet#insertRule method, and similar functions which might exist, which parse text into a single rule.
|
||||
template<typename T>
|
||||
|
@ -142,7 +142,7 @@ private:
|
|||
ParseErrorOr<SelectorList> parse_a_selector_list(TokenStream<T>&, SelectorType, SelectorParsingMode = SelectorParsingMode::Standard);
|
||||
|
||||
template<typename T>
|
||||
NonnullRefPtrVector<MediaQuery> parse_a_media_query_list(TokenStream<T>&);
|
||||
Vector<NonnullRefPtr<MediaQuery>> parse_a_media_query_list(TokenStream<T>&);
|
||||
template<typename T>
|
||||
RefPtr<Supports> parse_a_supports(TokenStream<T>&);
|
||||
|
||||
|
@ -153,7 +153,7 @@ private:
|
|||
Yes
|
||||
};
|
||||
template<typename T>
|
||||
[[nodiscard]] NonnullRefPtrVector<Rule> consume_a_list_of_rules(TokenStream<T>&, TopLevel);
|
||||
[[nodiscard]] Vector<NonnullRefPtr<Rule>> consume_a_list_of_rules(TokenStream<T>&, TopLevel);
|
||||
template<typename T>
|
||||
[[nodiscard]] NonnullRefPtr<Rule> consume_an_at_rule(TokenStream<T>&);
|
||||
template<typename T>
|
||||
|
@ -377,7 +377,7 @@ RefPtr<CSS::StyleValue> parse_css_value(CSS::Parser::ParsingContext const&, Stri
|
|||
Optional<CSS::SelectorList> parse_selector(CSS::Parser::ParsingContext const&, StringView);
|
||||
CSS::CSSRule* parse_css_rule(CSS::Parser::ParsingContext const&, StringView);
|
||||
RefPtr<CSS::MediaQuery> parse_media_query(CSS::Parser::ParsingContext const&, StringView);
|
||||
NonnullRefPtrVector<CSS::MediaQuery> parse_media_query_list(CSS::Parser::ParsingContext const&, StringView);
|
||||
Vector<NonnullRefPtr<CSS::MediaQuery>> parse_media_query_list(CSS::Parser::ParsingContext const&, StringView);
|
||||
RefPtr<CSS::Supports> parse_css_supports(CSS::Parser::ParsingContext const&, StringView);
|
||||
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ u32 Selector::specificity() const
|
|||
auto count_specificity_of_most_complex_selector = [&](auto& selector_list) {
|
||||
u32 max_selector_list_argument_specificity = 0;
|
||||
for (auto const& complex_selector : selector_list) {
|
||||
max_selector_list_argument_specificity = max(max_selector_list_argument_specificity, complex_selector.specificity());
|
||||
max_selector_list_argument_specificity = max(max_selector_list_argument_specificity, complex_selector->specificity());
|
||||
}
|
||||
|
||||
u32 child_ids = (max_selector_list_argument_specificity & ids_mask) >> ids_shift;
|
||||
|
@ -337,7 +337,7 @@ ErrorOr<String> Selector::serialize() const
|
|||
}
|
||||
|
||||
// https://www.w3.org/TR/cssom/#serialize-a-group-of-selectors
|
||||
ErrorOr<String> serialize_a_group_of_selectors(NonnullRefPtrVector<Selector> const& selectors)
|
||||
ErrorOr<String> serialize_a_group_of_selectors(Vector<NonnullRefPtr<Selector>> const& selectors)
|
||||
{
|
||||
// To serialize a group of selectors serialize each selector in the group of selectors and then serialize a comma-separated list of these serializations.
|
||||
return String::join(", "sv, selectors);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
using SelectorList = NonnullRefPtrVector<class Selector>;
|
||||
using SelectorList = Vector<NonnullRefPtr<class Selector>>;
|
||||
|
||||
// This is a <complex-selector> in the spec. https://www.w3.org/TR/selectors-4/#complex
|
||||
class Selector : public RefCounted<Selector> {
|
||||
|
@ -294,7 +294,7 @@ constexpr StringView pseudo_class_name(Selector::SimpleSelector::PseudoClass::Ty
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
ErrorOr<String> serialize_a_group_of_selectors(NonnullRefPtrVector<Selector> const& selectors);
|
||||
ErrorOr<String> serialize_a_group_of_selectors(Vector<NonnullRefPtr<Selector>> const& selectors);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -184,8 +184,8 @@ Vector<MatchingRule> StyleComputer::collect_matching_rules(DOM::Element const& e
|
|||
sheet.for_each_effective_style_rule([&](auto const& rule) {
|
||||
size_t selector_index = 0;
|
||||
for (auto& selector : rule.selectors()) {
|
||||
if (SelectorEngine::matches(selector, element, pseudo_element)) {
|
||||
matching_rules.append({ &rule, style_sheet_index, rule_index, selector_index, selector.specificity() });
|
||||
if (SelectorEngine::matches(*selector, element, pseudo_element)) {
|
||||
matching_rules.append({ &rule, style_sheet_index, rule_index, selector_index, selector->specificity() });
|
||||
break;
|
||||
}
|
||||
++selector_index;
|
||||
|
@ -203,9 +203,9 @@ static void sort_matching_rules(Vector<MatchingRule>& matching_rules)
|
|||
quick_sort(matching_rules, [&](MatchingRule& a, MatchingRule& b) {
|
||||
auto const& a_selector = a.rule->selectors()[a.selector_index];
|
||||
auto const& b_selector = b.rule->selectors()[b.selector_index];
|
||||
auto a_specificity = a_selector.specificity();
|
||||
auto b_specificity = b_selector.specificity();
|
||||
if (a_selector.specificity() == b_selector.specificity()) {
|
||||
auto a_specificity = a_selector->specificity();
|
||||
auto b_specificity = b_selector->specificity();
|
||||
if (a_selector->specificity() == b_selector->specificity()) {
|
||||
if (a.style_sheet_index == b.style_sheet_index)
|
||||
return a.rule_index < b.rule_index;
|
||||
return a.style_sheet_index < b.style_sheet_index;
|
||||
|
@ -1406,7 +1406,7 @@ PropertyDependencyNode::PropertyDependencyNode(String name)
|
|||
void PropertyDependencyNode::add_child(NonnullRefPtr<PropertyDependencyNode> new_child)
|
||||
{
|
||||
for (auto const& child : m_children) {
|
||||
if (child.m_name == new_child->m_name)
|
||||
if (child->m_name == new_child->m_name)
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1422,7 +1422,7 @@ bool PropertyDependencyNode::has_cycles()
|
|||
|
||||
TemporaryChange change { m_marked, true };
|
||||
for (auto& child : m_children) {
|
||||
if (child.has_cycles())
|
||||
if (child->has_cycles())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -43,7 +43,7 @@ private:
|
|||
explicit PropertyDependencyNode(String name);
|
||||
|
||||
String m_name;
|
||||
NonnullRefPtrVector<PropertyDependencyNode> m_children;
|
||||
Vector<NonnullRefPtr<PropertyDependencyNode>> m_children;
|
||||
bool m_marked { false };
|
||||
};
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ Path2D::Path2D(JS::Realm& realm, Optional<Variant<JS::Handle<Path2D>, Deprecated
|
|||
|
||||
if (!svg_path.segments().is_empty()) {
|
||||
// 5. Let (x, y) be the last point in svgPath.
|
||||
auto xy = svg_path.segments().last().point();
|
||||
auto xy = svg_path.segments().last()->point();
|
||||
|
||||
// 6. Add all the subpaths, if any, from svgPath to output.
|
||||
this->path() = move(svg_path);
|
||||
|
@ -85,7 +85,7 @@ WebIDL::ExceptionOr<void> Path2D::add_path(JS::NonnullGCPtr<Path2D> path, Geomet
|
|||
auto copy = path->path().copy_transformed(Gfx::AffineTransform { static_cast<float>(matrix->m11()), static_cast<float>(matrix->m12()), static_cast<float>(matrix->m21()), static_cast<float>(matrix->m22()), static_cast<float>(matrix->m41()), static_cast<float>(matrix->m42()) });
|
||||
|
||||
// 6. Let (x, y) be the last point in the last subpath of c.
|
||||
auto xy = copy.segments().last().point();
|
||||
auto xy = copy.segments().last()->point();
|
||||
|
||||
// 7. Add all the subpaths in c to a.
|
||||
// FIXME: Is this correct?
|
||||
|
|
|
@ -183,9 +183,9 @@ private:
|
|||
AnimationFrameCallbackDriver m_animation_frame_callback_driver;
|
||||
|
||||
// https://w3c.github.io/requestidlecallback/#dfn-list-of-idle-request-callbacks
|
||||
NonnullRefPtrVector<IdleCallback> m_idle_request_callbacks;
|
||||
Vector<NonnullRefPtr<IdleCallback>> m_idle_request_callbacks;
|
||||
// https://w3c.github.io/requestidlecallback/#dfn-list-of-runnable-idle-callbacks
|
||||
NonnullRefPtrVector<IdleCallback> m_runnable_idle_callbacks;
|
||||
Vector<NonnullRefPtr<IdleCallback>> m_runnable_idle_callbacks;
|
||||
// https://w3c.github.io/requestidlecallback/#dfn-idle-callback-identifier
|
||||
u32 m_idle_callback_identifier = 0;
|
||||
|
||||
|
|
|
@ -64,27 +64,27 @@ void SVGGeometryPaintable::paint(PaintContext& context, PaintPhase phase) const
|
|||
};
|
||||
|
||||
for (auto& segment : path.segments()) {
|
||||
switch (segment.type()) {
|
||||
switch (segment->type()) {
|
||||
case Gfx::Segment::Type::Invalid:
|
||||
break;
|
||||
case Gfx::Segment::Type::MoveTo:
|
||||
new_path.move_to(transform_point(segment.point()));
|
||||
new_path.move_to(transform_point(segment->point()));
|
||||
break;
|
||||
case Gfx::Segment::Type::LineTo:
|
||||
new_path.line_to(transform_point(segment.point()));
|
||||
new_path.line_to(transform_point(segment->point()));
|
||||
break;
|
||||
case Gfx::Segment::Type::QuadraticBezierCurveTo: {
|
||||
auto& quadratic_bezier_segment = static_cast<Gfx::QuadraticBezierCurveSegment const&>(segment);
|
||||
auto& quadratic_bezier_segment = static_cast<Gfx::QuadraticBezierCurveSegment const&>(*segment);
|
||||
new_path.quadratic_bezier_curve_to(transform_point(quadratic_bezier_segment.through()), transform_point(quadratic_bezier_segment.point()));
|
||||
break;
|
||||
}
|
||||
case Gfx::Segment::Type::CubicBezierCurveTo: {
|
||||
auto& cubic_bezier_segment = static_cast<Gfx::CubicBezierCurveSegment const&>(segment);
|
||||
auto& cubic_bezier_segment = static_cast<Gfx::CubicBezierCurveSegment const&>(*segment);
|
||||
new_path.cubic_bezier_curve_to(transform_point(cubic_bezier_segment.through_0()), transform_point(cubic_bezier_segment.through_1()), transform_point(cubic_bezier_segment.point()));
|
||||
break;
|
||||
}
|
||||
case Gfx::Segment::Type::EllipticalArcTo: {
|
||||
auto& elliptical_arc_segment = static_cast<Gfx::EllipticalArcSegment const&>(segment);
|
||||
auto& elliptical_arc_segment = static_cast<Gfx::EllipticalArcSegment const&>(*segment);
|
||||
new_path.elliptical_arc_to(transform_point(elliptical_arc_segment.point()), elliptical_arc_segment.radii().scaled_by(scaling, scaling), elliptical_arc_segment.x_axis_rotation(), elliptical_arc_segment.large_arc(), elliptical_arc_segment.sweep());
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ Gfx::Path path_from_path_instructions(ReadonlySpan<PathInstruction> instructions
|
|||
|
||||
for (auto& instruction : instructions) {
|
||||
// If the first path element uses relative coordinates, we treat them as absolute by making them relative to (0, 0).
|
||||
auto last_point = path.segments().is_empty() ? Gfx::FloatPoint { 0, 0 } : path.segments().last().point();
|
||||
auto last_point = path.segments().is_empty() ? Gfx::FloatPoint { 0, 0 } : path.segments().last()->point();
|
||||
|
||||
auto& absolute = instruction.absolute;
|
||||
auto& data = instruction.data;
|
||||
|
|
|
@ -139,7 +139,7 @@ JS::ThrowCompletionOr<ResolvedOverload> resolve_overload(JS::VM& vm, IDL::Effect
|
|||
if (type.is_union()) {
|
||||
auto flattened_members = type.as_union().flattened_member_types();
|
||||
for (auto const& member : flattened_members) {
|
||||
if (member.is_nullable())
|
||||
if (member->is_nullable())
|
||||
return true;
|
||||
// FIXME: - a dictionary type
|
||||
// FIXME: - an annotated type whose inner type is one of the above types
|
||||
|
@ -351,7 +351,7 @@ JS::ThrowCompletionOr<ResolvedOverload> resolve_overload(JS::VM& vm, IDL::Effect
|
|||
}
|
||||
|
||||
// 18. Otherwise: if there is an entry in S that has any at position i of its type list, then remove from S all other entries.
|
||||
else if (overloads.has_overload_with_matching_argument_at_index(i, [](auto const& type, auto) { return type.is_any(); })) {
|
||||
else if (overloads.has_overload_with_matching_argument_at_index(i, [](auto const& type, auto) { return type->is_any(); })) {
|
||||
overloads.remove_all_other_entries();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue