OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'package:compiler/compiler_new.dart' as api; | 10 import 'package:compiler/compiler_new.dart' as api; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 import 'diagnostic_helper.dart'; | 45 import 'diagnostic_helper.dart'; |
46 | 46 |
47 export 'diagnostic_helper.dart'; | 47 export 'diagnostic_helper.dart'; |
48 | 48 |
49 final Uri PATCH_CORE = new Uri(scheme: 'patch', path: 'core'); | 49 final Uri PATCH_CORE = new Uri(scheme: 'patch', path: 'core'); |
50 | 50 |
51 typedef String LibrarySourceProvider(Uri uri); | 51 typedef String LibrarySourceProvider(Uri uri); |
52 | 52 |
53 class MockCompiler extends Compiler { | 53 class MockCompiler extends Compiler { |
54 api.CompilerDiagnostics diagnosticHandler; | 54 api.CompilerDiagnostics diagnosticHandler; |
| 55 final api.CompilerInput provider = null; |
55 | 56 |
56 /// Expected number of warnings. If `null`, the number of warnings is | 57 /// Expected number of warnings. If `null`, the number of warnings is |
57 /// not checked. | 58 /// not checked. |
58 final int expectedWarnings; | 59 final int expectedWarnings; |
59 | 60 |
60 /// Expected number of errors. If `null`, the number of errors is not checked. | 61 /// Expected number of errors. If `null`, the number of errors is not checked. |
61 final int expectedErrors; | 62 final int expectedErrors; |
62 final Map<String, SourceFile> sourceFiles; | 63 final Map<String, SourceFile> sourceFiles; |
63 Node parsedTree; | 64 Node parsedTree; |
64 final LibrarySourceProvider librariesOverride; | 65 final LibrarySourceProvider librariesOverride; |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 trustTypeAnnotations: trustTypeAnnotations, | 395 trustTypeAnnotations: trustTypeAnnotations, |
395 enableTypeAssertions: enableTypeAssertions, | 396 enableTypeAssertions: enableTypeAssertions, |
396 enableUserAssertions: enableUserAssertions, | 397 enableUserAssertions: enableUserAssertions, |
397 expectedErrors: expectedErrors, | 398 expectedErrors: expectedErrors, |
398 expectedWarnings: expectedWarnings, | 399 expectedWarnings: expectedWarnings, |
399 outputProvider: outputProvider); | 400 outputProvider: outputProvider); |
400 compiler.registerSource(uri, code); | 401 compiler.registerSource(uri, code); |
401 compiler.diagnosticHandler = createHandler(compiler, code); | 402 compiler.diagnosticHandler = createHandler(compiler, code); |
402 return compiler; | 403 return compiler; |
403 } | 404 } |
OLD | NEW |