Index: pkg/compiler/lib/src/js/template.dart |
diff --git a/pkg/compiler/lib/src/js/template.dart b/pkg/compiler/lib/src/js/template.dart |
index 7740431fc05ed717483c4adbbc7e189beac6657e..eb4089ad807090f3b6270d5192658c0e6933e8ad 100644 |
--- a/pkg/compiler/lib/src/js/template.dart |
+++ b/pkg/compiler/lib/src/js/template.dart |
@@ -185,6 +185,11 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> { |
return new VariableUse(value); |
} |
+ static Expression convertStringToVariableDeclaration(String value) { |
+ assert(identiferRE.hasMatch(value)); |
+ return new VariableDeclaration(value); |
+ } |
+ |
Instantiator visitInterpolatedExpression(InterpolatedExpression node) { |
var nameOrPosition = node.nameOrPosition; |
return (arguments) { |
@@ -195,6 +200,16 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> { |
}; |
} |
+ Instantiator visitInterpolatedDeclaration(InterpolatedDeclaration node) { |
+ var nameOrPosition = node.nameOrPosition; |
+ return (arguments) { |
+ var value = arguments[nameOrPosition]; |
+ if (value is Declaration) return value; |
+ if (value is String) return convertStringToVariableDeclaration(value); |
+ error('Interpolated value #$nameOrPosition is not a declaration: $value'); |
+ }; |
+ } |
+ |
Instantiator visitSplayableExpression(Node node) { |
if (node is InterpolatedExpression) { |
var nameOrPosition = node.nameOrPosition; |