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; |
11 import 'package:compiler/src/common/names.dart' show Uris; | 11 import 'package:compiler/src/common/names.dart' show Uris; |
12 import 'package:compiler/src/constants/expressions.dart'; | 12 import 'package:compiler/src/constants/expressions.dart'; |
13 import 'package:compiler/src/elements/resolution_types.dart' | 13 import 'package:compiler/src/elements/resolution_types.dart' |
14 show ResolutionDartType; | 14 show ResolutionDartType; |
15 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; | 15 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; |
16 import 'package:compiler/src/diagnostics/source_span.dart'; | 16 import 'package:compiler/src/diagnostics/source_span.dart'; |
17 import 'package:compiler/src/diagnostics/spannable.dart'; | 17 import 'package:compiler/src/diagnostics/spannable.dart'; |
18 import 'package:compiler/src/elements/elements.dart'; | 18 import 'package:compiler/src/elements/elements.dart'; |
19 import 'package:compiler/src/elements/visitor.dart'; | 19 import 'package:compiler/src/elements/visitor.dart'; |
20 import 'package:compiler/src/library_loader.dart' show LoadedLibraries; | 20 import 'package:compiler/src/library_loader.dart' show LoadedLibraries; |
21 import 'package:compiler/src/js_backend/backend_helpers.dart' | 21 import 'package:compiler/src/js_backend/backend.dart' show JavaScriptBackend; |
22 show BackendHelpers; | |
23 import 'package:compiler/src/js_backend/lookup_map_analysis.dart' | 22 import 'package:compiler/src/js_backend/lookup_map_analysis.dart' |
24 show LookupMapResolutionAnalysis; | 23 show LookupMapResolutionAnalysis; |
25 import 'package:compiler/src/io/source_file.dart'; | 24 import 'package:compiler/src/io/source_file.dart'; |
26 import 'package:compiler/src/options.dart' show CompilerOptions; | 25 import 'package:compiler/src/options.dart' show CompilerOptions; |
27 import 'package:compiler/src/resolution/members.dart'; | 26 import 'package:compiler/src/resolution/members.dart'; |
28 import 'package:compiler/src/resolution/registry.dart'; | 27 import 'package:compiler/src/resolution/registry.dart'; |
29 import 'package:compiler/src/resolution/scope.dart'; | 28 import 'package:compiler/src/resolution/scope.dart'; |
30 import 'package:compiler/src/resolution/tree_elements.dart'; | 29 import 'package:compiler/src/resolution/tree_elements.dart'; |
31 import 'package:compiler/src/resolved_uri_translator.dart'; | 30 import 'package:compiler/src/resolved_uri_translator.dart'; |
32 import 'package:compiler/src/script.dart'; | 31 import 'package:compiler/src/script.dart'; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 trustTypeAnnotations: trustTypeAnnotations, | 107 trustTypeAnnotations: trustTypeAnnotations, |
109 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations, | 108 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations, |
110 shownPackageWarnings: const []), | 109 shownPackageWarnings: const []), |
111 outputProvider: outputProvider) { | 110 outputProvider: outputProvider) { |
112 deferredLoadTask = new MockDeferredLoadTask(this); | 111 deferredLoadTask = new MockDeferredLoadTask(this); |
113 | 112 |
114 registerSource( | 113 registerSource( |
115 Uris.dart_core, buildLibrarySource(DEFAULT_CORE_LIBRARY, coreSource)); | 114 Uris.dart_core, buildLibrarySource(DEFAULT_CORE_LIBRARY, coreSource)); |
116 registerSource(PATCH_CORE, DEFAULT_PATCH_CORE_SOURCE); | 115 registerSource(PATCH_CORE, DEFAULT_PATCH_CORE_SOURCE); |
117 | 116 |
118 registerSource(BackendHelpers.DART_JS_HELPER, | 117 registerSource( |
119 buildLibrarySource(DEFAULT_JS_HELPER_LIBRARY)); | 118 Uris.dart__js_helper, buildLibrarySource(DEFAULT_JS_HELPER_LIBRARY)); |
120 registerSource(BackendHelpers.DART_FOREIGN_HELPER, | 119 registerSource(Uris.dart__foreign_helper, |
121 buildLibrarySource(DEFAULT_FOREIGN_HELPER_LIBRARY)); | 120 buildLibrarySource(DEFAULT_FOREIGN_HELPER_LIBRARY)); |
122 registerSource(BackendHelpers.DART_INTERCEPTORS, | 121 registerSource(Uris.dart__interceptors, |
123 buildLibrarySource(DEFAULT_INTERCEPTORS_LIBRARY)); | 122 buildLibrarySource(DEFAULT_INTERCEPTORS_LIBRARY)); |
124 registerSource(BackendHelpers.DART_ISOLATE_HELPER, | 123 registerSource(Uris.dart__isolate_helper, |
125 buildLibrarySource(DEFAULT_ISOLATE_HELPER_LIBRARY)); | 124 buildLibrarySource(DEFAULT_ISOLATE_HELPER_LIBRARY)); |
126 registerSource(Uris.dart_mirrors, DEFAULT_MIRRORS_SOURCE); | 125 registerSource(Uris.dart_mirrors, DEFAULT_MIRRORS_SOURCE); |
127 registerSource(BackendHelpers.DART_JS_MIRRORS, DEFAULT_JS_MIRRORS_SOURCE); | 126 registerSource(Uris.dart__js_mirrors, DEFAULT_JS_MIRRORS_SOURCE); |
128 | 127 |
129 Map<String, String> asyncLibrarySource = <String, String>{}; | 128 Map<String, String> asyncLibrarySource = <String, String>{}; |
130 asyncLibrarySource.addAll(DEFAULT_ASYNC_LIBRARY); | 129 asyncLibrarySource.addAll(DEFAULT_ASYNC_LIBRARY); |
131 if (enableAsyncAwait) { | 130 if (enableAsyncAwait) { |
132 asyncLibrarySource.addAll(ASYNC_AWAIT_LIBRARY); | 131 asyncLibrarySource.addAll(ASYNC_AWAIT_LIBRARY); |
133 } | 132 } |
134 registerSource(Uris.dart_async, buildLibrarySource(asyncLibrarySource)); | 133 registerSource(Uris.dart_async, buildLibrarySource(asyncLibrarySource)); |
135 registerSource(LookupMapResolutionAnalysis.PACKAGE_LOOKUP_MAP, | 134 registerSource(LookupMapResolutionAnalysis.PACKAGE_LOOKUP_MAP, |
136 buildLibrarySource(DEFAULT_LOOKUP_MAP_LIBRARY)); | 135 buildLibrarySource(DEFAULT_LOOKUP_MAP_LIBRARY)); |
137 } | 136 } |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 trustTypeAnnotations: trustTypeAnnotations, | 397 trustTypeAnnotations: trustTypeAnnotations, |
399 enableTypeAssertions: enableTypeAssertions, | 398 enableTypeAssertions: enableTypeAssertions, |
400 enableUserAssertions: enableUserAssertions, | 399 enableUserAssertions: enableUserAssertions, |
401 expectedErrors: expectedErrors, | 400 expectedErrors: expectedErrors, |
402 expectedWarnings: expectedWarnings, | 401 expectedWarnings: expectedWarnings, |
403 outputProvider: outputProvider); | 402 outputProvider: outputProvider); |
404 compiler.registerSource(uri, code); | 403 compiler.registerSource(uri, code); |
405 compiler.diagnosticHandler = createHandler(compiler, code); | 404 compiler.diagnosticHandler = createHandler(compiler, code); |
406 return compiler; | 405 return compiler; |
407 } | 406 } |
OLD | NEW |