From: Rico Tzschichholz Date: Sat, 27 Oct 2018 08:36:22 +0000 (+0200) Subject: vala: Let UsingDirective hold reference to UnresolvedSymbol instances only X-Git-Tag: 0.43.1~166 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f63d5f36b03e1619c9722ced1daea6edddf9fdf;p=thirdparty%2Fvala.git vala: Let UsingDirective hold reference to UnresolvedSymbol instances only This should break a cyclic reference of SourceReference and Namespace. --- diff --git a/vala/valausingdirective.vala b/vala/valausingdirective.vala index 15bb2d034..da5752cb0 100644 --- a/vala/valausingdirective.vala +++ b/vala/valausingdirective.vala @@ -29,7 +29,26 @@ public class Vala.UsingDirective : CodeNode { /** * The symbol of the namespace this using directive is referring to. */ - public Symbol namespace_symbol { get; set; } + public weak Symbol namespace_symbol { + get { + if (unresolved_symbol != null) { + return unresolved_symbol; + } + return _namespace_symbol; + } + set { + if (value is UnresolvedSymbol) { + unresolved_symbol = (UnresolvedSymbol) value; + _namespace_symbol = null; + } else { + _namespace_symbol = value; + unresolved_symbol = null; + } + } + } + + weak Symbol _namespace_symbol; + UnresolvedSymbol unresolved_symbol; /** * Creates a new using directive.