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

Unified Diff: pkg/compiler/lib/src/js_backend/constant_emitter.dart

Issue 1520033002: js_ast: Better escaping of strings in preparation for utf8 file encoding (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years 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 | « no previous file | pkg/js_ast/lib/src/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_backend/constant_emitter.dart
diff --git a/pkg/compiler/lib/src/js_backend/constant_emitter.dart b/pkg/compiler/lib/src/js_backend/constant_emitter.dart
index 5b87b15b7854b9530c326d914669e032382792f6..0550d8d1002f1e624c5b93a764b02d629d0f3771 100644
--- a/pkg/compiler/lib/src/js_backend/constant_emitter.dart
+++ b/pkg/compiler/lib/src/js_backend/constant_emitter.dart
@@ -153,9 +153,8 @@ class ConstantEmitter
*/
@override
jsAst.Expression visitString(StringConstantValue constant, [_]) {
- StringBuffer sb = new StringBuffer();
- writeJsonEscapedCharsOn(constant.primitiveValue.slowToString(), sb);
- return new jsAst.LiteralString('"$sb"');
+ return js.escapedString(constant.primitiveValue.slowToString(),
+ ascii: true);
}
@override
« no previous file with comments | « no previous file | pkg/js_ast/lib/src/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698