| 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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 {bool verbose: false}) { | 382 {bool verbose: false}) { |
| 383 return (uri, int begin, int end, String message, kind) { | 383 return (uri, int begin, int end, String message, kind) { |
| 384 if (kind == api.Diagnostic.VERBOSE_INFO && !verbose) return; | 384 if (kind == api.Diagnostic.VERBOSE_INFO && !verbose) return; |
| 385 SourceFile sourceFile; | 385 SourceFile sourceFile; |
| 386 if (uri == null) { | 386 if (uri == null) { |
| 387 sourceFile = new StringSourceFile.fromName('analysis', text); | 387 sourceFile = new StringSourceFile.fromName('analysis', text); |
| 388 } else { | 388 } else { |
| 389 sourceFile = compiler.sourceFiles[uri.toString()]; | 389 sourceFile = compiler.sourceFiles[uri.toString()]; |
| 390 } | 390 } |
| 391 if (sourceFile != null && begin != null && end != null) { | 391 if (sourceFile != null && begin != null && end != null) { |
| 392 print(sourceFile.getLocationMessage(message, begin, end)); | 392 print('${kind}: ${sourceFile.getLocationMessage(message, begin, end)}'); |
| 393 } else { | 393 } else { |
| 394 print(message); | 394 print('${kind}: $message'); |
| 395 } | 395 } |
| 396 }; | 396 }; |
| 397 } | 397 } |
| 398 | 398 |
| 399 class MockElement extends FunctionElementX { | 399 class MockElement extends FunctionElementX { |
| 400 MockElement(Element enclosingElement) | 400 MockElement(Element enclosingElement) |
| 401 : super('', ElementKind.FUNCTION, Modifiers.EMPTY, | 401 : super('', ElementKind.FUNCTION, Modifiers.EMPTY, |
| 402 enclosingElement); | 402 enclosingElement); |
| 403 | 403 |
| 404 get node => null; | 404 get node => null; |
| 405 | 405 |
| 406 parseNode(_) => null; | 406 parseNode(_) => null; |
| 407 | 407 |
| 408 bool get hasNode => false; | 408 bool get hasNode => false; |
| 409 } | 409 } |
| OLD | NEW |