[vala/wip/transform: 14/100] Add missing replace_expression to code nodes
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/transform: 14/100] Add missing replace_expression to code nodes
- Date: Sun, 9 Feb 2014 10:42:06 +0000 (UTC)
commit 7447431852f9034483f6580bf0816cd1b9b9f1ce
Author: Luca Bruno <lucabru src gnome org>
Date: Thu Dec 29 12:55:06 2011 +0100
Add missing replace_expression to code nodes
vala/valadeletestatement.vala | 6 ++++++
vala/valaforstatement.vala | 16 ++++++++++++++++
vala/valalockstatement.vala | 6 ++++++
vala/valapostfixexpression.vala | 6 ++++++
vala/valaunlockstatement.vala | 6 ++++++
5 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/vala/valadeletestatement.vala b/vala/valadeletestatement.vala
index e12b5c4..5f639d4 100644
--- a/vala/valadeletestatement.vala
+++ b/vala/valadeletestatement.vala
@@ -50,6 +50,12 @@ public class Vala.DeleteStatement : CodeNode, Statement {
expression.accept (visitor);
}
+ public override void replace_expression (Expression old_node, Expression new_node) {
+ if (expression = old_node) {
+ expression = new_node;
+ }
+ }
+
public override bool check (CodeContext context) {
if (checked) {
return !error;
diff --git a/vala/valaforstatement.vala b/vala/valaforstatement.vala
index de1e05a..d2f644c 100644
--- a/vala/valaforstatement.vala
+++ b/vala/valaforstatement.vala
@@ -136,6 +136,22 @@ public class Vala.ForStatement : CodeNode, Statement {
body.accept (visitor);
}
+ public override void replace_expression (Expression old_node, Expression new_node) {
+ if (condition == old_node) {
+ condition = new_node;
+ }
+ for (int i=0; i < initializer.size; i++) {
+ if (initializer[i] == old_node) {
+ initializer[i] = new_node;
+ }
+ }
+ for (int i=0; i < iterator.size; i++) {
+ if (iterator[i] == old_node) {
+ iterator[i] = new_node;
+ }
+ }
+ }
+
public override bool check (CodeContext context) {
if (checked) {
return !error;
diff --git a/vala/valalockstatement.vala b/vala/valalockstatement.vala
index b94e88c..6f7912e 100644
--- a/vala/valalockstatement.vala
+++ b/vala/valalockstatement.vala
@@ -74,6 +74,12 @@ public class Vala.LockStatement : CodeNode, Statement {
visitor.visit_lock_statement (this);
}
+ public override void replace_expression (Expression old_node, Expression new_node) {
+ if (resource == old_node) {
+ resource = new_node;
+ }
+ }
+
public override bool check (CodeContext context) {
if (body != null) {
// if the statement isn't empty, it is converted into a try statement
diff --git a/vala/valapostfixexpression.vala b/vala/valapostfixexpression.vala
index 5f44157..2ccc0e6 100644
--- a/vala/valapostfixexpression.vala
+++ b/vala/valapostfixexpression.vala
@@ -87,6 +87,12 @@ public class Vala.PostfixExpression : Expression {
inner.get_used_variables (collection);
}
+ public override void replace_expression (Expression old_node, Expression new_node) {
+ if (inner == old_node) {
+ inner = new_node;
+ }
+ }
+
public override bool check (CodeContext context) {
if (checked) {
return !error;
diff --git a/vala/valaunlockstatement.vala b/vala/valaunlockstatement.vala
index c9f8ff7..e73e363 100644
--- a/vala/valaunlockstatement.vala
+++ b/vala/valaunlockstatement.vala
@@ -40,6 +40,12 @@ public class Vala.UnlockStatement : CodeNode, Statement {
visitor.visit_unlock_statement (this);
}
+ public override void replace_expression (Expression old_node, Expression new_node) {
+ if (resource == old_node) {
+ resource = new_node;
+ }
+ }
+
public override bool check (CodeContext context) {
if (checked) {
return !error;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]