| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.resolver; | 8 library engine.resolver; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 /** | 1227 /** |
| 1228 * Instances of the class `ClassScope` implement the scope defined by a class. | 1228 * Instances of the class `ClassScope` implement the scope defined by a class. |
| 1229 */ | 1229 */ |
| 1230 class ClassScope extends EnclosedScope { | 1230 class ClassScope extends EnclosedScope { |
| 1231 /** | 1231 /** |
| 1232 * Initialize a newly created scope enclosed within another scope. | 1232 * Initialize a newly created scope enclosed within another scope. |
| 1233 * | 1233 * |
| 1234 * @param enclosingScope the scope in which this scope is lexically enclosed | 1234 * @param enclosingScope the scope in which this scope is lexically enclosed |
| 1235 * @param typeElement the element representing the type represented by this sc
ope | 1235 * @param typeElement the element representing the type represented by this sc
ope |
| 1236 */ | 1236 */ |
| 1237 ClassScope(Scope enclosingScope, ClassElement typeElement) : super(new Enclose
dScope(enclosingScope)) { | 1237 ClassScope(Scope enclosingScope, ClassElement typeElement) : super(enclosingSc
ope) { |
| 1238 if (typeElement == null) { | 1238 if (typeElement == null) { |
| 1239 throw new IllegalArgumentException("class element cannot be null"); | 1239 throw new IllegalArgumentException("class element cannot be null"); |
| 1240 } | 1240 } |
| 1241 _defineTypeParameters(typeElement); | |
| 1242 _defineMembers(typeElement); | 1241 _defineMembers(typeElement); |
| 1243 } | 1242 } |
| 1244 | 1243 |
| 1245 @override | 1244 @override |
| 1246 AnalysisError getErrorForDuplicate(Element existing, Element duplicate) { | 1245 AnalysisError getErrorForDuplicate(Element existing, Element duplicate) { |
| 1247 if (existing is PropertyAccessorElement && duplicate is MethodElement) { | 1246 if (existing is PropertyAccessorElement && duplicate is MethodElement) { |
| 1248 if (existing.nameOffset < duplicate.nameOffset) { | 1247 if (existing.nameOffset < duplicate.nameOffset) { |
| 1249 return new AnalysisError.con2(duplicate.source, duplicate.nameOffset, du
plicate.displayName.length, CompileTimeErrorCode.METHOD_AND_GETTER_WITH_SAME_NAM
E, [existing.displayName]); | 1248 return new AnalysisError.con2(duplicate.source, duplicate.nameOffset, du
plicate.displayName.length, CompileTimeErrorCode.METHOD_AND_GETTER_WITH_SAME_NAM
E, [existing.displayName]); |
| 1250 } else { | 1249 } else { |
| 1251 return new AnalysisError.con2(existing.source, existing.nameOffset, exis
ting.displayName.length, CompileTimeErrorCode.GETTER_AND_METHOD_WITH_SAME_NAME,
[existing.displayName]); | 1250 return new AnalysisError.con2(existing.source, existing.nameOffset, exis
ting.displayName.length, CompileTimeErrorCode.GETTER_AND_METHOD_WITH_SAME_NAME,
[existing.displayName]); |
| 1252 } | 1251 } |
| 1253 } | 1252 } |
| 1254 return super.getErrorForDuplicate(existing, duplicate); | 1253 return super.getErrorForDuplicate(existing, duplicate); |
| 1255 } | 1254 } |
| 1256 | 1255 |
| 1257 /** | 1256 /** |
| 1258 * Define the instance members defined by the class. | 1257 * Define the instance members defined by the class. |
| 1259 * | 1258 * |
| 1260 * @param typeElement the element representing the type represented by this sc
ope | 1259 * @param typeElement the element representing the type represented by this sc
ope |
| 1261 */ | 1260 */ |
| 1262 void _defineMembers(ClassElement typeElement) { | 1261 void _defineMembers(ClassElement typeElement) { |
| 1263 for (PropertyAccessorElement accessor in typeElement.accessors) { | 1262 for (PropertyAccessorElement accessor in typeElement.accessors) { |
| 1264 define(accessor); | 1263 define(accessor); |
| 1265 } | 1264 } |
| 1266 for (MethodElement method in typeElement.methods) { | 1265 for (MethodElement method in typeElement.methods) { |
| 1267 define(method); | 1266 define(method); |
| 1268 } | 1267 } |
| 1269 } | 1268 } |
| 1270 | |
| 1271 /** | |
| 1272 * Define the type parameters for the class. | |
| 1273 * | |
| 1274 * @param typeElement the element representing the type represented by this sc
ope | |
| 1275 */ | |
| 1276 void _defineTypeParameters(ClassElement typeElement) { | |
| 1277 Scope parameterScope = enclosingScope; | |
| 1278 for (TypeParameterElement typeParameter in typeElement.typeParameters) { | |
| 1279 parameterScope.define(typeParameter); | |
| 1280 } | |
| 1281 } | |
| 1282 } | 1269 } |
| 1283 | 1270 |
| 1284 /** | 1271 /** |
| 1285 * Instances of the class `CompilationUnitBuilder` build an element model for a
single | 1272 * Instances of the class `CompilationUnitBuilder` build an element model for a
single |
| 1286 * compilation unit. | 1273 * compilation unit. |
| 1287 */ | 1274 */ |
| 1288 class CompilationUnitBuilder { | 1275 class CompilationUnitBuilder { |
| 1289 /** | 1276 /** |
| 1290 * Build the compilation unit element for the given source. | 1277 * Build the compilation unit element for the given source. |
| 1291 * | 1278 * |
| (...skipping 16728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18020 if (node.metadata != null) { | 18007 if (node.metadata != null) { |
| 18021 node.metadata.accept(this); | 18008 node.metadata.accept(this); |
| 18022 } | 18009 } |
| 18023 _enclosingClassDeclaration = node; | 18010 _enclosingClassDeclaration = node; |
| 18024 // Continue the class resolution. | 18011 // Continue the class resolution. |
| 18025 ClassElement outerType = _enclosingClass; | 18012 ClassElement outerType = _enclosingClass; |
| 18026 try { | 18013 try { |
| 18027 _enclosingClass = node.element; | 18014 _enclosingClass = node.element; |
| 18028 _typeAnalyzer.thisType = _enclosingClass == null ? null : _enclosingClass.
type; | 18015 _typeAnalyzer.thisType = _enclosingClass == null ? null : _enclosingClass.
type; |
| 18029 super.visitClassDeclaration(node); | 18016 super.visitClassDeclaration(node); |
| 18017 node.accept(_elementResolver); |
| 18018 node.accept(_typeAnalyzer); |
| 18030 } finally { | 18019 } finally { |
| 18031 _typeAnalyzer.thisType = outerType == null ? null : outerType.type; | 18020 _typeAnalyzer.thisType = outerType == null ? null : outerType.type; |
| 18032 _enclosingClass = outerType; | 18021 _enclosingClass = outerType; |
| 18033 _enclosingClassDeclaration = null; | 18022 _enclosingClassDeclaration = null; |
| 18034 } | 18023 } |
| 18035 return null; | 18024 return null; |
| 18036 } | 18025 } |
| 18037 | 18026 |
| 18038 @override | 18027 @override |
| 18039 Object visitComment(Comment node) { | 18028 Object visitComment(Comment node) { |
| (...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19322 AstNode parent = node.parent; | 19311 AstNode parent = node.parent; |
| 19323 if (parent == null) { | 19312 if (parent == null) { |
| 19324 throw new AnalysisException("Cannot create scope: node is not part of a Co
mpilationUnit"); | 19313 throw new AnalysisException("Cannot create scope: node is not part of a Co
mpilationUnit"); |
| 19325 } | 19314 } |
| 19326 Scope scope = _scopeForAstNode(parent); | 19315 Scope scope = _scopeForAstNode(parent); |
| 19327 if (node is ClassDeclaration) { | 19316 if (node is ClassDeclaration) { |
| 19328 ClassElement element = node.element; | 19317 ClassElement element = node.element; |
| 19329 if (element == null) { | 19318 if (element == null) { |
| 19330 throw new AnalysisException("Cannot build a scope for an unresolved clas
s"); | 19319 throw new AnalysisException("Cannot build a scope for an unresolved clas
s"); |
| 19331 } | 19320 } |
| 19332 scope = new ClassScope(scope, element); | 19321 scope = new ClassScope(new TypeParameterScope(scope, element), element); |
| 19333 } else if (node is ClassTypeAlias) { | 19322 } else if (node is ClassTypeAlias) { |
| 19334 ClassElement element = node.element; | 19323 ClassElement element = node.element; |
| 19335 if (element == null) { | 19324 if (element == null) { |
| 19336 throw new AnalysisException("Cannot build a scope for an unresolved clas
s type alias"); | 19325 throw new AnalysisException("Cannot build a scope for an unresolved clas
s type alias"); |
| 19337 } | 19326 } |
| 19338 scope = new ClassScope(scope, element); | 19327 scope = new ClassScope(new TypeParameterScope(scope, element), element); |
| 19339 } else if (node is ConstructorDeclaration) { | 19328 } else if (node is ConstructorDeclaration) { |
| 19340 ConstructorElement element = node.element; | 19329 ConstructorElement element = node.element; |
| 19341 if (element == null) { | 19330 if (element == null) { |
| 19342 throw new AnalysisException("Cannot build a scope for an unresolved cons
tructor"); | 19331 throw new AnalysisException("Cannot build a scope for an unresolved cons
tructor"); |
| 19343 } | 19332 } |
| 19344 FunctionScope functionScope = new FunctionScope(scope, element); | 19333 FunctionScope functionScope = new FunctionScope(scope, element); |
| 19345 functionScope.defineParameters(); | 19334 functionScope.defineParameters(); |
| 19346 scope = functionScope; | 19335 scope = functionScope; |
| 19347 } else if (node is FunctionDeclaration) { | 19336 } else if (node is FunctionDeclaration) { |
| 19348 ExecutableElement element = node.element; | 19337 ExecutableElement element = node.element; |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19539 } | 19528 } |
| 19540 return null; | 19529 return null; |
| 19541 } | 19530 } |
| 19542 | 19531 |
| 19543 @override | 19532 @override |
| 19544 Object visitClassDeclaration(ClassDeclaration node) { | 19533 Object visitClassDeclaration(ClassDeclaration node) { |
| 19545 ClassElement classElement = node.element; | 19534 ClassElement classElement = node.element; |
| 19546 Scope outerScope = _nameScope; | 19535 Scope outerScope = _nameScope; |
| 19547 try { | 19536 try { |
| 19548 if (classElement == null) { | 19537 if (classElement == null) { |
| 19549 AnalysisEngine.instance.logger.logInformation2("Missing element for cons
tructor ${node.name.name} in ${definingLibrary.source.fullName}", new JavaExcept
ion()); | 19538 AnalysisEngine.instance.logger.logInformation2("Missing element for clas
s declaration ${node.name.name} in ${definingLibrary.source.fullName}", new Java
Exception()); |
| 19539 super.visitClassDeclaration(node); |
| 19550 } else { | 19540 } else { |
| 19541 _nameScope = new TypeParameterScope(_nameScope, classElement); |
| 19542 visitClassDeclarationInScope(node); |
| 19551 _nameScope = new ClassScope(_nameScope, classElement); | 19543 _nameScope = new ClassScope(_nameScope, classElement); |
| 19544 visitClassMembersInScope(node); |
| 19552 } | 19545 } |
| 19553 visitClassDeclarationInScope(node); | |
| 19554 } finally { | 19546 } finally { |
| 19555 _nameScope = outerScope; | 19547 _nameScope = outerScope; |
| 19556 } | 19548 } |
| 19557 return null; | 19549 return null; |
| 19558 } | 19550 } |
| 19559 | 19551 |
| 19560 @override | 19552 @override |
| 19561 Object visitClassTypeAlias(ClassTypeAlias node) { | 19553 Object visitClassTypeAlias(ClassTypeAlias node) { |
| 19562 Scope outerScope = _nameScope; | 19554 Scope outerScope = _nameScope; |
| 19563 try { | 19555 try { |
| 19564 _nameScope = new ClassScope(_nameScope, node.element); | 19556 ClassElement element = node.element; |
| 19557 _nameScope = new ClassScope(new TypeParameterScope(_nameScope, element), e
lement); |
| 19565 super.visitClassTypeAlias(node); | 19558 super.visitClassTypeAlias(node); |
| 19566 } finally { | 19559 } finally { |
| 19567 _nameScope = outerScope; | 19560 _nameScope = outerScope; |
| 19568 } | 19561 } |
| 19569 return null; | 19562 return null; |
| 19570 } | 19563 } |
| 19571 | 19564 |
| 19572 @override | 19565 @override |
| 19573 Object visitConstructorDeclaration(ConstructorDeclaration node) { | 19566 Object visitConstructorDeclaration(ConstructorDeclaration node) { |
| 19574 ConstructorElement constructorElement = node.element; | 19567 ConstructorElement constructorElement = node.element; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19885 * | 19878 * |
| 19886 * @param node the node to be visited | 19879 * @param node the node to be visited |
| 19887 */ | 19880 */ |
| 19888 void safelyVisit(AstNode node) { | 19881 void safelyVisit(AstNode node) { |
| 19889 if (node != null) { | 19882 if (node != null) { |
| 19890 node.accept(this); | 19883 node.accept(this); |
| 19891 } | 19884 } |
| 19892 } | 19885 } |
| 19893 | 19886 |
| 19894 void visitClassDeclarationInScope(ClassDeclaration node) { | 19887 void visitClassDeclarationInScope(ClassDeclaration node) { |
| 19895 super.visitClassDeclaration(node); | 19888 safelyVisit(node.name); |
| 19889 safelyVisit(node.typeParameters); |
| 19890 safelyVisit(node.extendsClause); |
| 19891 safelyVisit(node.withClause); |
| 19892 safelyVisit(node.implementsClause); |
| 19893 safelyVisit(node.nativeClause); |
| 19894 } |
| 19895 |
| 19896 void visitClassMembersInScope(ClassDeclaration node) { |
| 19897 safelyVisit(node.documentationComment); |
| 19898 node.metadata.accept(this); |
| 19899 node.members.accept(this); |
| 19896 } | 19900 } |
| 19897 | 19901 |
| 19898 /** | 19902 /** |
| 19899 * Visit the given statement after it's scope has been created. This replaces
the normal call to | 19903 * Visit the given statement after it's scope has been created. This replaces
the normal call to |
| 19900 * the inherited visit method so that ResolverVisitor can intervene when type
propagation is | 19904 * the inherited visit method so that ResolverVisitor can intervene when type
propagation is |
| 19901 * enabled. | 19905 * enabled. |
| 19902 * | 19906 * |
| 19903 * @param node the statement to be visited | 19907 * @param node the statement to be visited |
| 19904 */ | 19908 */ |
| 19905 void visitForEachStatementInScope(ForEachStatement node) { | 19909 void visitForEachStatementInScope(ForEachStatement node) { |
| (...skipping 2149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22055 * | 22059 * |
| 22056 * @param element the element whose type might have been overridden | 22060 * @param element the element whose type might have been overridden |
| 22057 * @param type the overridden type of the given element | 22061 * @param type the overridden type of the given element |
| 22058 */ | 22062 */ |
| 22059 void setType(Element element, DartType type) { | 22063 void setType(Element element, DartType type) { |
| 22060 _overridenTypes[element] = type; | 22064 _overridenTypes[element] = type; |
| 22061 } | 22065 } |
| 22062 } | 22066 } |
| 22063 | 22067 |
| 22064 /** | 22068 /** |
| 22069 * Instances of the class `TypeParameterScope` implement the scope defined by th
e type |
| 22070 * parameters in a class. |
| 22071 */ |
| 22072 class TypeParameterScope extends EnclosedScope { |
| 22073 /** |
| 22074 * Initialize a newly created scope enclosed within another scope. |
| 22075 * |
| 22076 * @param enclosingScope the scope in which this scope is lexically enclosed |
| 22077 * @param typeElement the element representing the type represented by this sc
ope |
| 22078 */ |
| 22079 TypeParameterScope(Scope enclosingScope, ClassElement typeElement) : super(enc
losingScope) { |
| 22080 if (typeElement == null) { |
| 22081 throw new IllegalArgumentException("class element cannot be null"); |
| 22082 } |
| 22083 _defineTypeParameters(typeElement); |
| 22084 } |
| 22085 |
| 22086 /** |
| 22087 * Define the type parameters for the class. |
| 22088 * |
| 22089 * @param typeElement the element representing the type represented by this sc
ope |
| 22090 */ |
| 22091 void _defineTypeParameters(ClassElement typeElement) { |
| 22092 for (TypeParameterElement typeParameter in typeElement.typeParameters) { |
| 22093 define(typeParameter); |
| 22094 } |
| 22095 } |
| 22096 } |
| 22097 |
| 22098 /** |
| 22065 * Instances of the class `TypePromotionManager` manage the ability to promote t
ypes of local | 22099 * Instances of the class `TypePromotionManager` manage the ability to promote t
ypes of local |
| 22066 * variables and formal parameters from their declared types based on control fl
ow. | 22100 * variables and formal parameters from their declared types based on control fl
ow. |
| 22067 */ | 22101 */ |
| 22068 class TypePromotionManager { | 22102 class TypePromotionManager { |
| 22069 /** | 22103 /** |
| 22070 * The current promotion scope, or `null` if no scope has been entered. | 22104 * The current promotion scope, or `null` if no scope has been entered. |
| 22071 */ | 22105 */ |
| 22072 TypePromotionManager_TypePromoteScope _currentScope; | 22106 TypePromotionManager_TypePromoteScope _currentScope; |
| 22073 | 22107 |
| 22074 /** | 22108 /** |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22637 } | 22671 } |
| 22638 SimpleIdentifier stackTrace = node.stackTraceParameter; | 22672 SimpleIdentifier stackTrace = node.stackTraceParameter; |
| 22639 if (stackTrace != null) { | 22673 if (stackTrace != null) { |
| 22640 _recordType(stackTrace, typeProvider.stackTraceType); | 22674 _recordType(stackTrace, typeProvider.stackTraceType); |
| 22641 } | 22675 } |
| 22642 return null; | 22676 return null; |
| 22643 } | 22677 } |
| 22644 | 22678 |
| 22645 @override | 22679 @override |
| 22646 Object visitClassDeclaration(ClassDeclaration node) { | 22680 Object visitClassDeclaration(ClassDeclaration node) { |
| 22681 ExtendsClause extendsClause = node.extendsClause; |
| 22682 WithClause withClause = node.withClause; |
| 22683 ImplementsClause implementsClause = node.implementsClause; |
| 22647 _hasReferenceToSuper = false; | 22684 _hasReferenceToSuper = false; |
| 22648 super.visitClassDeclaration(node); | 22685 super.visitClassDeclaration(node); |
| 22649 ClassElementImpl classElement = _getClassElement(node.name); | 22686 ClassElementImpl classElement = _getClassElement(node.name); |
| 22650 InterfaceType superclassType = null; | 22687 InterfaceType superclassType = null; |
| 22651 ExtendsClause extendsClause = node.extendsClause; | |
| 22652 if (extendsClause != null) { | 22688 if (extendsClause != null) { |
| 22653 ErrorCode errorCode = (node.withClause == null ? CompileTimeErrorCode.EXTE
NDS_NON_CLASS : CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS); | 22689 ErrorCode errorCode = (withClause == null ? CompileTimeErrorCode.EXTENDS_N
ON_CLASS : CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS); |
| 22654 superclassType = _resolveType(extendsClause.superclass, errorCode, errorCo
de); | 22690 superclassType = _resolveType(extendsClause.superclass, errorCode, errorCo
de); |
| 22655 if (!identical(superclassType, typeProvider.objectType)) { | 22691 if (!identical(superclassType, typeProvider.objectType)) { |
| 22656 classElement.validMixin = false; | 22692 classElement.validMixin = false; |
| 22657 } | 22693 } |
| 22658 } | 22694 } |
| 22659 if (classElement != null) { | 22695 if (classElement != null) { |
| 22660 if (superclassType == null) { | 22696 if (superclassType == null) { |
| 22661 InterfaceType objectType = typeProvider.objectType; | 22697 InterfaceType objectType = typeProvider.objectType; |
| 22662 if (!identical(classElement.type, objectType)) { | 22698 if (!identical(classElement.type, objectType)) { |
| 22663 superclassType = objectType; | 22699 superclassType = objectType; |
| 22664 } | 22700 } |
| 22665 } | 22701 } |
| 22666 classElement.supertype = superclassType; | 22702 classElement.supertype = superclassType; |
| 22667 classElement.hasReferenceToSuper = _hasReferenceToSuper; | 22703 classElement.hasReferenceToSuper = _hasReferenceToSuper; |
| 22668 } | 22704 } |
| 22669 _resolve(classElement, node.withClause, node.implementsClause); | 22705 _resolve(classElement, withClause, implementsClause); |
| 22670 return null; | 22706 return null; |
| 22671 } | 22707 } |
| 22672 | 22708 |
| 22673 @override | 22709 @override |
| 22674 Object visitClassTypeAlias(ClassTypeAlias node) { | 22710 Object visitClassTypeAlias(ClassTypeAlias node) { |
| 22675 super.visitClassTypeAlias(node); | 22711 super.visitClassTypeAlias(node); |
| 22676 ClassElementImpl classElement = _getClassElement(node.name); | 22712 ClassElementImpl classElement = _getClassElement(node.name); |
| 22677 ErrorCode errorCode = CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS; | 22713 ErrorCode errorCode = CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS; |
| 22678 InterfaceType superclassType = _resolveType(node.superclass, errorCode, erro
rCode); | 22714 InterfaceType superclassType = _resolveType(node.superclass, errorCode, erro
rCode); |
| 22679 if (superclassType == null) { | 22715 if (superclassType == null) { |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 23113 } | 23149 } |
| 23114 setter.type = setterType; | 23150 setter.type = setterType; |
| 23115 } | 23151 } |
| 23116 } | 23152 } |
| 23117 } else { | 23153 } else { |
| 23118 } | 23154 } |
| 23119 return null; | 23155 return null; |
| 23120 } | 23156 } |
| 23121 | 23157 |
| 23122 @override | 23158 @override |
| 23123 void visitClassDeclarationInScope(ClassDeclaration node) { | 23159 void visitClassMembersInScope(ClassDeclaration node) { |
| 23124 // | 23160 // |
| 23125 // Process field declarations before constructors and methods so that the ty
pes of field formal | 23161 // Process field declarations before constructors and methods so that the ty
pes of field formal |
| 23126 // parameters can be correctly resolved. | 23162 // parameters can be correctly resolved. |
| 23127 // | 23163 // |
| 23128 List<ClassMember> nonFields = new List<ClassMember>(); | 23164 List<ClassMember> nonFields = new List<ClassMember>(); |
| 23129 node.visitChildren(new UnifyingAstVisitor_TypeResolverVisitor_visitClassDecl
arationInScope(this, nonFields)); | 23165 node.visitChildren(new UnifyingAstVisitor_TypeResolverVisitor_visitClassMemb
ersInScope(this, nonFields)); |
| 23130 int count = nonFields.length; | 23166 int count = nonFields.length; |
| 23131 for (int i = 0; i < count; i++) { | 23167 for (int i = 0; i < count; i++) { |
| 23132 nonFields[i].accept(this); | 23168 nonFields[i].accept(this); |
| 23133 } | 23169 } |
| 23134 } | 23170 } |
| 23135 | 23171 |
| 23136 /** | 23172 /** |
| 23137 * Given a type name representing the return type of a function, compute the r
eturn type of the | 23173 * Given a type name representing the return type of a function, compute the r
eturn type of the |
| 23138 * function. | 23174 * function. |
| 23139 * | 23175 * |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 23610 @override | 23646 @override |
| 23611 Object visitMethodDeclaration(MethodDeclaration node) { | 23647 Object visitMethodDeclaration(MethodDeclaration node) { |
| 23612 nonFields.add(node); | 23648 nonFields.add(node); |
| 23613 return null; | 23649 return null; |
| 23614 } | 23650 } |
| 23615 | 23651 |
| 23616 @override | 23652 @override |
| 23617 Object visitNode(AstNode node) => node.accept(ElementBuilder_this); | 23653 Object visitNode(AstNode node) => node.accept(ElementBuilder_this); |
| 23618 } | 23654 } |
| 23619 | 23655 |
| 23620 class UnifyingAstVisitor_TypeResolverVisitor_visitClassDeclarationInScope extend
s UnifyingAstVisitor<Object> { | 23656 class UnifyingAstVisitor_TypeResolverVisitor_visitClassMembersInScope extends Un
ifyingAstVisitor<Object> { |
| 23621 final TypeResolverVisitor TypeResolverVisitor_this; | 23657 final TypeResolverVisitor TypeResolverVisitor_this; |
| 23622 | 23658 |
| 23623 List<ClassMember> nonFields; | 23659 List<ClassMember> nonFields; |
| 23624 | 23660 |
| 23625 UnifyingAstVisitor_TypeResolverVisitor_visitClassDeclarationInScope(this.TypeR
esolverVisitor_this, this.nonFields) : super(); | 23661 UnifyingAstVisitor_TypeResolverVisitor_visitClassMembersInScope(this.TypeResol
verVisitor_this, this.nonFields) : super(); |
| 23626 | 23662 |
| 23627 @override | 23663 @override |
| 23628 Object visitConstructorDeclaration(ConstructorDeclaration node) { | 23664 Object visitConstructorDeclaration(ConstructorDeclaration node) { |
| 23629 nonFields.add(node); | 23665 nonFields.add(node); |
| 23630 return null; | 23666 return null; |
| 23631 } | 23667 } |
| 23632 | 23668 |
| 23633 @override | 23669 @override |
| 23670 Object visitExtendsClause(ExtendsClause node) => null; |
| 23671 |
| 23672 @override |
| 23673 Object visitImplementsClause(ImplementsClause node) => null; |
| 23674 |
| 23675 @override |
| 23634 Object visitMethodDeclaration(MethodDeclaration node) { | 23676 Object visitMethodDeclaration(MethodDeclaration node) { |
| 23635 nonFields.add(node); | 23677 nonFields.add(node); |
| 23636 return null; | 23678 return null; |
| 23637 } | 23679 } |
| 23638 | 23680 |
| 23639 @override | 23681 @override |
| 23640 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); | 23682 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); |
| 23683 |
| 23684 @override |
| 23685 Object visitWithClause(WithClause node) => null; |
| 23641 } | 23686 } |
| 23642 | 23687 |
| 23643 /** | 23688 /** |
| 23644 * Instances of the class `VariableResolverVisitor` are used to resolve | 23689 * Instances of the class `VariableResolverVisitor` are used to resolve |
| 23645 * [SimpleIdentifier]s to local variables and formal parameters. | 23690 * [SimpleIdentifier]s to local variables and formal parameters. |
| 23646 */ | 23691 */ |
| 23647 class VariableResolverVisitor extends ScopedVisitor { | 23692 class VariableResolverVisitor extends ScopedVisitor { |
| 23648 /** | 23693 /** |
| 23649 * The method or function that we are currently visiting, or `null` if we are
not inside a | 23694 * The method or function that we are currently visiting, or `null` if we are
not inside a |
| 23650 * method or function. | 23695 * method or function. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 23753 parameterImpl.markPotentiallyMutatedInScope(); | 23798 parameterImpl.markPotentiallyMutatedInScope(); |
| 23754 // If we are in some closure, check if it is not the same as where varia
ble is declared. | 23799 // If we are in some closure, check if it is not the same as where varia
ble is declared. |
| 23755 if (_enclosingFunction != null && (element.enclosingElement != _enclosin
gFunction)) { | 23800 if (_enclosingFunction != null && (element.enclosingElement != _enclosin
gFunction)) { |
| 23756 parameterImpl.markPotentiallyMutatedInClosure(); | 23801 parameterImpl.markPotentiallyMutatedInClosure(); |
| 23757 } | 23802 } |
| 23758 } | 23803 } |
| 23759 } | 23804 } |
| 23760 return null; | 23805 return null; |
| 23761 } | 23806 } |
| 23762 } | 23807 } |
| OLD | NEW |