]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix result var for pre/post conditions
authorLuca Bruno <lucabru@src.gnome.org>
Sat, 4 May 2013 09:30:05 +0000 (11:30 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 11 Mar 2019 12:46:57 +0000 (13:46 +0100)
vala/valasubroutine.vala

index 0ef8bf333008497445406ae0f617bd03e744a904..14e2b963b491111203f643b108a32d28e7036168 100644 (file)
@@ -32,10 +32,20 @@ public abstract class Vala.Subroutine : Symbol {
        /**
         * Specifies the generated `result` variable for postconditions.
         */
-       public LocalVariable result_var { get; set; }
+       public LocalVariable result_var {
+               get { return _result_var; }
+               set {
+                       _result_var = value;
+                       if (_result_var != null) {
+                               scope.add ("result", _result_var);
+                       }
+               }
+       }
 
        public abstract bool has_result { get; }
 
+       private LocalVariable _result_var;
+
        protected Subroutine (string? name, SourceReference? source_reference, Comment? comment = null) {
                base (name, source_reference, comment);
        }