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

Unified Diff: lib/src/js/builder.dart

Issue 1183453005: fixes #226 super == and fixes #227 escape \r \f (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 6 months 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 | « lib/src/codegen/js_codegen.dart ('k') | test/codegen/expect/misc.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/js/builder.dart
diff --git a/lib/src/js/builder.dart b/lib/src/js/builder.dart
index b2bdfbca5e04253157fd63e2428bdc0df8215a05..f215da214a6795ed463467790084834a2988e91d 100644
--- a/lib/src/js/builder.dart
+++ b/lib/src/js/builder.dart
@@ -300,9 +300,11 @@ class JsBuilder {
String escaped = value.replaceAll('\\', '\\\\');
// Do not escape unicode characters and ' because they are allowed in the
// string literal anyway.
- escaped = escaped.replaceAllMapped(new RegExp('\n|$quote|\b|\t|\v'), (m) {
+ var re = new RegExp('\n|\r|$quote|\b|\f|\t|\v');
+ escaped = escaped.replaceAllMapped(re, (m) {
switch (m.group(0)) {
case "\n" : return r"\n";
+ case "\r" : return r"\r";
// Quotes are only replaced if they conflict with the containing quote
case '"': return r'\"';
case "'": return r"\'";
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | test/codegen/expect/misc.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698