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

Unified Diff: frog/value.dart

Issue 8773021: Fixed escaping of const values (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: safer escaping Created 9 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
Index: frog/value.dart
diff --git a/frog/value.dart b/frog/value.dart
index 2e3a86bd47ea7d560ad25355249d32a18871fca8..f145a16bd888b3bc6e730cf50773148df12bed85 100644
--- a/frog/value.dart
+++ b/frog/value.dart
@@ -546,7 +546,7 @@ class EvaluatedValue extends Value {
static String codeWithComments(String canonicalCode, SourceSpan span) {
return (span != null && span.text != canonicalCode)
- ? '$canonicalCode/*${span.text}*/' : canonicalCode;
+ ? '$canonicalCode/*${_escapeForComment(span.text)}*/' : canonicalCode;
}
}
@@ -653,7 +653,7 @@ class GlobalValue extends Value implements Comparable {
factory GlobalValue.fromConst(uniqueId, Value exp, dependencies) {
var name = "const\$$uniqueId";
- var codeWithComment = "$name/*${exp.span.text}*/";
+ var codeWithComment = "$name/*${_escapeForComment(exp.span.text)}*/";
return new GlobalValue(
exp.type, codeWithComment, true, null, name, exp, name,
exp.span,
@@ -738,3 +738,7 @@ class BareValue extends Value {
return null;
}
}
+
+String _escapeForComment(String text) {
+ return text.replaceAll('/*', '/ *').replaceAll('*/', '* /');
jimhug 2011/12/02 00:16:00 I think you need two more spaces to make this bull
Jennifer Messerly 2011/12/02 00:24:23 with the double replace,
+}

Powered by Google App Engine
This is Rietveld 408576698