Chromium Code Reviews| Index: frog/leg/scanner/listener.dart |
| diff --git a/frog/leg/scanner/listener.dart b/frog/leg/scanner/listener.dart |
| index 501f753c5b8dac25f60b2f003f8a1c6c269cde99..4d6d6a5fad1ddf2697b948689f33e6da40d662d8 100644 |
| --- a/frog/leg/scanner/listener.dart |
| +++ b/frog/leg/scanner/listener.dart |
| @@ -170,7 +170,7 @@ class Listener { |
| void endLiteralString(int interpolationCount) { |
| } |
| - void handleLiteralStringJuxtaposition(int literalCount) { |
| + void handleStringJuxtaposition(int literalCount) { |
| } |
| void beginMember(Token token) { |
| @@ -512,21 +512,27 @@ class ElementListener extends Listener { |
| LiteralString popLiteralString() { |
| Node node = popNode(); |
| - if (node is !LiteralString) { |
| + if (node is !StringNode) { |
| listener.cancel("String is not a compile time constant", node: node); |
|
ahe
2012/03/19 15:53:06
I don't think the message is correct anymore, and
Lasse Reichstein Nielsen
2012/03/20 09:34:33
Done.
|
| return null; |
| } |
| + StringNode stringNode = node; |
| + // TODO(lrn): Handle interpolations in script tags. |
| + if (node.isInterpolation) { |
| + listener.cancel("String is a string-interpolation", node: node); |
|
ahe
2012/03/19 15:53:06
How about: "string interpolation not supported in
Lasse Reichstein Nielsen
2012/03/20 09:34:33
Done.
|
| + return null; |
| + } |
| return node; |
| } |
| void endScriptTag(bool hasPrefix, Token beginToken, Token endToken) { |
| - LiteralString prefix = null; |
| + StringNode prefix = null; |
| Identifier argumentName = null; |
| if (hasPrefix) { |
| prefix = popLiteralString(); |
| argumentName = popNode(); |
| } |
| - LiteralString firstArgument = popLiteralString(); |
| + StringNode firstArgument = popLiteralString(); |
| Identifier tag = popNode(); |
| compilationUnitElement.addTag(new ScriptTag(tag, firstArgument, |
| argumentName, prefix, |
| @@ -849,14 +855,16 @@ class ElementListener extends Listener { |
| } |
| } |
| - void handleLiteralStringJuxtaposition(int literalCount) { |
| - Link<Expression> literals = const EmptyLink<Expression>(); |
| - while (literalCount > 0) { |
| + void handleStringJuxtaposition(int stringCount) { |
| + assert(stringCount != 0); |
| + Expression accumulator = popNode(); |
| + stringCount -= 1; |
|
ahe
2012/03/19 15:53:06
Something wrong with --?
Lasse Reichstein Nielsen
2012/03/20 09:34:33
Only personal taste.
Since x-- is the same as x -=
|
| + while (stringCount > 0) { |
| Expression expression = popNode(); |
| - literals = literals.prepend(expression); |
| - literalCount -= 1; |
| + accumulator = new StringJuxtaposition(expression, accumulator); |
| + stringCount -= 1; |
|
ahe
2012/03/19 15:53:06
Ditto.
Lasse Reichstein Nielsen
2012/03/20 09:34:33
Done.
|
| } |
| - pushNode(new LiteralStringJuxtaposition(literals)); |
| + pushNode(accumulator); |
| } |
| } |