diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2022-02-28 12:12:56 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2022-02-28 12:12:56 +0100 |
commit | 2d4acc80e838f0ebd3520875bbbf2ba61bd2f234 (patch) | |
tree | f5d87b68771154911d1ddcab9cdc720075809225 /vala | |
parent | 03e74e5ecf286a43e5b6fa4ea986ae2031331245 (diff) | |
download | vala-2d4acc80e838f0ebd3520875bbbf2ba61bd2f234.tar.gz |
girparser: Handle duplicated and unnamed symbols
Issue warnings and skip such symbols to avoid errors on vala's side.
Diffstat (limited to 'vala')
-rw-r--r-- | vala/valagirparser.vala | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala index 6b3d69357..88f38434b 100644 --- a/vala/valagirparser.vala +++ b/vala/valagirparser.vala @@ -1535,6 +1535,18 @@ public class Vala.GirParser : CodeVisitor { const string GIR_VERSION = "1.2"; static void add_symbol_to_container (Symbol container, Symbol sym) { + if (sym.name == "") { + Report.warning (sym.source_reference, "node with empty name"); + return; + } else if (sym.name != null) { + Symbol? old_sym = container.scope.lookup (sym.name); + if (old_sym != null) { + Report.warning (sym.source_reference, "`%s' already contains a definition for `%s'", container.name, sym.name); + Report.notice (old_sym.source_reference, "previous definition of `%s' was here", old_sym.name); + return; + } + } + if (container is Class) { unowned Class cl = (Class) container; |