1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:58:11 +00:00

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.
This commit is contained in:
Idan Horowitz 2022-04-08 17:42:15 +03:00
parent 40c40b7551
commit 280e99073b

View file

@ -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);