1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:37:43 +00:00

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

View file

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