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

Unified Diff: frog/leg/ssa/builder.dart

Issue 9271037: Inserted string validation as separate task in compiler. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments. Created 8 years, 11 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
Index: frog/leg/ssa/builder.dart
diff --git a/frog/leg/ssa/builder.dart b/frog/leg/ssa/builder.dart
index b40cc2df2a58c5067b4d3efb6e2b1b401902ee6d..1ba1088b1bc82d5d93ad373238b4765a0e1d3fa6 100644
--- a/frog/leg/ssa/builder.dart
+++ b/frog/leg/ssa/builder.dart
@@ -1146,7 +1146,7 @@ class SsaBuilder implements Visitor {
}
void visitLiteralString(LiteralString node) {
- push(new HLiteral(new QuotedString.explicit(node.value), HType.STRING));
+ push(new HLiteral(node.quotedString, HType.STRING));
}
void visitLiteralNull(LiteralNull node) {
@@ -1257,35 +1257,16 @@ class SsaBuilder implements Visitor {
Operator op = new Operator.synthetic("+");
HInstruction target = new HStatic(interceptors.getOperatorInterceptor(op));
add(target);
- // Ensure that string literals are marked with the correct quoting
- // style and presence of quotes (left quote only on the first one,
- // right quote only on the last one).
- int quoteFlags = QuotedString.flagsFromLeftQuote(node.string.value);
- // The loop is complicated because we have to do something extra for
- // the *last* element. To do that, we handle the [string] of a part
- // in the next iteration, or after the loop for the last element.
- int firstPartFlags = quoteFlags | QuotedString.HAS_LEFT_QUOTE;
- push(new HLiteral(new QuotedString(node.string.value, firstPartFlags),
- HType.STRING));
-
- SourceString string = null;
+ visit(node.string);
+ // Handle the parts here, to avoid recreating [target].
for (StringInterpolationPart part in node.parts) {
HInstruction prefix = pop();
- if (string != null) {
- push(new HLiteral(new QuotedString(string, quoteFlags),
- HType.STRING));
- push(new HAdd(target, prefix, pop()));
- prefix = pop();
- }
visit(part.expression);
push(new HAdd(target, prefix, pop()));
- string = part.string.value;
+ prefix = pop();
+ visit(part.string);
+ push(new HAdd(target, prefix, pop()));
}
- HInstruction prefix = pop();
- int lastPartFlags = quoteFlags | QuotedString.HAS_RIGHT_QUOTE;
- push(new HLiteral(new QuotedString(string, lastPartFlags),
- HType.STRING));
- push(new HAdd(target, prefix, pop()));
}
visitStringInterpolationPart(StringInterpolationPart node) {

Powered by Google App Engine
This is Rietveld 408576698