| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012, 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 "package:expect/expect.dart"; |  | 
| 8 import 'dart:async'; | 7 import 'dart:async'; | 
| 9 import 'dart:collection'; | 8 import 'dart:collection'; | 
| 10 | 9 | 
| 11 import 'package:compiler/compiler.dart' as api; | 10 import 'package:compiler/compiler.dart' as api; | 
| 12 import 'package:compiler/compiler_new.dart' as new_api; |  | 
| 13 import 'package:compiler/src/common/names.dart' show | 11 import 'package:compiler/src/common/names.dart' show | 
| 14     Uris; | 12     Uris; | 
| 15 import 'package:compiler/src/constants/expressions.dart'; | 13 import 'package:compiler/src/constants/expressions.dart'; | 
| 16 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; | 14 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; | 
| 17 import 'package:compiler/src/diagnostics/source_span.dart'; | 15 import 'package:compiler/src/diagnostics/source_span.dart'; | 
| 18 import 'package:compiler/src/diagnostics/spannable.dart'; | 16 import 'package:compiler/src/diagnostics/spannable.dart'; | 
| 19 import 'package:compiler/src/elements/elements.dart'; | 17 import 'package:compiler/src/elements/elements.dart'; | 
| 20 import 'package:compiler/src/js_backend/backend_helpers.dart' | 18 import 'package:compiler/src/js_backend/backend_helpers.dart' show | 
| 21     show BackendHelpers; | 19     BackendHelpers; | 
| 22 import 'package:compiler/src/js_backend/lookup_map_analysis.dart' | 20 import 'package:compiler/src/js_backend/lookup_map_analysis.dart' show | 
| 23     show LookupMapAnalysis; | 21     LookupMapAnalysis; | 
| 24 import 'package:compiler/src/io/source_file.dart'; | 22 import 'package:compiler/src/io/source_file.dart'; | 
|  | 23 import 'package:compiler/src/options.dart' show | 
|  | 24     CompilerOptions; | 
| 25 import 'package:compiler/src/resolution/members.dart'; | 25 import 'package:compiler/src/resolution/members.dart'; | 
| 26 import 'package:compiler/src/resolution/registry.dart'; | 26 import 'package:compiler/src/resolution/registry.dart'; | 
| 27 import 'package:compiler/src/resolution/scope.dart'; | 27 import 'package:compiler/src/resolution/scope.dart'; | 
| 28 import 'package:compiler/src/resolution/tree_elements.dart'; | 28 import 'package:compiler/src/resolution/tree_elements.dart'; | 
| 29 import 'package:compiler/src/script.dart'; | 29 import 'package:compiler/src/script.dart'; | 
| 30 import 'package:compiler/src/tree/tree.dart'; | 30 import 'package:compiler/src/tree/tree.dart'; | 
| 31 import 'package:compiler/src/old_to_new_api.dart'; | 31 import 'package:compiler/src/old_to_new_api.dart'; | 
| 32 import 'parser_helper.dart'; | 32 import 'parser_helper.dart'; | 
| 33 | 33 | 
| 34 import 'package:compiler/src/elements/modelx.dart' | 34 import 'package:compiler/src/elements/modelx.dart' show | 
| 35     show ElementX, | 35     ElementX, | 
| 36          LibraryElementX, | 36     LibraryElementX, | 
| 37          ErroneousElementX, | 37     ErroneousElementX, | 
| 38          FunctionElementX; | 38     FunctionElementX; | 
| 39 | 39 | 
| 40 import 'package:compiler/src/compiler.dart'; | 40 import 'package:compiler/src/compiler.dart'; | 
| 41 | 41 | 
| 42 import 'package:compiler/src/deferred_load.dart' | 42 import 'package:compiler/src/deferred_load.dart' show | 
| 43     show DeferredLoadTask, | 43     DeferredLoadTask, | 
| 44          OutputUnit; | 44     OutputUnit; | 
| 45 | 45 | 
| 46 import 'mock_libraries.dart'; | 46 import 'mock_libraries.dart'; | 
| 47 import 'diagnostic_helper.dart'; | 47 import 'diagnostic_helper.dart'; | 
| 48 | 48 | 
| 49 export 'diagnostic_helper.dart'; | 49 export 'diagnostic_helper.dart'; | 
| 50 | 50 | 
| 51 final Uri PATCH_CORE = new Uri(scheme: 'patch', path: 'core'); | 51 final Uri PATCH_CORE = new Uri(scheme: 'patch', path: 'core'); | 
| 52 | 52 | 
| 53 typedef String LibrarySourceProvider(Uri uri); | 53 typedef String LibrarySourceProvider(Uri uri); | 
| 54 | 54 | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
| 81        bool trustTypeAnnotations: false, | 81        bool trustTypeAnnotations: false, | 
| 82        bool trustJSInteropTypeAnnotations: false, | 82        bool trustJSInteropTypeAnnotations: false, | 
| 83        bool enableAsyncAwait: false, | 83        bool enableAsyncAwait: false, | 
| 84        int this.expectedWarnings, | 84        int this.expectedWarnings, | 
| 85        int this.expectedErrors, | 85        int this.expectedErrors, | 
| 86        api.CompilerOutputProvider outputProvider, | 86        api.CompilerOutputProvider outputProvider, | 
| 87        String patchVersion, | 87        String patchVersion, | 
| 88        LibrarySourceProvider this.librariesOverride}) | 88        LibrarySourceProvider this.librariesOverride}) | 
| 89       : sourceFiles = new Map<String, SourceFile>(), | 89       : sourceFiles = new Map<String, SourceFile>(), | 
| 90         testedPatchVersion = patchVersion, | 90         testedPatchVersion = patchVersion, | 
| 91         super(options: new new_api.CompilerOptions( | 91         super(options: new CompilerOptions( | 
| 92               entryPoint: new Uri(scheme: 'mock'), | 92               entryPoint: new Uri(scheme: 'mock'), | 
| 93               libraryRoot: Uri.parse('placeholder_library_root_for_mock/'), | 93               libraryRoot: Uri.parse('placeholder_library_root_for_mock/'), | 
| 94               enableTypeAssertions: enableTypeAssertions, | 94               enableTypeAssertions: enableTypeAssertions, | 
| 95               enableUserAssertions: enableUserAssertions, | 95               enableUserAssertions: enableUserAssertions, | 
| 96               disableInlining: disableInlining, | 96               disableInlining: disableInlining, | 
| 97               enableAssertMessage: true, | 97               enableAssertMessage: true, | 
| 98               enableMinification: enableMinification, | 98               enableMinification: enableMinification, | 
| 99               disableTypeInference: disableTypeInference, | 99               disableTypeInference: disableTypeInference, | 
| 100               analyzeAll: analyzeAll, | 100               analyzeAll: analyzeAll, | 
| 101               analyzeOnly: analyzeOnly, | 101               analyzeOnly: analyzeOnly, | 
| 102               emitJavaScript: emitJavaScript, | 102               emitJavaScript: emitJavaScript, | 
| 103               preserveComments: preserveComments, | 103               preserveComments: preserveComments, | 
| 104               trustTypeAnnotations: trustTypeAnnotations, | 104               trustTypeAnnotations: trustTypeAnnotations, | 
| 105               trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations, | 105               trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations, | 
| 106               diagnosticOptions: | 106               shownPackageWarnings: const []), | 
| 107                   new DiagnosticOptions(shownPackageWarnings: const [])), |  | 
| 108               outputProvider: new LegacyCompilerOutput(outputProvider)) { | 107               outputProvider: new LegacyCompilerOutput(outputProvider)) { | 
| 109 | 108 | 
| 110     deferredLoadTask = new MockDeferredLoadTask(this); | 109     deferredLoadTask = new MockDeferredLoadTask(this); | 
| 111 | 110 | 
| 112     registerSource(Uris.dart_core, | 111     registerSource(Uris.dart_core, | 
| 113                    buildLibrarySource(DEFAULT_CORE_LIBRARY, coreSource)); | 112                    buildLibrarySource(DEFAULT_CORE_LIBRARY, coreSource)); | 
| 114     registerSource(PATCH_CORE, DEFAULT_PATCH_CORE_SOURCE); | 113     registerSource(PATCH_CORE, DEFAULT_PATCH_CORE_SOURCE); | 
| 115 | 114 | 
| 116     registerSource(BackendHelpers.DART_JS_HELPER, | 115     registerSource(BackendHelpers.DART_JS_HELPER, | 
| 117                    buildLibrarySource(DEFAULT_JS_HELPER_LIBRARY)); | 116                    buildLibrarySource(DEFAULT_JS_HELPER_LIBRARY)); | 
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 371       trustTypeAnnotations: trustTypeAnnotations, | 370       trustTypeAnnotations: trustTypeAnnotations, | 
| 372       enableTypeAssertions: enableTypeAssertions, | 371       enableTypeAssertions: enableTypeAssertions, | 
| 373       enableUserAssertions: enableUserAssertions, | 372       enableUserAssertions: enableUserAssertions, | 
| 374       expectedErrors: expectedErrors, | 373       expectedErrors: expectedErrors, | 
| 375       expectedWarnings: expectedWarnings, | 374       expectedWarnings: expectedWarnings, | 
| 376       outputProvider: outputProvider); | 375       outputProvider: outputProvider); | 
| 377   compiler.registerSource(uri, code); | 376   compiler.registerSource(uri, code); | 
| 378   compiler.diagnosticHandler = createHandler(compiler, code); | 377   compiler.diagnosticHandler = createHandler(compiler, code); | 
| 379   return compiler; | 378   return compiler; | 
| 380 } | 379 } | 
| OLD | NEW | 
|---|