[vala/wip/transform: 268/273] Fix result var for pre/post conditions
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/transform: 268/273] Fix result var for pre/post conditions
- Date: Mon, 27 Jan 2014 21:53:40 +0000 (UTC)
commit e1077ebf4bb68d8ed281bc27bf892d1f956ada05
Author: Luca Bruno <lucabru src gnome org>
Date: Sat May 4 11:30:05 2013 +0200
Fix result var for pre/post conditions
vala/valasemanticanalyzer.vala | 2 +-
vala/valasubroutine.vala | 12 +++++++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala
index c2fe5da..50b0b82 100644
--- a/vala/valasemanticanalyzer.vala
+++ b/vala/valasemanticanalyzer.vala
@@ -143,7 +143,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
}
public bool is_local_symbol (Symbol sym) {
- if ((sym is LocalVariable || sym is Constant) && sym.parent_symbol is Block) {
+ if (sym is LocalVariable || (sym is Constant && sym.parent_symbol is Block)) {
return true;
}
return false;
diff --git a/vala/valasubroutine.vala b/vala/valasubroutine.vala
index 0ef8bf3..14e2b96 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]