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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of js_backend; 5 part of js_backend;
6 6
7 class ConstantEmitter implements ConstantVisitor { 7 class ConstantEmitter implements ConstantVisitor {
8 final Compiler compiler; 8 final Compiler compiler;
9 final Namer namer; 9 final Namer namer;
10 10
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 buffer.add("true"); 80 buffer.add("true");
81 } 81 }
82 82
83 void visitFalse(FalseConstant constant) { 83 void visitFalse(FalseConstant constant) {
84 buffer.add("false"); 84 buffer.add("false");
85 } 85 }
86 86
87 /** 87 /**
88 * Write the contents of the quoted string to a [CodeBuffer] in 88 * Write the contents of the quoted string to a [CodeBuffer] in
89 * a form that is valid as JavaScript string literal content. 89 * a form that is valid as JavaScript string literal content.
90 * The string is assumed quoted by double quote characters. 90 * The string is assumed quoted by single quote characters.
91 */ 91 */
92 void writeEscapedString(DartString string,
93 CodeBuffer buffer,
94 Node diagnosticNode) {
95 void onError(code) {
96 compiler.reportError(
97 diagnosticNode,
98 'Unhandled non-BMP character: U+${code.toRadixString(16)}');
99 }
100 writeJsonEscapedCharsOn(string.iterator(), buffer, onError);
101 }
102
92 void visitString(StringConstant constant) { 103 void visitString(StringConstant constant) {
93 buffer.add('"'); 104 buffer.add("'");
94 writeJsonEscapedCharsOn(constant.value.slowToString(), buffer); 105 writeEscapedString(constant.value, buffer, constant.node);
95 buffer.add('"'); 106 buffer.add("'");
96 } 107 }
97 108
98 void emitCanonicalVersion(Constant constant) { 109 void emitCanonicalVersion(Constant constant) {
99 String name = namer.constantName(constant); 110 String name = namer.constantName(constant);
100 buffer.add(namer.isolatePropertiesAccessForConstant(name)); 111 buffer.add(namer.isolatePropertiesAccessForConstant(name));
101 } 112 }
102 113
103 void visitList(ListConstant constant) { 114 void visitList(ListConstant constant) {
104 if (shouldEmitCanonicalVersion) { 115 if (shouldEmitCanonicalVersion) {
105 emitCanonicalVersion(constant); 116 emitCanonicalVersion(constant);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 buffer.add(getJsConstructor(constant.type.element)); 206 buffer.add(getJsConstructor(constant.type.element));
196 buffer.add("("); 207 buffer.add("(");
197 for (int i = 0; i < constant.fields.length; i++) { 208 for (int i = 0; i < constant.fields.length; i++) {
198 if (i != 0) buffer.add(", "); 209 if (i != 0) buffer.add(", ");
199 _visit(constant.fields[i]); 210 _visit(constant.fields[i]);
200 } 211 }
201 buffer.add(")"); 212 buffer.add(")");
202 } 213 }
203 } 214 }
204 } 215 }
OLDNEW
« 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