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

Unified Diff: tools/testing/legpad/legpad.dart

Issue 10387232: Remove string concatenation with + from all Dart files in tools directory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 7 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 | « tools/testing/frogpad/frogpad.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/legpad/legpad.dart
diff --git a/tools/testing/legpad/legpad.dart b/tools/testing/legpad/legpad.dart
index 474dc01e467cab65858d40729e172813880801c0..9d7452f85cd797049759f31d31397abb5cf8da6f 100644
--- a/tools/testing/legpad/legpad.dart
+++ b/tools/testing/legpad/legpad.dart
@@ -25,10 +25,10 @@ class Legpad {
// to compile
static final String MAIN_ID = "main_id";
- Legpad() : warnings = "" {}
+ Legpad() : warnings = new StringBuffer();
// accumulates diagnostic messages emitted by the leg compiler
- String warnings;
+ StringBuffer warnings;
// the generated javascript
String output;
@@ -41,16 +41,14 @@ class Legpad {
void diagnosticHandler(uri_lib.Uri uri, int begin, int end,
String message, bool fatal) {
- StringBuffer sb = new StringBuffer();
- sb.add(message);
+ warnings.add(message);
if (uri !== null) {
- sb.add(" (${uri.toString()}: $begin, $end)");
+ warnings.add(" ($uri: $begin, $end)");
}
if (fatal) {
- sb.add(" (fatal)");
+ warnings.add(" (fatal)");
}
- sb.add("\n");
- warnings += sb.toString();
+ warnings.add("\n");
}
Future<String> readUriFromString(uri_lib.Uri uri) {
@@ -79,14 +77,14 @@ class Legpad {
}
setText("output", output);
- setText("warnings", warnings);
+ setText("warnings", warnings.toString());
int lineCount = lineCount(output);
- String timing = "generated $lineCount lines " +
- "(${output.length} characters) in " +
+ String timing = "generated $lineCount lines "
+ "(${output.length} characters) in "
"${((elapsedMillis) / 1000).toStringAsPrecision(3)} seconds";
setText("timing", timing);
}
-
+
static int lineCount(String s) {
Iterable<Match> matches = "\n".allMatches(s);
int n = 0;
@@ -94,7 +92,7 @@ class Legpad {
n++;
}
return n;
- }
+ }
void runLeg() {
uri_lib.Uri mainUri = new uri_lib.Uri.fromString(getText(MAIN_ID));
« no previous file with comments | « tools/testing/frogpad/frogpad.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698