Chromium Code Reviews| Index: tools/testing/legpad/legpad.dart |
| diff --git a/tools/testing/legpad/legpad.dart b/tools/testing/legpad/legpad.dart |
| index 07fa736e626d86518f8ecf63f01a94b09fad00a8..61dd9bdbef4ee72eeda38adadfe601e9f440db0f 100644 |
| --- a/tools/testing/legpad/legpad.dart |
| +++ b/tools/testing/legpad/legpad.dart |
| @@ -3,7 +3,7 @@ |
| // BSD-style license that can be found in the LICENSE file. |
| #import("dart:html", prefix:"html"); |
| -#import('../../../frog/leg/api.dart', prefix: "api_lib"); |
| +#import('../../../lib/compiler/compiler.dart', prefix: "compiler_lib"); |
| #import('../../../lib/uri/uri.dart', prefix:"uri_lib"); |
| /** |
| @@ -25,10 +25,10 @@ class Legpad { |
| // to compile |
| static final String MAIN_ID = "main_id"; |
| - Legpad() : warnings = new StringBuffer() {} |
| + Legpad() : warnings = "" {} |
| // accumulates diagnostic messages emitted by the leg compiler |
|
ahe
2012/03/30 08:55:32
Ditto.
|
| - StringBuffer warnings; |
| + String warnings; |
| // the generated javascript |
|
ahe
2012/03/30 08:55:32
Ditto.
|
| String output; |
| @@ -41,8 +41,16 @@ class Legpad { |
| void diagnosticHandler(uri_lib.Uri uri, int begin, int end, |
| String message, bool fatal) { |
| - // TODO(mattsh): format message with location info |
| - warnings.add(message).add("\n"); |
| + StringBuffer sb = new StringBuffer(); |
| + sb.add(message); |
| + if (uri !== null) { |
| + sb.add(" (${uri.toString()}: $begin, $end)"); |
| + } |
| + if (fatal) { |
| + sb.add(" (fatal)"); |
| + } |
| + sb.add("\n"); |
| + warnings += sb.toString(); |
|
ahe
2012/03/30 08:55:32
I think this is a weird change. You clearly need a
|
| } |
| Future<String> readUriFromString(uri_lib.Uri uri) { |
| @@ -66,6 +74,9 @@ class Legpad { |
| Stopwatch stopwatch = new Stopwatch.start(); |
| runLeg(); |
| int elapsedMillis = stopwatch.elapsedInMs(); |
| + if (output === null) { |
| + output = "throw 'legpad compilation error';\n"; |
|
ahe
2012/03/30 08:55:32
legpad -> dart2js.
|
| + } |
| setText("output", output); |
| setText("warnings", warnings); |
| String timing = "generated ${output.length} characters in " + |
| @@ -75,15 +86,14 @@ class Legpad { |
| void runLeg() { |
| uri_lib.Uri mainUri = new uri_lib.Uri.fromString(getText(MAIN_ID)); |
| - uri_lib.Uri libraryRoot = |
| - new uri_lib.Uri.fromString("dartdir/frog/leg/lib/"); |
| + uri_lib.Uri libraryRoot = new uri_lib.Uri.fromString("dartdir/"); |
| List<String> compilerArgs = [ |
| "--enable_type_checks", |
| "--enable_asserts" |
| ]; |
| // TODO(mattsh) - dart2js api should be synchronous |
|
ahe
2012/03/30 08:55:32
The form is this:
TODO(ldap): Blah blah blah.
A
|
| - Future<String> futureJavascript = api_lib.compile(mainUri, |
| + Future<String> futureJavascript = compiler_lib.compile(mainUri, |
| libraryRoot, readUriFromString, diagnosticHandler, compilerArgs); |
| if (futureJavascript == null) { |