Index: lib/compiler/implementation/ssa/codegen.dart |
diff --git a/lib/compiler/implementation/ssa/codegen.dart b/lib/compiler/implementation/ssa/codegen.dart |
index e4437cf32676fd576ae0f599a32e9e656bff0308..d3bbb7906630c7ad76dc4dc31b8842cc8bc740db 100644 |
--- a/lib/compiler/implementation/ssa/codegen.dart |
+++ b/lib/compiler/implementation/ssa/codegen.dart |
@@ -1810,6 +1810,33 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor { |
endExpression(JSPrecedence.ASSIGNMENT_PRECEDENCE); |
} |
+ void visitStringConcat(HStringConcat node) { |
+ JSBinaryOperatorPrecedence operatorPrecedences = JSPrecedence.binary['+']; |
+ beginExpression(operatorPrecedences.precedence); |
+ useStringified(node.inputs[0], operatorPrecedences.left); |
+ buffer.add(' + '); |
+ // If the right hand side is a string concatenation itself it is |
+ // safe to make it left associative. |
+ JSPrecedence rightPrecedence = (node.inputs[1] is HStringConcat) |
Lasse Reichstein Nielsen
2012/06/06 12:11:40
JSPrecedence -> int.
The JSPrecedence class is jus
kasperl
2012/06/06 13:31:03
Done.
|
+ ? JSPrecedence.ADDITIVE_PRECEDENCE |
+ : operatorPrecedences.right; |
+ useStringified(node.inputs[1], rightPrecedence); |
+ endExpression(operatorPrecedences.precedence); |
+ } |
+ |
+ void useStringified(HInstruction node, JSPrecedence precedence) { |
+ if (node.isString()) { |
+ use(node, precedence); |
+ } else { |
+ Element convertToString = compiler.findHelper(const SourceString("S")); |
+ world.registerStaticUse(convertToString); |
+ buffer.add(compiler.namer.isolateAccess(convertToString)); |
Lasse Reichstein Nielsen
2012/06/06 12:11:40
Maybe we should have a function that does all this
|
+ buffer.add('('); |
+ use(node, JSPrecedence.EXPRESSION_PRECEDENCE); |
+ buffer.add(')'); |
+ } |
+ } |
+ |
void visitLiteralList(HLiteralList node) { |
generateArrayLiteral(node); |
} |