[vala/wip/transform: 98/98] Fix string templates
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/transform: 98/98] Fix string templates
- Date: Sun, 25 Sep 2016 19:42:25 +0000 (UTC)
commit d677cbeaf06a2f0c6de991f695b56b23d97e3aa1
Author: Luca Bruno <luca bruno immobiliare it>
Date: Mon Jul 7 09:57:08 2014 +0200
Fix string templates
vala/valacodetransformer.vala | 2 +-
vala/valatemplate.vala | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/vala/valacodetransformer.vala b/vala/valacodetransformer.vala
index 723838f..ce8debd 100644
--- a/vala/valacodetransformer.vala
+++ b/vala/valacodetransformer.vala
@@ -295,7 +295,7 @@ public class Vala.CodeTransformer : CodeVisitor {
}
public Expression stringify (Expression expr) {
- if (expr.value_type.data_type != null && expr.value_type.data_type.is_subtype_of
(context.analyzer.string_type.data_type)) {
+ if (expr.value_type != null && expr.value_type.data_type != null &&
expr.value_type.data_type.is_subtype_of (context.analyzer.string_type.data_type)) {
return expr;
} else {
return expression (@"%?.to_string ()", {expr});
diff --git a/vala/valatemplate.vala b/vala/valatemplate.vala
index 8d446d1..56a4ad9 100644
--- a/vala/valatemplate.vala
+++ b/vala/valatemplate.vala
@@ -47,6 +47,14 @@ public class Vala.Template : Expression {
return expression_list;
}
+ public override void replace_expression (Expression old_node, Expression new_node) {
+ int index = expression_list.index_of (old_node);
+ if (index >= 0) {
+ expression_list[index] = new_node;
+ new_node.parent_node = this;
+ }
+ }
+
public override bool is_pure () {
return false;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]