| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 return libraryLoader | 141 return libraryLoader |
| 142 .loadLibrary(uri) | 142 .loadLibrary(uri) |
| 143 .then((LoadedLibraries loadedLibraries) { | 143 .then((LoadedLibraries loadedLibraries) { |
| 144 processLoadedLibraries(loadedLibraries); | 144 processLoadedLibraries(loadedLibraries); |
| 145 mainApp = loadedLibraries.rootLibrary; | 145 mainApp = loadedLibraries.rootLibrary; |
| 146 startResolution(); | 146 startResolution(); |
| 147 // We need to make sure the Object class is resolved. When registering a | 147 // We need to make sure the Object class is resolved. When registering a |
| 148 // dynamic invocation the ArgumentTypesRegistry eventually iterates over | 148 // dynamic invocation the ArgumentTypesRegistry eventually iterates over |
| 149 // the interfaces of the Object class which would be 'null' if the class | 149 // the interfaces of the Object class which would be 'null' if the class |
| 150 // wasn't resolved. | 150 // wasn't resolved. |
| 151 ClassElement objectClass = commonElements.objectClass; | 151 ClassElement objectClass = resolution.commonElements.objectClass; |
| 152 objectClass.ensureResolved(resolution); | 152 objectClass.ensureResolved(resolution); |
| 153 }).then((_) => uri); | 153 }).then((_) => uri); |
| 154 } | 154 } |
| 155 | 155 |
| 156 Future run(Uri uri, [String mainSource = ""]) { | 156 Future run(Uri uri, [String mainSource = ""]) { |
| 157 return init(mainSource).then((Uri mainUri) { | 157 return init(mainSource).then((Uri mainUri) { |
| 158 return super.run(uri == null ? mainUri : uri); | 158 return super.run(uri == null ? mainUri : uri); |
| 159 }).then((result) { | 159 }).then((result) { |
| 160 if (expectedErrors != null && | 160 if (expectedErrors != null && |
| 161 expectedErrors != diagnosticCollector.errors.length) { | 161 expectedErrors != diagnosticCollector.errors.length) { |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 trustTypeAnnotations: trustTypeAnnotations, | 394 trustTypeAnnotations: trustTypeAnnotations, |
| 395 enableTypeAssertions: enableTypeAssertions, | 395 enableTypeAssertions: enableTypeAssertions, |
| 396 enableUserAssertions: enableUserAssertions, | 396 enableUserAssertions: enableUserAssertions, |
| 397 expectedErrors: expectedErrors, | 397 expectedErrors: expectedErrors, |
| 398 expectedWarnings: expectedWarnings, | 398 expectedWarnings: expectedWarnings, |
| 399 outputProvider: outputProvider); | 399 outputProvider: outputProvider); |
| 400 compiler.registerSource(uri, code); | 400 compiler.registerSource(uri, code); |
| 401 compiler.diagnosticHandler = createHandler(compiler, code); | 401 compiler.diagnosticHandler = createHandler(compiler, code); |
| 402 return compiler; | 402 return compiler; |
| 403 } | 403 } |
| OLD | NEW |