Chromium Code Reviews| Index: dart/frog/leg/scanner/listener.dart |
| diff --git a/dart/frog/leg/scanner/listener.dart b/dart/frog/leg/scanner/listener.dart |
| index 3b9375a6b44bc27424afa973ba4d773deafdaa38..01e1342651c74623cd30cd7d1a8d0d044a1e9447 100644 |
| --- a/dart/frog/leg/scanner/listener.dart |
| +++ b/dart/frog/leg/scanner/listener.dart |
| @@ -362,7 +362,7 @@ class Listener { |
| void handleQualified(Token period) { |
| } |
| - void handleStringInterpolationPart(Token token) { |
| + void handleStringInterpolationParts(int count) { |
| } |
| void handleSuperExpression(Token token) { |
| @@ -966,7 +966,8 @@ class NodeListener extends ElementListener { |
| void endLiteralMapEntry(Token token) { |
| Expression value = popNode(); |
| - LiteralString key = popNode(); |
| + // The key may be a LiteralString or a StringInterpolation. |
|
ngeoffray
2011/12/20 11:54:45
StringInterpolation should be rejected by someone
ahe
2011/12/20 13:19:24
Yes. I looked at the specification. There is a bad
|
| + Expression key = popNode(); |
| // TODO(ahe): Create AST node. |
| pushNode(new UnimplementedExpression('map entry', [key, value])); |
| } |
| @@ -1036,11 +1037,19 @@ class NodeListener extends ElementListener { |
| pushNode(new UnimplementedExpression('named argument', [name, argument])); |
| } |
| - void handleStringInterpolationPart(Token token) { |
| - LiteralString string = popNode(); |
| - Expression expression = popNode(); |
| - canceler.cancel('string interpolation is not implemented', |
| - node: expression); |
| + void handleStringInterpolationParts(int count) { |
| + Link<StringInterpolationPart> parts = |
| + const EmptyLink<StringInterpolationPart>(); |
| + for (int i = 0; i < count; i++) { |
| + LiteralString string = popNode(); |
| + Expression expression = popNode(); |
| + parts = parts.prepend(new StringInterpolationPart(expression, string)); |
| + } |
| + if (!parts.isEmpty()) { |
| + LiteralString string = popNode(); |
| + NodeList nodes = new NodeList(null, parts, null, null); |
| + pushNode(new StringInterpolation(string, nodes)); |
| + } |
| } |
| void endOptionalFormalParameters(int count, |