AK: Undo bogus Variant::downcast() rename

I accidentally renamed these to verify_cast() when doing the global
AK::downcast() rename.
This commit is contained in:
Andreas Kling 2021-06-26 21:22:49 +02:00
parent 337ad6d15c
commit beb43f673e
Notes: sideshowbarker 2024-07-18 11:28:21 +09:00
4 changed files with 6 additions and 6 deletions

View File

@ -319,7 +319,7 @@ public:
}
template<typename... NewTs>
Variant<NewTs...> verify_cast() &&
Variant<NewTs...> downcast() &&
{
Variant<NewTs...> instance { Variant<NewTs...>::invalid_index, Detail::VariantConstructTag {} };
visit([&](auto& value) {
@ -331,7 +331,7 @@ public:
}
template<typename... NewTs>
Variant<NewTs...> verify_cast() &
Variant<NewTs...> downcast() &
{
Variant<NewTs...> instance { Variant<NewTs...>::invalid_index, Detail::VariantConstructTag {} };
visit([&](const auto& value) {

View File

@ -80,14 +80,14 @@ TEST_CASE(move_moves)
TEST_CASE(verify_cast)
{
Variant<i8, i16, i32, i64> one_integer_to_rule_them_all { static_cast<i32>(42) };
auto fake_integer = one_integer_to_rule_them_all.verify_cast<i8, i32>();
auto fake_integer = one_integer_to_rule_them_all.downcast<i8, i32>();
EXPECT(fake_integer.has<i32>());
EXPECT(one_integer_to_rule_them_all.has<i32>());
EXPECT_EQ(fake_integer.get<i32>(), 42);
EXPECT_EQ(one_integer_to_rule_them_all.get<i32>(), 42);
fake_integer = static_cast<i8>(60);
one_integer_to_rule_them_all = fake_integer.verify_cast<i8, i16>().verify_cast<i8, i32, float>().verify_cast<i8, i16, i32, i64>();
one_integer_to_rule_them_all = fake_integer.downcast<i8, i16>().downcast<i8, i32, float>().downcast<i8, i16, i32, i64>();
EXPECT(fake_integer.has<i8>());
EXPECT(one_integer_to_rule_them_all.has<i8>());
EXPECT_EQ(fake_integer.get<i8>(), 60);

View File

@ -1691,7 +1691,7 @@ NonnullRefPtr<VariableDeclaration> Parser::parse_variable_declaration(bool for_l
declarations.append(create_ast_node<VariableDeclarator>(
{ m_state.current_token.filename(), rule_start.position(), position() },
move(target).verify_cast<NonnullRefPtr<Identifier>, NonnullRefPtr<BindingPattern>>(),
move(target).downcast<NonnullRefPtr<Identifier>, NonnullRefPtr<BindingPattern>>(),
move(init)));
if (match(TokenType::Comma)) {

View File

@ -397,7 +397,7 @@ Optional<InstantiationError> AbstractMachine::allocate_all_initial_phase(Module
module_instance.exports().append(ExportInstance {
entry.name(),
move(address).verify_cast<FunctionAddress, TableAddress, MemoryAddress, GlobalAddress>(),
move(address).downcast<FunctionAddress, TableAddress, MemoryAddress, GlobalAddress>(),
});
}
});