summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-04-08 17:42:15 +0300
committerIdan Horowitz <idan.horowitz@gmail.com>2022-04-08 19:19:37 +0300
commit280e99073bb2415f52c991f1ffbc658a1056e521 (patch)
tree7d6d24808ce50aba1ed7012c531460e877e0fcb9 /Userland
parent40c40b75519210649628e2a8d8abf05e22792f47 (diff)
downloadserenity-280e99073bb2415f52c991f1ffbc658a1056e521.zip
LibGUI: Stop dropping comments between children and end of GML objects
Any left-over comments in the pending_comments vector are now inserted as sub object children, as these are serialized last and will therefore show up in their expected location.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibGUI/GML/Parser.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/GML/Parser.cpp b/Userland/Libraries/LibGUI/GML/Parser.cpp
index 8e6cfcd71b..169f24c8b9 100644
--- a/Userland/Libraries/LibGUI/GML/Parser.cpp
+++ b/Userland/Libraries/LibGUI/GML/Parser.cpp
@@ -1,6 +1,7 @@
/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2022, kleines Filmröllchen <filmroellchen@serenityos.org>
+ * Copyright (c) 2022, Idan Horowitz <idan.horowitz@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -91,6 +92,10 @@ static ErrorOr<NonnullRefPtr<Object>> parse_gml_object(Queue<Token>& tokens)
}
}
+ // Insert any left-over comments as sub object children, as these will be serialized last
+ while (!pending_comments.is_empty())
+ TRY(object->add_sub_object_child(pending_comments.take_first()));
+
if (peek() != Token::Type::RightCurly)
return Error::from_string_literal("Expected }}"sv);