]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Set parent_node for child nodes of lambda-expression
authorRico Tzschichholz <ricotz@ubuntu.com>
Thu, 13 Aug 2020 21:00:44 +0000 (23:00 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 5 Sep 2020 14:42:41 +0000 (16:42 +0200)
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1062

vala/valalambdaexpression.vala

index b3151d5513b2dace1d9e0a850a4cdb5439a9e31e..adefa656df8a5b96ab87cd635c1e89dd2a848bbf 100644 (file)
@@ -34,20 +34,38 @@ public class Vala.LambdaExpression : Expression {
         * The expression body of this lambda expression. Only one of
         * expression_body or statement_body may be set.
         */
-       public Expression expression_body { get; set; }
-       
+       public Expression expression_body {
+               get { return _expression_body; }
+               set {
+                       _expression_body = value;
+                       if (_expression_body != null) {
+                               _expression_body.parent_node = this;
+                       }
+               }
+       }
+
        /**
         * The statement body of this lambda expression. Only one of
         * expression_body or statement_body may be set.
         */
-       public Block statement_body { get; set; }
-       
+       public Block statement_body {
+               get { return _statement_body; }
+               set {
+                       _statement_body = value;
+                       if (_statement_body != null) {
+                               _statement_body.parent_node = this;
+                       }
+               }
+       }
+
        /**
         * The generated method.
         */
        public Method method { get; set; }
 
        private List<Parameter> parameters = new ArrayList<Parameter> ();
+       Block _statement_body;
+       Expression _expression_body;
 
        /**
         * Creates a new lambda expression.
@@ -168,6 +186,7 @@ public class Vala.LambdaExpression : Expression {
                        }
                }
                method.owner = context.analyzer.current_symbol.scope;
+               method.parent_node = this;
 
                var lambda_params = get_parameters ();
                Iterator<Parameter> lambda_param_it = lambda_params.iterator ();