| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 testing.abstract_context; | 5 library testing.abstract_context; |
| 6 | 6 |
| 7 import 'dart:async'; |
| 8 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| 9 import 'package:analyzer/dart/element/visitor.dart'; | 11 import 'package:analyzer/dart/element/visitor.dart'; |
| 10 import 'package:analyzer/exception/exception.dart'; | 12 import 'package:analyzer/exception/exception.dart'; |
| 11 import 'package:analyzer/file_system/file_system.dart'; | 13 import 'package:analyzer/file_system/file_system.dart'; |
| 12 import 'package:analyzer/file_system/memory_file_system.dart'; | 14 import 'package:analyzer/file_system/memory_file_system.dart'; |
| 13 import 'package:analyzer/file_system/physical_file_system.dart'; | 15 import 'package:analyzer/file_system/physical_file_system.dart'; |
| 14 import 'package:analyzer/source/package_map_resolver.dart'; | 16 import 'package:analyzer/source/package_map_resolver.dart'; |
| 15 import 'package:analyzer/src/dart/analysis/byte_store.dart'; | 17 import 'package:analyzer/src/dart/analysis/byte_store.dart'; |
| 16 import 'package:analyzer/src/dart/analysis/driver.dart'; | 18 import 'package:analyzer/src/dart/analysis/driver.dart'; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 if (!result.hasMoreWork) { | 118 if (!result.hasMoreWork) { |
| 117 break; | 119 break; |
| 118 } | 120 } |
| 119 } | 121 } |
| 120 } | 122 } |
| 121 | 123 |
| 122 void processRequiredPlugins() { | 124 void processRequiredPlugins() { |
| 123 AnalysisEngine.instance.processRequiredPlugins(); | 125 AnalysisEngine.instance.processRequiredPlugins(); |
| 124 } | 126 } |
| 125 | 127 |
| 126 CompilationUnit resolveDartUnit(Source unitSource, Source librarySource) { | 128 Future<CompilationUnit> resolveLibraryUnit(Source source) async { |
| 127 return context.resolveCompilationUnit2(unitSource, librarySource); | 129 if (enableNewAnalysisDriver) { |
| 128 } | 130 return (await driver.getResult(source.fullName))?.unit; |
| 129 | 131 } else { |
| 130 CompilationUnit resolveLibraryUnit(Source source) { | 132 return context.resolveCompilationUnit2(source, source); |
| 131 return context.resolveCompilationUnit2(source, source); | 133 } |
| 132 } | 134 } |
| 133 | 135 |
| 134 void setUp() { | 136 void setUp() { |
| 135 processRequiredPlugins(); | 137 processRequiredPlugins(); |
| 136 setupResourceProvider(); | 138 setupResourceProvider(); |
| 137 resourceResolver = new ResourceUriResolver(provider); | 139 resourceResolver = new ResourceUriResolver(provider); |
| 138 packageMap = new Map<String, List<Folder>>(); | 140 packageMap = new Map<String, List<Folder>>(); |
| 139 PackageMapUriResolver packageResolver = | 141 PackageMapUriResolver packageResolver = |
| 140 new PackageMapUriResolver(provider, packageMap); | 142 new PackageMapUriResolver(provider, packageMap); |
| 141 SourceFactory sourceFactory = | 143 SourceFactory sourceFactory = |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 * [engine.GeneralizingElementVisitor]. | 200 * [engine.GeneralizingElementVisitor]. |
| 199 */ | 201 */ |
| 200 class _ElementVisitorFunctionWrapper extends GeneralizingElementVisitor { | 202 class _ElementVisitorFunctionWrapper extends GeneralizingElementVisitor { |
| 201 final _ElementVisitorFunction function; | 203 final _ElementVisitorFunction function; |
| 202 _ElementVisitorFunctionWrapper(this.function); | 204 _ElementVisitorFunctionWrapper(this.function); |
| 203 visitElement(Element element) { | 205 visitElement(Element element) { |
| 204 function(element); | 206 function(element); |
| 205 super.visitElement(element); | 207 super.visitElement(element); |
| 206 } | 208 } |
| 207 } | 209 } |
| OLD | NEW |