GMLCompiler: Force main class name to be resolved from global namespace

Calculator would otherwise trip over this, since there's a class with
the same name within the namespace.
This commit is contained in:
kleines Filmröllchen 2023-05-26 14:10:41 +02:00 committed by Andrew Kaster
parent 842a5adfdc
commit 285119bc1a
Notes: sideshowbarker 2024-07-17 01:12:07 +09:00

View File

@ -123,7 +123,7 @@ static char const function_start[] = R"~~~(
// This function was auto-generated by the GML compiler.
ErrorOr<NonnullRefPtr<@main_class_name@>> @main_class_name@::try_create()
{
RefPtr<@main_class_name@> main_object;
RefPtr<::@main_class_name@> main_object;
)~~~";
@ -254,7 +254,7 @@ static ErrorOr<void> generate_loader_for_object(GUI::GML::Object const& gml_obje
if (use_object_constructor == UseObjectConstructor::Yes)
TRY(append(generator, "@object_name@ = TRY(@class_name@::try_create());"));
else
TRY(append(generator, "@object_name@ = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) @class_name@()));"));
TRY(append(generator, "@object_name@ = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) ::@class_name@()));"));
// Properties
TRY(gml_object.try_for_each_property([&](StringView key, NonnullRefPtr<GUI::GML::JsonValueNode> value) -> ErrorOr<void> {