| 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 mock_compiler; | 5 library mock_compiler; |
| 6 | 6 |
| 7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:collection'; | 9 import 'dart:collection'; |
| 10 | 10 |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 } | 463 } |
| 464 } | 464 } |
| 465 | 465 |
| 466 class MockDeferredLoadTask extends DeferredLoadTask { | 466 class MockDeferredLoadTask extends DeferredLoadTask { |
| 467 MockDeferredLoadTask(Compiler compiler) : super(compiler); | 467 MockDeferredLoadTask(Compiler compiler) : super(compiler); |
| 468 | 468 |
| 469 void registerMainApp(LibraryElement mainApp) { | 469 void registerMainApp(LibraryElement mainApp) { |
| 470 // Do nothing. | 470 // Do nothing. |
| 471 } | 471 } |
| 472 } | 472 } |
| 473 |
| 474 api.DiagnosticHandler createHandler(MockCompiler compiler, String text) { |
| 475 return (uri, int begin, int end, String message, kind) { |
| 476 SourceFile sourceFile; |
| 477 if (uri == null) { |
| 478 sourceFile = new SourceFile('analysis', text); |
| 479 } else { |
| 480 sourceFile = compiler.sourceFiles[uri.toString()]; |
| 481 } |
| 482 if (sourceFile != null && begin != null && end != null) { |
| 483 print(sourceFile.getLocationMessage(message, begin, end, true, (x) => x)); |
| 484 } else { |
| 485 print(message); |
| 486 } |
| 487 }; |
| 488 } |
| OLD | NEW |