[vala/wip/transform: 44/132] Add missing replace_expression to code nodes
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/transform: 44/132] Add missing replace_expression to code nodes
- Date: Mon, 16 Apr 2018 15:06:31 +0000 (UTC)
commit aedd658cac4cae4a81fb0d342030250e4d87b462
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 5e1bdea..6eb08e0 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 c88cd65..43ef4d5 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 eed39a3..156ffec 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]