[vala/wip/code-transformer: 4/27] vala: Add result variable while checking post-conditions
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/code-transformer: 4/27] vala: Add result variable while checking post-conditions
- Date: Fri, 19 Apr 2019 13:30:43 +0000 (UTC)
commit 271cae921c3834417bb157ee5c272e6b652ce899
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sat Apr 13 21:23:27 2019 +0200
vala: Add result variable while checking post-conditions
vala/valamethod.vala | 12 ++++++++++++
1 file changed, 12 insertions(+)
---
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index 7bcdfdfdf..9b6739236 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -291,9 +291,15 @@ public class Vala.Method : Subroutine, Callable {
}
if (postconditions != null) {
+ if (postconditions.size > 0 && result_var != null) {
+ scope.add ("result", result_var);
+ }
foreach (Expression postcondition in postconditions) {
postcondition.accept (visitor);
}
+ if (postconditions.size > 0 && result_var != null) {
+ scope.remove ("result");
+ }
}
if (body != null) {
@@ -850,9 +856,15 @@ public class Vala.Method : Subroutine, Callable {
}
if (postconditions != null) {
+ if (postconditions.size > 0 && result_var != null) {
+ scope.add ("result", result_var);
+ }
foreach (Expression postcondition in postconditions) {
postcondition.check (context);
}
+ if (postconditions.size > 0 && result_var != null) {
+ scope.remove ("result");
+ }
}
if (body != null) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]