Chromium Code Reviews| Index: lib/src/js/template.dart |
| diff --git a/lib/src/js/template.dart b/lib/src/js/template.dart |
| index d376c45e136b54ebc58c77366bdb90a63b931d72..addc3327abf8f5af0cb113214b072d6e80610ce0 100644 |
| --- a/lib/src/js/template.dart |
| +++ b/lib/src/js/template.dart |
| @@ -229,10 +229,10 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> { |
| return (arguments) { |
| var value = arguments[nameOrPosition]; |
| - Identifier toIdentifier(item) { |
| - if (item is Identifier) return item; |
| + Parameter toIdentifier(item) { |
| + if (item is Parameter) return item; |
| if (item is String) return new Identifier(item); |
| - return error('Interpolated value #$nameOrPosition is not an Identifier' |
| + return error('Interpolated value #$nameOrPosition ($item: ${item?.runtimeType}) is not an Identifier' |
|
Jennifer Messerly
2015/12/01 02:10:27
long line.
also, printing the item & runtime type
ochafik
2015/12/02 20:05:47
Done.
|
| ' or List of Identifiers: $value'); |
| } |
| if (value is Iterable) return value.map(toIdentifier); |
| @@ -824,6 +824,35 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> { |
| return new Await(makeExpression(arguments)); |
| }; |
| } |
| + |
| + @override |
| + Instantiator visitDestructuredVariable(DestructuredVariable node) { |
| + Instantiator makeName = visit(node.name); |
| + Instantiator makeStructure = visit(node.structure); |
| + Instantiator makeDefaultValue = visit(node.defaultValue); |
| + return (arguments) { |
| + return new DestructuredVariable( |
| + makeName(arguments), |
| + makeStructure(arguments), |
| + makeDefaultValue(arguments)); |
| + }; |
| + } |
| + |
| + @override |
| + Instantiator visitArrayDestructuring(ArrayDestructuring node) { |
| + List<Instantiator> makeVars = node.variables.map(this.visit).toList(); |
| + return (arguments) { |
| + return new ArrayDestructuring(makeVars.map((m) => m(arguments)).toList()); |
| + }; |
| + } |
| + |
| + @override |
| + Instantiator visitObjectDestructuring(ObjectDestructuring node) { |
| + List<Instantiator> makeVars = node.variables.map(this.visit).toList(); |
| + return (arguments) { |
| + return new ObjectDestructuring(makeVars.map((m) => m(arguments)).toList()); |
|
Jennifer Messerly
2015/12/01 02:10:28
long line
ochafik
2015/12/02 20:05:47
Done.
|
| + }; |
| + } |
| } |
| /** |