Index: sdk/lib/_internal/compiler/implementation/js_backend/constant_emitter.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/constant_emitter.dart b/sdk/lib/_internal/compiler/implementation/js_backend/constant_emitter.dart |
index 7738b57af2214acc80e440d8042b4735705fc2b0..a9e49c0f3a94f4bd2e4135cc72eef5626c55527f 100644 |
--- a/sdk/lib/_internal/compiler/implementation/js_backend/constant_emitter.dart |
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/constant_emitter.dart |
@@ -87,12 +87,23 @@ class ConstantEmitter implements ConstantVisitor { |
/** |
* Write the contents of the quoted string to a [CodeBuffer] in |
* a form that is valid as JavaScript string literal content. |
- * The string is assumed quoted by double quote characters. |
+ * The string is assumed quoted by single quote characters. |
*/ |
+ void writeEscapedString(DartString string, |
+ CodeBuffer buffer, |
+ Node diagnosticNode) { |
+ void onError(code) { |
+ compiler.reportError( |
+ diagnosticNode, |
+ 'Unhandled non-BMP character: U+${code.toRadixString(16)}'); |
+ } |
+ writeJsonEscapedCharsOn(string.iterator(), buffer, onError); |
+ } |
+ |
void visitString(StringConstant constant) { |
- buffer.add('"'); |
- writeJsonEscapedCharsOn(constant.value.slowToString(), buffer); |
- buffer.add('"'); |
+ buffer.add("'"); |
+ writeEscapedString(constant.value, buffer, constant.node); |
+ buffer.add("'"); |
} |
void emitCanonicalVersion(Constant constant) { |