[vala] girparser: Avoid fatal handling of nameless unions
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] girparser: Avoid fatal handling of nameless unions
- Date: Tue, 18 Oct 2016 20:55:55 +0000 (UTC)
commit a18ad0fdf94cd9b0f223be08496169652ef86166
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sun Jan 31 22:25:16 2016 +0100
girparser: Avoid fatal handling of nameless unions
vala/valagirparser.vala | 28 +++++++++++++++++++++++++++-
1 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 2e6fa4d..73273f3 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -3318,7 +3318,33 @@ public class Vala.GirParser : CodeVisitor {
void parse_union () {
start_element ("union");
- push_node (element_get_name (), true);
+
+ string? element_name = element_get_name ();
+ if (element_name == null) {
+ next ();
+
+ while (current_token == MarkupTokenType.START_ELEMENT) {
+ if (!push_metadata ()) {
+ skip_element ();
+ continue;
+ }
+
+ if (reader.name == "field") {
+ parse_field ();
+ } else {
+ // error
+ Report.error (get_current_src (), "unknown child element `%s' in
`transparent union'".printf (reader.name));
+ skip_element ();
+ }
+
+ pop_metadata ();
+ }
+
+ end_element ("union");
+ return;
+ }
+
+ push_node (element_name, true);
Struct st;
if (current.new_symbol) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]