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 #library('mirrors.dart2js'); | 5 #library('mirrors.dart2js'); |
6 | 6 |
7 #import('../../../lib/compiler/compiler.dart', prefix: 'diagnostics'); | 7 #import('../../../lib/compiler/compiler.dart', prefix: 'diagnostics'); |
8 #import('../../../lib/compiler/implementation/elements/elements.dart'); | 8 #import('../../../lib/compiler/implementation/elements/elements.dart'); |
9 #import('../../../lib/compiler/implementation/apiimpl.dart', prefix: 'api'); | 9 #import('../../../lib/compiler/implementation/apiimpl.dart', prefix: 'api'); |
10 #import('../../../lib/compiler/implementation/scanner/scannerlib.dart'); | 10 #import('../../../lib/compiler/implementation/scanner/scannerlib.dart'); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 bool success = _runList(uriList); | 205 bool success = _runList(uriList); |
206 for (final task in tasks) { | 206 for (final task in tasks) { |
207 log('${task.name} took ${task.timing}msec'); | 207 log('${task.name} took ${task.timing}msec'); |
208 } | 208 } |
209 return success; | 209 return success; |
210 } | 210 } |
211 | 211 |
212 bool _runList(List<Uri> uriList) { | 212 bool _runList(List<Uri> uriList) { |
213 try { | 213 try { |
214 runCompilerList(uriList); | 214 runCompilerList(uriList); |
215 } catch (CompilerCancelledException exception) { | 215 } on CompilerCancelledException catch (exception) { |
216 log(exception.toString()); | 216 log(exception.toString()); |
217 log('compilation failed'); | 217 log('compilation failed'); |
218 return false; | 218 return false; |
219 } | 219 } |
220 tracer.close(); | 220 tracer.close(); |
221 log('compilation succeeded'); | 221 log('compilation succeeded'); |
222 return true; | 222 return true; |
223 } | 223 } |
224 | 224 |
225 void runCompilerList(List<Uri> uriList) { | 225 void runCompilerList(List<Uri> uriList) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 bool isAborting = false; | 287 bool isAborting = false; |
288 Map<String, SourceFile> sourceFiles; | 288 Map<String, SourceFile> sourceFiles; |
289 | 289 |
290 Future<String> provider(Uri uri) { | 290 Future<String> provider(Uri uri) { |
291 if (uri.scheme != 'file') { | 291 if (uri.scheme != 'file') { |
292 throw new IllegalArgumentException(uri); | 292 throw new IllegalArgumentException(uri); |
293 } | 293 } |
294 String source; | 294 String source; |
295 try { | 295 try { |
296 source = readAll(uriPathToNative(uri.path)); | 296 source = readAll(uriPathToNative(uri.path)); |
297 } catch (FileIOException ex) { | 297 } on FileIOException catch (ex) { |
298 throw 'Error: Cannot read "${relativize(cwd, uri)}" (${ex.osError}).'; | 298 throw 'Error: Cannot read "${relativize(cwd, uri)}" (${ex.osError}).'; |
299 } | 299 } |
300 sourceFiles[uri.toString()] = | 300 sourceFiles[uri.toString()] = |
301 new SourceFile(relativize(cwd, uri), source); | 301 new SourceFile(relativize(cwd, uri), source); |
302 return new Future.immediate(source); | 302 return new Future.immediate(source); |
303 } | 303 } |
304 | 304 |
305 void handler(Uri uri, int begin, int end, | 305 void handler(Uri uri, int begin, int end, |
306 String message, diagnostics.Diagnostic kind) { | 306 String message, diagnostics.Diagnostic kind) { |
307 if (isAborting) return; | 307 if (isAborting) return; |
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1381 if (node !== null) { | 1381 if (node !== null) { |
1382 var span = system.compiler.spanFromNode(node, script.uri); | 1382 var span = system.compiler.spanFromNode(node, script.uri); |
1383 return new Dart2JsLocation(script, span); | 1383 return new Dart2JsLocation(script, span); |
1384 } else { | 1384 } else { |
1385 var span = system.compiler.spanFromElement(_variable); | 1385 var span = system.compiler.spanFromElement(_variable); |
1386 return new Dart2JsLocation(script, span); | 1386 return new Dart2JsLocation(script, span); |
1387 } | 1387 } |
1388 } | 1388 } |
1389 } | 1389 } |
1390 | 1390 |
OLD | NEW |