mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 07:07:44 +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
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue