[vala/wip/transform: 53/139] Add missing replace_expression to code nodes
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/transform: 53/139] Add missing replace_expression to code nodes
- Date: Mon, 17 Oct 2016 20:09:58 +0000 (UTC)
commit a09c011b20f31b9e7f4c095c63c8ebddb9a5589b
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 2f4bef1..f82b4de 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 05274c1..dd6e351 100644
--- a/vala/valapostfixexpression.vala
+++ b/vala/valapostfixexpression.vala
@@ -91,6 +91,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]