Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Unified Diff: frog/leg/scanner/listener.dart

Issue 9642001: Make string juxtaposition combine properly with string interpolations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « frog/leg/resolver.dart ('k') | frog/leg/scanner/parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/scanner/listener.dart
diff --git a/frog/leg/scanner/listener.dart b/frog/leg/scanner/listener.dart
index 501f753c5b8dac25f60b2f003f8a1c6c269cde99..27ec359a6f1f9038f8f09adf1105000a7e7cc30f 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) {
@@ -511,22 +511,24 @@ class ElementListener extends Listener {
}
LiteralString popLiteralString() {
- Node node = popNode();
- if (node is !LiteralString) {
- listener.cancel("String is not a compile time constant", node: node);
+ StringNode node = popNode();
+ // TODO(lrn): Handle interpolations in script tags.
+ if (node.isInterpolation) {
+ listener.cancel("String interpolation not supported in library tags",
+ node: node);
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 +851,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--;
+ while (stringCount > 0) {
Expression expression = popNode();
- literals = literals.prepend(expression);
- literalCount -= 1;
+ accumulator = new StringJuxtaposition(expression, accumulator);
+ stringCount--;
}
- pushNode(new LiteralStringJuxtaposition(literals));
+ pushNode(accumulator);
}
}
« no previous file with comments | « frog/leg/resolver.dart ('k') | frog/leg/scanner/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698