| 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 | 367 |
| 368 api.DiagnosticHandler createHandler(MockCompiler compiler, String text) { | 368 api.DiagnosticHandler createHandler(MockCompiler compiler, String text) { |
| 369 return (uri, int begin, int end, String message, kind) { | 369 return (uri, int begin, int end, String message, kind) { |
| 370 SourceFile sourceFile; | 370 SourceFile sourceFile; |
| 371 if (uri == null) { | 371 if (uri == null) { |
| 372 sourceFile = new StringSourceFile('analysis', text); | 372 sourceFile = new StringSourceFile('analysis', text); |
| 373 } else { | 373 } else { |
| 374 sourceFile = compiler.sourceFiles[uri.toString()]; | 374 sourceFile = compiler.sourceFiles[uri.toString()]; |
| 375 } | 375 } |
| 376 if (sourceFile != null && begin != null && end != null) { | 376 if (sourceFile != null && begin != null && end != null) { |
| 377 print(sourceFile.getLocationMessage(message, begin, end, true, (x) => x)); | 377 print(sourceFile.getLocationMessage(message, begin, end)); |
| 378 } else { | 378 } else { |
| 379 print(message); | 379 print(message); |
| 380 } | 380 } |
| 381 }; | 381 }; |
| 382 } | 382 } |
| 383 | 383 |
| 384 class MockElement extends FunctionElementX { | 384 class MockElement extends FunctionElementX { |
| 385 MockElement(Element enclosingElement) | 385 MockElement(Element enclosingElement) |
| 386 : super('', ElementKind.FUNCTION, Modifiers.EMPTY, | 386 : super('', ElementKind.FUNCTION, Modifiers.EMPTY, |
| 387 enclosingElement, false); | 387 enclosingElement, false); |
| 388 | 388 |
| 389 get node => null; | 389 get node => null; |
| 390 | 390 |
| 391 parseNode(_) => null; | 391 parseNode(_) => null; |
| 392 | 392 |
| 393 bool get hasNode => false; | 393 bool get hasNode => false; |
| 394 } | 394 } |
| OLD | NEW |