Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 1215053003: Compute mixin application constructors in the ClassElement.constructors getter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 engine.resolver; 5 library engine.resolver;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import "dart:math" as math;
9
10 import 'package:analyzer/src/generated/utilities_collection.dart';
11 8
12 import 'ast.dart'; 9 import 'ast.dart';
13 import 'constant.dart'; 10 import 'constant.dart';
14 import 'element.dart'; 11 import 'element.dart';
15 import 'element_resolver.dart'; 12 import 'element_resolver.dart';
16 import 'engine.dart'; 13 import 'engine.dart';
17 import 'error.dart'; 14 import 'error.dart';
18 import 'error_verifier.dart'; 15 import 'error_verifier.dart';
19 import 'html.dart' as ht; 16 import 'html.dart' as ht;
20 import 'java_core.dart'; 17 import 'java_core.dart';
(...skipping 2478 matching lines...) Expand 10 before | Expand all | Expand 10 after
2499 ClassElementImpl element = new ClassElementImpl.forNode(className); 2496 ClassElementImpl element = new ClassElementImpl.forNode(className);
2500 element.abstract = node.abstractKeyword != null; 2497 element.abstract = node.abstractKeyword != null;
2501 element.mixinApplication = true; 2498 element.mixinApplication = true;
2502 List<TypeParameterElement> typeParameters = holder.typeParameters; 2499 List<TypeParameterElement> typeParameters = holder.typeParameters;
2503 element.typeParameters = typeParameters; 2500 element.typeParameters = typeParameters;
2504 List<DartType> typeArguments = _createTypeParameterTypes(typeParameters); 2501 List<DartType> typeArguments = _createTypeParameterTypes(typeParameters);
2505 InterfaceTypeImpl interfaceType = new InterfaceTypeImpl(element); 2502 InterfaceTypeImpl interfaceType = new InterfaceTypeImpl(element);
2506 interfaceType.typeArguments = typeArguments; 2503 interfaceType.typeArguments = typeArguments;
2507 element.type = interfaceType; 2504 element.type = interfaceType;
2508 // set default constructor 2505 // set default constructor
2509 element.constructors = _createDefaultConstructors(interfaceType);
2510 for (FunctionTypeImpl functionType in _functionTypesToFix) { 2506 for (FunctionTypeImpl functionType in _functionTypesToFix) {
2511 functionType.typeArguments = typeArguments; 2507 functionType.typeArguments = typeArguments;
2512 } 2508 }
2513 _functionTypesToFix = null; 2509 _functionTypesToFix = null;
2514 _currentHolder.addType(element); 2510 _currentHolder.addType(element);
2515 className.staticElement = element; 2511 className.staticElement = element;
2516 holder.validate(); 2512 holder.validate();
2517 return null; 2513 return null;
2518 } 2514 }
2519 2515
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
2624 return null; 2620 return null;
2625 } 2621 }
2626 2622
2627 @override 2623 @override
2628 Object visitEnumDeclaration(EnumDeclaration node) { 2624 Object visitEnumDeclaration(EnumDeclaration node) {
2629 SimpleIdentifier enumName = node.name; 2625 SimpleIdentifier enumName = node.name;
2630 ClassElementImpl enumElement = new ClassElementImpl.forNode(enumName); 2626 ClassElementImpl enumElement = new ClassElementImpl.forNode(enumName);
2631 enumElement.enum2 = true; 2627 enumElement.enum2 = true;
2632 InterfaceTypeImpl enumType = new InterfaceTypeImpl(enumElement); 2628 InterfaceTypeImpl enumType = new InterfaceTypeImpl(enumElement);
2633 enumElement.type = enumType; 2629 enumElement.type = enumType;
2630 // The equivalent code for enums in the spec shows a single constructor,
2631 // but that constructor is not callable (since it is a compile-time error
2632 // to subclass, mix-in, implement, or explicitly instantiate an enum). So
2633 // we represent this as having no constructors.
2634 enumElement.constructors = ConstructorElement.EMPTY_LIST;
2634 _currentHolder.addEnum(enumElement); 2635 _currentHolder.addEnum(enumElement);
2635 enumName.staticElement = enumElement; 2636 enumName.staticElement = enumElement;
2636 return super.visitEnumDeclaration(node); 2637 return super.visitEnumDeclaration(node);
2637 } 2638 }
2638 2639
2639 @override 2640 @override
2640 Object visitFieldDeclaration(FieldDeclaration node) { 2641 Object visitFieldDeclaration(FieldDeclaration node) {
2641 bool wasInField = _inFieldContext; 2642 bool wasInField = _inFieldContext;
2642 _inFieldContext = true; 2643 _inFieldContext = true;
2643 try { 2644 try {
(...skipping 2494 matching lines...) Expand 10 before | Expand all | Expand 10 after
5138 */ 5139 */
5139 void _reportValueError(ErrorCode errorCode, ht.XmlAttributeNode attribute, 5140 void _reportValueError(ErrorCode errorCode, ht.XmlAttributeNode attribute,
5140 List<Object> arguments) { 5141 List<Object> arguments) {
5141 int offset = attribute.valueToken.offset + 1; 5142 int offset = attribute.valueToken.offset + 1;
5142 int length = attribute.valueToken.length - 2; 5143 int length = attribute.valueToken.length - 2;
5143 _reportErrorForOffset(errorCode, offset, length, arguments); 5144 _reportErrorForOffset(errorCode, offset, length, arguments);
5144 } 5145 }
5145 } 5146 }
5146 5147
5147 /** 5148 /**
5148 * Instances of the class `ImplicitConstructorBuilder` are used to build
5149 * implicit constructors for mixin applications, and to check for errors
5150 * related to super constructor calls in class declarations with mixins.
5151 *
5152 * The visitor methods don't directly build the implicit constructors or check
5153 * for errors, since they don't in general visit the classes in the proper
5154 * order to do so correctly. Instead, they pass closures to
5155 * ImplicitConstructorBuilderCallback to inform it of the computations to be
5156 * done and their ordering dependencies.
5157 */
5158 class ImplicitConstructorBuilder extends SimpleElementVisitor {
5159 final AnalysisErrorListener errorListener;
5160
5161 /**
5162 * Callback to receive the computations to be performed.
5163 */
5164 final ImplicitConstructorBuilderCallback _callback;
5165
5166 /**
5167 * Initialize a newly created visitor to build implicit constructors.
5168 *
5169 * The visit methods will pass closures to [_callback] to indicate what
5170 * computation needs to be performed, and its dependency order.
5171 */
5172 ImplicitConstructorBuilder(this.errorListener, this._callback);
5173
5174 @override
5175 void visitClassElement(ClassElement classElement) {
5176 (classElement as ClassElementImpl).mixinErrorsReported = false;
5177 if (classElement.isMixinApplication) {
5178 _visitClassTypeAlias(classElement);
5179 } else {
5180 _visitClassDeclaration(classElement);
5181 }
5182 }
5183
5184 @override
5185 void visitCompilationUnitElement(CompilationUnitElement element) {
5186 element.types.forEach(visitClassElement);
5187 }
5188
5189 @override
5190 void visitLibraryElement(LibraryElement element) {
5191 element.units.forEach(visitCompilationUnitElement);
5192 }
5193
5194 /**
5195 * Create an implicit constructor that is copied from the given constructor, b ut that is in the
5196 * given class.
5197 *
5198 * @param classType the class in which the implicit constructor is defined
5199 * @param explicitConstructor the constructor on which the implicit constructo r is modeled
5200 * @param parameterTypes the types to be replaced when creating parameters
5201 * @param argumentTypes the types with which the parameters are to be replaced
5202 * @return the implicit constructor that was created
5203 */
5204 ConstructorElement _createImplicitContructor(InterfaceType classType,
5205 ConstructorElement explicitConstructor, List<DartType> parameterTypes,
5206 List<DartType> argumentTypes) {
5207 ConstructorElementImpl implicitConstructor =
5208 new ConstructorElementImpl(explicitConstructor.name, -1);
5209 implicitConstructor.synthetic = true;
5210 implicitConstructor.redirectedConstructor = explicitConstructor;
5211 implicitConstructor.const2 = explicitConstructor.isConst;
5212 implicitConstructor.returnType = classType;
5213 List<ParameterElement> explicitParameters = explicitConstructor.parameters;
5214 int count = explicitParameters.length;
5215 if (count > 0) {
5216 List<ParameterElement> implicitParameters =
5217 new List<ParameterElement>(count);
5218 for (int i = 0; i < count; i++) {
5219 ParameterElement explicitParameter = explicitParameters[i];
5220 ParameterElementImpl implicitParameter =
5221 new ParameterElementImpl(explicitParameter.name, -1);
5222 implicitParameter.const3 = explicitParameter.isConst;
5223 implicitParameter.final2 = explicitParameter.isFinal;
5224 implicitParameter.parameterKind = explicitParameter.parameterKind;
5225 implicitParameter.synthetic = true;
5226 implicitParameter.type =
5227 explicitParameter.type.substitute2(argumentTypes, parameterTypes);
5228 implicitParameters[i] = implicitParameter;
5229 }
5230 implicitConstructor.parameters = implicitParameters;
5231 }
5232 FunctionTypeImpl type = new FunctionTypeImpl(implicitConstructor);
5233 type.typeArguments = classType.typeArguments;
5234 implicitConstructor.type = type;
5235 return implicitConstructor;
5236 }
5237
5238 /**
5239 * Find all the constructors that should be forwarded from the given
5240 * [superType], to the class or mixin application [classElement],
5241 * and pass information about them to [callback].
5242 *
5243 * Return true if some constructors were considered. (A false return value
5244 * can only happen if the supeclass is a built-in type, in which case it
5245 * can't be used as a mixin anyway).
5246 */
5247 bool _findForwardedConstructors(ClassElementImpl classElement,
5248 InterfaceType superType, void callback(
5249 ConstructorElement explicitConstructor, List<DartType> parameterTypes,
5250 List<DartType> argumentTypes)) {
5251 ClassElement superclassElement = superType.element;
5252 List<ConstructorElement> constructors = superclassElement.constructors;
5253 int count = constructors.length;
5254 if (count == 0) {
5255 return false;
5256 }
5257 List<DartType> parameterTypes =
5258 TypeParameterTypeImpl.getTypes(superType.typeParameters);
5259 List<DartType> argumentTypes = _getArgumentTypes(superType, parameterTypes);
5260 for (int i = 0; i < count; i++) {
5261 ConstructorElement explicitConstructor = constructors[i];
5262 if (!explicitConstructor.isFactory &&
5263 classElement.isSuperConstructorAccessible(explicitConstructor)) {
5264 callback(explicitConstructor, parameterTypes, argumentTypes);
5265 }
5266 }
5267 return true;
5268 }
5269
5270 /**
5271 * Return a list of argument types that corresponds to the [parameterTypes]
5272 * and that are derived from the type arguments of the given [superType].
5273 */
5274 List<DartType> _getArgumentTypes(
5275 InterfaceType superType, List<DartType> parameterTypes) {
5276 DynamicTypeImpl dynamic = DynamicTypeImpl.instance;
5277 int parameterCount = parameterTypes.length;
5278 List<DartType> types = new List<DartType>(parameterCount);
5279 if (superType == null) {
5280 types = new List<DartType>.filled(parameterCount, dynamic);
5281 } else {
5282 List<DartType> typeArguments = superType.typeArguments;
5283 int argumentCount = math.min(typeArguments.length, parameterCount);
5284 for (int i = 0; i < argumentCount; i++) {
5285 types[i] = typeArguments[i];
5286 }
5287 for (int i = argumentCount; i < parameterCount; i++) {
5288 types[i] = dynamic;
5289 }
5290 }
5291 return types;
5292 }
5293
5294 void _visitClassDeclaration(ClassElementImpl classElement) {
5295 DartType superType = classElement.supertype;
5296 if (superType != null && classElement.mixins.isNotEmpty) {
5297 // We don't need to build any implicitly constructors for the mixin
5298 // application (since there isn't an explicit element for it), but we
5299 // need to verify that they _could_ be built.
5300 if (superType is! InterfaceType) {
5301 TypeProvider typeProvider = classElement.context.typeProvider;
5302 superType = typeProvider.objectType;
5303 }
5304 ClassElement superElement = superType.element;
5305 if (superElement != null) {
5306 _callback(classElement, superElement, () {
5307 bool constructorFound = false;
5308 void callback(ConstructorElement explicitConstructor,
5309 List<DartType> parameterTypes, List<DartType> argumentTypes) {
5310 constructorFound = true;
5311 }
5312 if (_findForwardedConstructors(classElement, superType, callback) &&
5313 !constructorFound) {
5314 SourceRange withRange = classElement.withClauseRange;
5315 errorListener.onError(new AnalysisError(classElement.source,
5316 withRange.offset, withRange.length,
5317 CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS,
5318 [superElement.name]));
5319 classElement.mixinErrorsReported = true;
5320 }
5321 });
5322 }
5323 }
5324 }
5325
5326 void _visitClassTypeAlias(ClassElementImpl classElement) {
5327 InterfaceType superType = classElement.supertype;
5328 if (superType is InterfaceType) {
5329 ClassElement superElement = superType.element;
5330 _callback(classElement, superElement, () {
5331 List<ConstructorElement> implicitConstructors =
5332 new List<ConstructorElement>();
5333 void callback(ConstructorElement explicitConstructor,
5334 List<DartType> parameterTypes, List<DartType> argumentTypes) {
5335 implicitConstructors.add(_createImplicitContructor(classElement.type,
5336 explicitConstructor, parameterTypes, argumentTypes));
5337 }
5338 if (_findForwardedConstructors(classElement, superType, callback)) {
5339 if (implicitConstructors.isEmpty) {
5340 errorListener.onError(new AnalysisError(classElement.source,
5341 classElement.nameOffset, classElement.name.length,
5342 CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS,
5343 [superElement.name]));
5344 } else {
5345 classElement.constructors = implicitConstructors;
5346 }
5347 }
5348 });
5349 }
5350 }
5351 }
5352
5353 /**
5354 * An instance of this class is capable of running ImplicitConstructorBuilder
5355 * over all classes in a library cycle.
5356 */
5357 class ImplicitConstructorComputer {
5358 /**
5359 * Directed graph of dependencies between classes that need to have their
5360 * implicit constructors computed. Each edge in the graph points from a
5361 * derived class to its superclass. Implicit constructors will be computed
5362 * for the superclass before they are compute for the derived class.
5363 */
5364 DirectedGraph<ClassElement> _dependencies = new DirectedGraph<ClassElement>();
5365
5366 /**
5367 * Map from ClassElement to the function which will compute the class's
5368 * implicit constructors.
5369 */
5370 Map<ClassElement, VoidFunction> _computations =
5371 new HashMap<ClassElement, VoidFunction>();
5372
5373 /**
5374 * Add the given [libraryElement] to the list of libraries which need to have
5375 * implicit constructors built for them.
5376 */
5377 void add(AnalysisErrorListener errorListener, LibraryElement libraryElement) {
5378 libraryElement
5379 .accept(new ImplicitConstructorBuilder(errorListener, _defer));
5380 }
5381
5382 /**
5383 * Compute the implicit constructors for all compilation units that have been
5384 * passed to [add].
5385 */
5386 void compute() {
5387 List<List<ClassElement>> topologicalSort =
5388 _dependencies.computeTopologicalSort();
5389 for (List<ClassElement> classesInCycle in topologicalSort) {
5390 // Note: a cycle could occur if there is a loop in the inheritance graph.
5391 // Such loops are forbidden by Dart but could occur in the analysis of
5392 // incorrect code. If this happens, we simply visit the classes
5393 // constituting the loop in any order.
5394 for (ClassElement classElement in classesInCycle) {
5395 VoidFunction computation = _computations[classElement];
5396 if (computation != null) {
5397 computation();
5398 }
5399 }
5400 }
5401 }
5402
5403 /**
5404 * Defer execution of [computation], which builds implicit constructors for
5405 * [classElement], until after implicit constructors have been built for
5406 * [superclassElement].
5407 */
5408 void _defer(ClassElement classElement, ClassElement superclassElement,
5409 void computation()) {
5410 assert(!_computations.containsKey(classElement));
5411 _computations[classElement] = computation;
5412 _dependencies.addEdge(classElement, superclassElement);
5413 }
5414 }
5415
5416 /**
5417 * Instances of the class `ImplicitLabelScope` represent the scope statements 5149 * Instances of the class `ImplicitLabelScope` represent the scope statements
5418 * that can be the target of unlabeled break and continue statements. 5150 * that can be the target of unlabeled break and continue statements.
5419 */ 5151 */
5420 class ImplicitLabelScope { 5152 class ImplicitLabelScope {
5421 /** 5153 /**
5422 * The implicit label scope associated with the top level of a function. 5154 * The implicit label scope associated with the top level of a function.
5423 */ 5155 */
5424 static const ImplicitLabelScope ROOT = const ImplicitLabelScope._(null, null); 5156 static const ImplicitLabelScope ROOT = const ImplicitLabelScope._(null, null);
5425 5157
5426 /** 5158 /**
(...skipping 2483 matching lines...) Expand 10 before | Expand all | Expand 10 after
7910 throw new AnalysisException("Could not resolve dart:core"); 7642 throw new AnalysisException("Could not resolve dart:core");
7911 } 7643 }
7912 LibraryElement asyncElement = _asyncLibrary.libraryElement; 7644 LibraryElement asyncElement = _asyncLibrary.libraryElement;
7913 if (asyncElement == null) { 7645 if (asyncElement == null) {
7914 throw new AnalysisException("Could not resolve dart:async"); 7646 throw new AnalysisException("Could not resolve dart:async");
7915 } 7647 }
7916 _buildDirectiveModels(); 7648 _buildDirectiveModels();
7917 _typeProvider = new TypeProviderImpl(coreElement, asyncElement); 7649 _typeProvider = new TypeProviderImpl(coreElement, asyncElement);
7918 _buildEnumMembers(); 7650 _buildEnumMembers();
7919 _buildTypeHierarchies(); 7651 _buildTypeHierarchies();
7920 _buildImplicitConstructors();
7921 // 7652 //
7922 // Perform resolution and type analysis. 7653 // Perform resolution and type analysis.
7923 // 7654 //
7924 // TODO(brianwilkerson) Decide whether we want to resolve all of the 7655 // TODO(brianwilkerson) Decide whether we want to resolve all of the
7925 // libraries or whether we want to only resolve the target library. The 7656 // libraries or whether we want to only resolve the target library. The
7926 // advantage to resolving everything is that we have already done part of 7657 // advantage to resolving everything is that we have already done part of
7927 // the work so we'll avoid duplicated effort. The disadvantage of 7658 // the work so we'll avoid duplicated effort. The disadvantage of
7928 // resolving everything is that we might do extra work that we don't 7659 // resolving everything is that we might do extra work that we don't
7929 // really care about. Another possibility is to add a parameter to this 7660 // really care about. Another possibility is to add a parameter to this
7930 // method and punt the decision to the clients. 7661 // method and punt the decision to the clients.
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
8191 for (Library library in _librariesInCycles) { 7922 for (Library library in _librariesInCycles) {
8192 for (Source source in library.compilationUnitSources) { 7923 for (Source source in library.compilationUnitSources) {
8193 EnumMemberBuilder builder = new EnumMemberBuilder(_typeProvider); 7924 EnumMemberBuilder builder = new EnumMemberBuilder(_typeProvider);
8194 library.getAST(source).accept(builder); 7925 library.getAST(source).accept(builder);
8195 } 7926 }
8196 } 7927 }
8197 }); 7928 });
8198 } 7929 }
8199 7930
8200 /** 7931 /**
8201 * Finish steps that the [buildTypeHierarchies] could not perform, see
8202 * [ImplicitConstructorBuilder].
8203 *
8204 * @throws AnalysisException if any of the type hierarchies could not be resol ved
8205 */
8206 void _buildImplicitConstructors() {
8207 PerformanceStatistics.resolve.makeCurrentWhile(() {
8208 ImplicitConstructorComputer computer = new ImplicitConstructorComputer();
8209 for (Library library in _librariesInCycles) {
8210 computer.add(_errorListener, library.libraryElement);
8211 }
8212 computer.compute();
8213 });
8214 }
8215
8216 /**
8217 * Resolve the type hierarchy across all of the types declared in the librarie s in the current 7932 * Resolve the type hierarchy across all of the types declared in the librarie s in the current
8218 * cycle. 7933 * cycle.
8219 * 7934 *
8220 * @throws AnalysisException if any of the type hierarchies could not be resol ved 7935 * @throws AnalysisException if any of the type hierarchies could not be resol ved
8221 */ 7936 */
8222 void _buildTypeHierarchies() { 7937 void _buildTypeHierarchies() {
8223 PerformanceStatistics.resolve.makeCurrentWhile(() { 7938 PerformanceStatistics.resolve.makeCurrentWhile(() {
8224 for (Library library in _librariesInCycles) { 7939 for (Library library in _librariesInCycles) {
8225 for (Source source in library.compilationUnitSources) { 7940 for (Source source in library.compilationUnitSources) {
8226 TypeResolverVisitorFactory typeResolverVisitorFactory = 7941 TypeResolverVisitorFactory typeResolverVisitorFactory =
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
8646 missingCoreLibrary(analysisContext, _coreLibrarySource); 8361 missingCoreLibrary(analysisContext, _coreLibrarySource);
8647 } 8362 }
8648 LibraryElement asyncElement = _asyncLibrary.libraryElement; 8363 LibraryElement asyncElement = _asyncLibrary.libraryElement;
8649 if (asyncElement == null) { 8364 if (asyncElement == null) {
8650 missingAsyncLibrary(analysisContext, _asyncLibrarySource); 8365 missingAsyncLibrary(analysisContext, _asyncLibrarySource);
8651 } 8366 }
8652 _buildDirectiveModels(); 8367 _buildDirectiveModels();
8653 _typeProvider = new TypeProviderImpl(coreElement, asyncElement); 8368 _typeProvider = new TypeProviderImpl(coreElement, asyncElement);
8654 _buildEnumMembers(); 8369 _buildEnumMembers();
8655 _buildTypeHierarchies(); 8370 _buildTypeHierarchies();
8656 _buildImplicitConstructors();
8657 // 8371 //
8658 // Perform resolution and type analysis. 8372 // Perform resolution and type analysis.
8659 // 8373 //
8660 // TODO(brianwilkerson) Decide whether we want to resolve all of the 8374 // TODO(brianwilkerson) Decide whether we want to resolve all of the
8661 // libraries or whether we want to only resolve the target library. The 8375 // libraries or whether we want to only resolve the target library. The
8662 // advantage to resolving everything is that we have already done part of 8376 // advantage to resolving everything is that we have already done part of
8663 // the work so we'll avoid duplicated effort. The disadvantage of 8377 // the work so we'll avoid duplicated effort. The disadvantage of
8664 // resolving everything is that we might do extra work that we don't 8378 // resolving everything is that we might do extra work that we don't
8665 // really care about. Another possibility is to add a parameter to this 8379 // really care about. Another possibility is to add a parameter to this
8666 // method and punt the decision to the clients. 8380 // method and punt the decision to the clients.
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
8848 PerformanceStatistics.resolve.makeCurrentWhile(() { 8562 PerformanceStatistics.resolve.makeCurrentWhile(() {
8849 for (ResolvableLibrary library in _librariesInCycle) { 8563 for (ResolvableLibrary library in _librariesInCycle) {
8850 for (Source source in library.compilationUnitSources) { 8564 for (Source source in library.compilationUnitSources) {
8851 EnumMemberBuilder builder = new EnumMemberBuilder(_typeProvider); 8565 EnumMemberBuilder builder = new EnumMemberBuilder(_typeProvider);
8852 library.getAST(source).accept(builder); 8566 library.getAST(source).accept(builder);
8853 } 8567 }
8854 } 8568 }
8855 }); 8569 });
8856 } 8570 }
8857 8571
8858 /**
8859 * Finish steps that the [buildTypeHierarchies] could not perform, see
8860 * [ImplicitConstructorBuilder].
8861 *
8862 * @throws AnalysisException if any of the type hierarchies could not be resol ved
8863 */
8864 void _buildImplicitConstructors() {
8865 PerformanceStatistics.resolve.makeCurrentWhile(() {
8866 ImplicitConstructorComputer computer = new ImplicitConstructorComputer();
8867 for (ResolvableLibrary library in _librariesInCycle) {
8868 computer.add(_errorListener, library.libraryElement);
8869 }
8870 computer.compute();
8871 });
8872 }
8873
8874 HashMap<Source, ResolvableLibrary> _buildLibraryMap() { 8572 HashMap<Source, ResolvableLibrary> _buildLibraryMap() {
8875 HashMap<Source, ResolvableLibrary> libraryMap = 8573 HashMap<Source, ResolvableLibrary> libraryMap =
8876 new HashMap<Source, ResolvableLibrary>(); 8574 new HashMap<Source, ResolvableLibrary>();
8877 int libraryCount = _librariesInCycle.length; 8575 int libraryCount = _librariesInCycle.length;
8878 for (int i = 0; i < libraryCount; i++) { 8576 for (int i = 0; i < libraryCount; i++) {
8879 ResolvableLibrary library = _librariesInCycle[i]; 8577 ResolvableLibrary library = _librariesInCycle[i];
8880 library.errorListener = _errorListener; 8578 library.errorListener = _errorListener;
8881 libraryMap[library.librarySource] = library; 8579 libraryMap[library.librarySource] = library;
8882 List<ResolvableLibrary> dependencies = library.importsAndExports; 8580 List<ResolvableLibrary> dependencies = library.importsAndExports;
8883 int dependencyCount = dependencies.length; 8581 int dependencyCount = dependencies.length;
(...skipping 6645 matching lines...) Expand 10 before | Expand all | Expand 10 after
15529 nonFields.add(node); 15227 nonFields.add(node);
15530 return null; 15228 return null;
15531 } 15229 }
15532 15230
15533 @override 15231 @override
15534 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); 15232 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this);
15535 15233
15536 @override 15234 @override
15537 Object visitWithClause(WithClause node) => null; 15235 Object visitWithClause(WithClause node) => null;
15538 } 15236 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698