| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #import("dart:html", prefix:"html"); | 5 #import("dart:html", prefix:"html"); |
| 6 #import('../../../lib/compiler/compiler.dart', prefix: "compiler_lib"); | 6 #import('../../../lib/compiler/compiler.dart', prefix: "compiler_lib"); |
| 7 #import('../../../lib/uri/uri.dart', prefix:"uri_lib"); | 7 #import('../../../lib/uri/uri.dart', prefix:"uri_lib"); |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * This is the entrypoint for a version of the leg compiler that | 10 * This is the entrypoint for a version of the leg compiler that |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 */ | 64 */ |
| 65 String idOfFilename(String filename) { | 65 String idOfFilename(String filename) { |
| 66 return filename.replaceAll("/", "_").replaceAll(".", "_"); | 66 return filename.replaceAll("/", "_").replaceAll(".", "_"); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void run() { | 69 void run() { |
| 70 String mainFile = getText(MAIN_ID); | 70 String mainFile = getText(MAIN_ID); |
| 71 setText("input", readAll(mainFile)); | 71 setText("input", readAll(mainFile)); |
| 72 Stopwatch stopwatch = new Stopwatch()..start(); | 72 Stopwatch stopwatch = new Stopwatch()..start(); |
| 73 runLeg(); | 73 runLeg(); |
| 74 int elapsedMillis = stopwatch.elapsedInMs(); | 74 int elapsedMillis = stopwatch.elapsedMilliseconds; |
| 75 if (output === null) { | 75 if (output === null) { |
| 76 output = "throw 'dart2js compilation error';\n"; | 76 output = "throw 'dart2js compilation error';\n"; |
| 77 } | 77 } |
| 78 | 78 |
| 79 setText("output", output); | 79 setText("output", output); |
| 80 setText("warnings", warnings.toString()); | 80 setText("warnings", warnings.toString()); |
| 81 int lineCount = lineCount(output); | 81 int lineCount = lineCount(output); |
| 82 String timing = "generated $lineCount lines " | 82 String timing = "generated $lineCount lines " |
| 83 "(${output.length} characters) in " | 83 "(${output.length} characters) in " |
| 84 "${((elapsedMillis) / 1000).toStringAsPrecision(3)} seconds"; | 84 "${((elapsedMillis) / 1000).toStringAsPrecision(3)} seconds"; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 } | 127 } |
| 128 return element.text.trim(); | 128 return element.text.trim(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 // TODO(mattsh): should exist in standard lib somewhere | 131 // TODO(mattsh): should exist in standard lib somewhere |
| 132 static String htmlEscape(String text) { | 132 static String htmlEscape(String text) { |
| 133 return text.replaceAll('&', '&').replaceAll( | 133 return text.replaceAll('&', '&').replaceAll( |
| 134 '>', '>').replaceAll('<', '<'); | 134 '>', '>').replaceAll('<', '<'); |
| 135 } | 135 } |
| 136 } | 136 } |
| OLD | NEW |