[vala/wip/transform: 17/103] Fix result var for pre/post conditions



commit 9633f027d387434b5c8532651755288f54ca117c
Author: Luca Bruno <lucabru src gnome org>
Date:   Sat May 4 11:30:05 2013 +0200

    Fix result var for pre/post conditions

 vala/valasubroutine.vala | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/vala/valasubroutine.vala b/vala/valasubroutine.vala
index 0ef8bf333..14e2b963b 100644
--- a/vala/valasubroutine.vala
+++ b/vala/valasubroutine.vala
@@ -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);
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]