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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/constant_emitter.dart

Issue 11411092: Revert "Add some support for the code-point code-unit distinction." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 | « runtime/vm/unicode_test.cc ('k') | sdk/lib/_internal/compiler/implementation/lib/core_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « runtime/vm/unicode_test.cc ('k') | sdk/lib/_internal/compiler/implementation/lib/core_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698