| 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.dart' as api; | 10 import 'package:compiler/compiler.dart' as api; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 final Measurer measurer = new Measurer(); | 73 final Measurer measurer = new Measurer(); |
| 74 | 74 |
| 75 MockCompiler.internal( | 75 MockCompiler.internal( |
| 76 {Map<String, String> coreSource, | 76 {Map<String, String> coreSource, |
| 77 bool enableTypeAssertions: false, | 77 bool enableTypeAssertions: false, |
| 78 bool enableUserAssertions: false, | 78 bool enableUserAssertions: false, |
| 79 bool enableMinification: false, | 79 bool enableMinification: false, |
| 80 bool disableTypeInference: false, | 80 bool disableTypeInference: false, |
| 81 bool analyzeAll: false, | 81 bool analyzeAll: false, |
| 82 bool analyzeOnly: false, | 82 bool analyzeOnly: false, |
| 83 bool emitJavaScript: true, | |
| 84 bool preserveComments: false, | 83 bool preserveComments: false, |
| 85 // Our unit tests check code generation output that is | 84 // Our unit tests check code generation output that is |
| 86 // affected by inlining support. | 85 // affected by inlining support. |
| 87 bool disableInlining: true, | 86 bool disableInlining: true, |
| 88 bool trustTypeAnnotations: false, | 87 bool trustTypeAnnotations: false, |
| 89 bool trustJSInteropTypeAnnotations: false, | 88 bool trustJSInteropTypeAnnotations: false, |
| 90 bool enableAsyncAwait: false, | 89 bool enableAsyncAwait: false, |
| 91 int this.expectedWarnings, | 90 int this.expectedWarnings, |
| 92 int this.expectedErrors, | 91 int this.expectedErrors, |
| 93 api.CompilerOutputProvider outputProvider, | 92 api.CompilerOutputProvider outputProvider, |
| 94 String patchVersion, | 93 String patchVersion, |
| 95 LibrarySourceProvider this.librariesOverride}) | 94 LibrarySourceProvider this.librariesOverride}) |
| 96 : sourceFiles = new Map<String, SourceFile>(), | 95 : sourceFiles = new Map<String, SourceFile>(), |
| 97 testedPatchVersion = patchVersion, | 96 testedPatchVersion = patchVersion, |
| 98 super(options: new CompilerOptions( | 97 super(options: new CompilerOptions( |
| 99 entryPoint: new Uri(scheme: 'mock'), | 98 entryPoint: new Uri(scheme: 'mock'), |
| 100 libraryRoot: Uri.parse('placeholder_library_root_for_mock/'), | 99 libraryRoot: Uri.parse('placeholder_library_root_for_mock/'), |
| 101 enableTypeAssertions: enableTypeAssertions, | 100 enableTypeAssertions: enableTypeAssertions, |
| 102 enableUserAssertions: enableUserAssertions, | 101 enableUserAssertions: enableUserAssertions, |
| 103 disableInlining: disableInlining, | 102 disableInlining: disableInlining, |
| 104 enableAssertMessage: true, | 103 enableAssertMessage: true, |
| 105 enableMinification: enableMinification, | 104 enableMinification: enableMinification, |
| 106 disableTypeInference: disableTypeInference, | 105 disableTypeInference: disableTypeInference, |
| 107 analyzeAll: analyzeAll, | 106 analyzeAll: analyzeAll, |
| 108 analyzeOnly: analyzeOnly, | 107 analyzeOnly: analyzeOnly, |
| 109 emitJavaScript: emitJavaScript, | |
| 110 preserveComments: preserveComments, | 108 preserveComments: preserveComments, |
| 111 trustTypeAnnotations: trustTypeAnnotations, | 109 trustTypeAnnotations: trustTypeAnnotations, |
| 112 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations, | 110 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations, |
| 113 shownPackageWarnings: const []), | 111 shownPackageWarnings: const []), |
| 114 outputProvider: new LegacyCompilerOutput(outputProvider)) { | 112 outputProvider: new LegacyCompilerOutput(outputProvider)) { |
| 115 | 113 |
| 116 deferredLoadTask = new MockDeferredLoadTask(this); | 114 deferredLoadTask = new MockDeferredLoadTask(this); |
| 117 | 115 |
| 118 registerSource(Uris.dart_core, | 116 registerSource(Uris.dart_core, |
| 119 buildLibrarySource(DEFAULT_CORE_LIBRARY, coreSource)); | 117 buildLibrarySource(DEFAULT_CORE_LIBRARY, coreSource)); |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 trustTypeAnnotations: trustTypeAnnotations, | 402 trustTypeAnnotations: trustTypeAnnotations, |
| 405 enableTypeAssertions: enableTypeAssertions, | 403 enableTypeAssertions: enableTypeAssertions, |
| 406 enableUserAssertions: enableUserAssertions, | 404 enableUserAssertions: enableUserAssertions, |
| 407 expectedErrors: expectedErrors, | 405 expectedErrors: expectedErrors, |
| 408 expectedWarnings: expectedWarnings, | 406 expectedWarnings: expectedWarnings, |
| 409 outputProvider: outputProvider); | 407 outputProvider: outputProvider); |
| 410 compiler.registerSource(uri, code); | 408 compiler.registerSource(uri, code); |
| 411 compiler.diagnosticHandler = createHandler(compiler, code); | 409 compiler.diagnosticHandler = createHandler(compiler, code); |
| 412 return compiler; | 410 return compiler; |
| 413 } | 411 } |
| OLD | NEW |