| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 | 3 |
| 4 library engine.resolver; | 4 library engine.resolver; |
| 5 | 5 |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'java_core.dart'; | 7 import 'java_core.dart'; |
| 8 import 'java_engine.dart'; | 8 import 'java_engine.dart'; |
| 9 import 'instrumentation.dart'; | 9 import 'instrumentation.dart'; |
| 10 import 'source.dart'; | 10 import 'source.dart'; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 */ | 32 */ |
| 33 CompilationUnitBuilder() : super() { | 33 CompilationUnitBuilder() : super() { |
| 34 } | 34 } |
| 35 /** | 35 /** |
| 36 * Build the compilation unit element for the given source. | 36 * Build the compilation unit element for the given source. |
| 37 * @param source the source describing the compilation unit | 37 * @param source the source describing the compilation unit |
| 38 * @param unit the AST structure representing the compilation unit | 38 * @param unit the AST structure representing the compilation unit |
| 39 * @return the compilation unit element that was built | 39 * @return the compilation unit element that was built |
| 40 * @throws AnalysisException if the analysis could not be performed | 40 * @throws AnalysisException if the analysis could not be performed |
| 41 */ | 41 */ |
| 42 CompilationUnitElementImpl buildCompilationUnit(Source source18, CompilationUn
it unit) { | 42 CompilationUnitElementImpl buildCompilationUnit(Source source2, CompilationUni
t unit) { |
| 43 if (unit == null) { | 43 if (unit == null) { |
| 44 return null; | 44 return null; |
| 45 } | 45 } |
| 46 ElementHolder holder = new ElementHolder(); | 46 ElementHolder holder = new ElementHolder(); |
| 47 ElementBuilder builder = new ElementBuilder(holder); | 47 ElementBuilder builder = new ElementBuilder(holder); |
| 48 unit.accept(builder); | 48 unit.accept(builder); |
| 49 CompilationUnitElementImpl element = new CompilationUnitElementImpl(source18
.shortName); | 49 CompilationUnitElementImpl element = new CompilationUnitElementImpl(source2.
shortName); |
| 50 element.accessors = holder.accessors; | 50 element.accessors = holder.accessors; |
| 51 element.functions = holder.functions; | 51 element.functions = holder.functions; |
| 52 element.source = source18; | 52 element.source = source2; |
| 53 element.typeAliases = holder.typeAliases; | 53 element.typeAliases = holder.typeAliases; |
| 54 element.types = holder.types; | 54 element.types = holder.types; |
| 55 element.topLevelVariables = holder.topLevelVariables; | 55 element.topLevelVariables = holder.topLevelVariables; |
| 56 unit.element = element; | 56 unit.element = element; |
| 57 return element; | 57 return element; |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 /** | 60 /** |
| 61 * Instances of the class {@code ElementBuilder} traverse an AST structure and b
uild the element | 61 * Instances of the class {@code ElementBuilder} traverse an AST structure and b
uild the element |
| 62 * model representing the AST structure. | 62 * model representing the AST structure. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 return super.visitCatchClause(node); | 112 return super.visitCatchClause(node); |
| 113 } | 113 } |
| 114 Object visitClassDeclaration(ClassDeclaration node) { | 114 Object visitClassDeclaration(ClassDeclaration node) { |
| 115 ElementHolder holder = new ElementHolder(); | 115 ElementHolder holder = new ElementHolder(); |
| 116 _isValidMixin = true; | 116 _isValidMixin = true; |
| 117 visitChildren(holder, node); | 117 visitChildren(holder, node); |
| 118 SimpleIdentifier className = node.name; | 118 SimpleIdentifier className = node.name; |
| 119 ClassElementImpl element = new ClassElementImpl(className); | 119 ClassElementImpl element = new ClassElementImpl(className); |
| 120 List<TypeVariableElement> typeVariables4 = holder.typeVariables; | 120 List<TypeVariableElement> typeVariables2 = holder.typeVariables; |
| 121 InterfaceTypeImpl interfaceType = new InterfaceTypeImpl.con1(element); | 121 InterfaceTypeImpl interfaceType = new InterfaceTypeImpl.con1(element); |
| 122 interfaceType.typeArguments = createTypeVariableTypes(typeVariables4); | 122 interfaceType.typeArguments = createTypeVariableTypes(typeVariables2); |
| 123 element.type = interfaceType; | 123 element.type = interfaceType; |
| 124 List<ConstructorElement> constructors3 = holder.constructors; | 124 List<ConstructorElement> constructors2 = holder.constructors; |
| 125 if (constructors3.length == 0) { | 125 if (constructors2.length == 0) { |
| 126 ConstructorElementImpl constructor = new ConstructorElementImpl(null); | 126 ConstructorElementImpl constructor = new ConstructorElementImpl(null); |
| 127 constructor.synthetic = true; | 127 constructor.synthetic = true; |
| 128 FunctionTypeImpl type = new FunctionTypeImpl.con1(constructor); | 128 FunctionTypeImpl type = new FunctionTypeImpl.con1(constructor); |
| 129 type.returnType = interfaceType; | 129 type.returnType = interfaceType; |
| 130 constructor.type = type; | 130 constructor.type = type; |
| 131 constructors3 = <ConstructorElement> [constructor]; | 131 constructors2 = <ConstructorElement> [constructor]; |
| 132 } | 132 } |
| 133 element.abstract = node.abstractKeyword != null; | 133 element.abstract = node.abstractKeyword != null; |
| 134 element.accessors = holder.accessors; | 134 element.accessors = holder.accessors; |
| 135 element.constructors = constructors3; | 135 element.constructors = constructors2; |
| 136 element.fields = holder.fields; | 136 element.fields = holder.fields; |
| 137 element.methods = holder.methods; | 137 element.methods = holder.methods; |
| 138 element.typeVariables = typeVariables4; | 138 element.typeVariables = typeVariables2; |
| 139 element.validMixin = _isValidMixin; | 139 element.validMixin = _isValidMixin; |
| 140 _currentHolder.addType(element); | 140 _currentHolder.addType(element); |
| 141 className.element = element; | 141 className.element = element; |
| 142 return null; | 142 return null; |
| 143 } | 143 } |
| 144 Object visitClassTypeAlias(ClassTypeAlias node) { | 144 Object visitClassTypeAlias(ClassTypeAlias node) { |
| 145 ElementHolder holder = new ElementHolder(); | 145 ElementHolder holder = new ElementHolder(); |
| 146 visitChildren(holder, node); | 146 visitChildren(holder, node); |
| 147 SimpleIdentifier className = node.name; | 147 SimpleIdentifier className = node.name; |
| 148 ClassElementImpl element = new ClassElementImpl(className); | 148 ClassElementImpl element = new ClassElementImpl(className); |
| 149 element.abstract = node.abstractKeyword != null; | 149 element.abstract = node.abstractKeyword != null; |
| 150 element.typedef = true; | 150 element.typedef = true; |
| 151 List<TypeVariableElement> typeVariables5 = holder.typeVariables; | 151 List<TypeVariableElement> typeVariables2 = holder.typeVariables; |
| 152 element.typeVariables = typeVariables5; | 152 element.typeVariables = typeVariables2; |
| 153 InterfaceTypeImpl interfaceType = new InterfaceTypeImpl.con1(element); | 153 InterfaceTypeImpl interfaceType = new InterfaceTypeImpl.con1(element); |
| 154 interfaceType.typeArguments = createTypeVariableTypes(typeVariables5); | 154 interfaceType.typeArguments = createTypeVariableTypes(typeVariables2); |
| 155 element.type = interfaceType; | 155 element.type = interfaceType; |
| 156 _currentHolder.addType(element); | 156 _currentHolder.addType(element); |
| 157 className.element = element; | 157 className.element = element; |
| 158 return null; | 158 return null; |
| 159 } | 159 } |
| 160 Object visitConstructorDeclaration(ConstructorDeclaration node) { | 160 Object visitConstructorDeclaration(ConstructorDeclaration node) { |
| 161 _isValidMixin = false; | 161 _isValidMixin = false; |
| 162 ElementHolder holder = new ElementHolder(); | 162 ElementHolder holder = new ElementHolder(); |
| 163 bool wasInFunction = _inFunction; | 163 bool wasInFunction = _inFunction; |
| 164 _inFunction = true; | 164 _inFunction = true; |
| 165 try { | 165 try { |
| 166 visitChildren(holder, node); | 166 visitChildren(holder, node); |
| 167 } finally { | 167 } finally { |
| 168 _inFunction = wasInFunction; | 168 _inFunction = wasInFunction; |
| 169 } | 169 } |
| 170 SimpleIdentifier constructorName = node.name; | 170 SimpleIdentifier constructorName = node.name; |
| 171 ConstructorElementImpl element = new ConstructorElementImpl(constructorName)
; | 171 ConstructorElementImpl element = new ConstructorElementImpl(constructorName)
; |
| 172 if (node.factoryKeyword != null) { | 172 if (node.factoryKeyword != null) { |
| 173 element.factory = true; | 173 element.factory = true; |
| 174 } | 174 } |
| 175 element.functions = holder.functions; | 175 element.functions = holder.functions; |
| 176 element.labels = holder.labels; | 176 element.labels = holder.labels; |
| 177 element.localVariables = holder.localVariables; | 177 element.localVariables = holder.localVariables; |
| 178 element.parameters = holder.parameters; | 178 element.parameters = holder.parameters; |
| 179 element.const2 = node.constKeyword != null; | 179 element.const2 = node.constKeyword != null; |
| 180 _currentHolder.addConstructor(element); | 180 _currentHolder.addConstructor(element); |
| 181 node.element = element; | 181 node.element = element; |
| 182 if (constructorName == null) { | 182 if (constructorName == null) { |
| 183 Identifier returnType4 = node.returnType; | 183 Identifier returnType2 = node.returnType; |
| 184 if (returnType4 != null) { | 184 if (returnType2 != null) { |
| 185 element.nameOffset = returnType4.offset; | 185 element.nameOffset = returnType2.offset; |
| 186 } | 186 } |
| 187 } else { | 187 } else { |
| 188 constructorName.element = element; | 188 constructorName.element = element; |
| 189 } | 189 } |
| 190 return null; | 190 return null; |
| 191 } | 191 } |
| 192 Object visitDeclaredIdentifier(DeclaredIdentifier node) { | 192 Object visitDeclaredIdentifier(DeclaredIdentifier node) { |
| 193 SimpleIdentifier variableName = node.identifier; | 193 SimpleIdentifier variableName = node.identifier; |
| 194 sc.Token keyword28 = node.keyword; | 194 sc.Token keyword2 = node.keyword; |
| 195 LocalVariableElementImpl element = new LocalVariableElementImpl(variableName
); | 195 LocalVariableElementImpl element = new LocalVariableElementImpl(variableName
); |
| 196 ForEachStatement statement = node.parent as ForEachStatement; | 196 ForEachStatement statement = node.parent as ForEachStatement; |
| 197 int declarationEnd = node.offset + node.length; | 197 int declarationEnd = node.offset + node.length; |
| 198 int statementEnd = statement.offset + statement.length; | 198 int statementEnd = statement.offset + statement.length; |
| 199 element.setVisibleRange(declarationEnd, statementEnd - declarationEnd - 1); | 199 element.setVisibleRange(declarationEnd, statementEnd - declarationEnd - 1); |
| 200 element.const3 = matches(keyword28, sc.Keyword.CONST); | 200 element.const3 = matches(keyword2, sc.Keyword.CONST); |
| 201 element.final2 = matches(keyword28, sc.Keyword.FINAL); | 201 element.final2 = matches(keyword2, sc.Keyword.FINAL); |
| 202 _currentHolder.addLocalVariable(element); | 202 _currentHolder.addLocalVariable(element); |
| 203 variableName.element = element; | 203 variableName.element = element; |
| 204 return super.visitDeclaredIdentifier(node); | 204 return super.visitDeclaredIdentifier(node); |
| 205 } | 205 } |
| 206 Object visitDefaultFormalParameter(DefaultFormalParameter node) { | 206 Object visitDefaultFormalParameter(DefaultFormalParameter node) { |
| 207 ElementHolder holder = new ElementHolder(); | 207 ElementHolder holder = new ElementHolder(); |
| 208 visit(holder, node.defaultValue); | 208 visit(holder, node.defaultValue); |
| 209 FunctionElementImpl initializer = new FunctionElementImpl(); | 209 FunctionElementImpl initializer = new FunctionElementImpl(); |
| 210 initializer.functions = holder.functions; | 210 initializer.functions = holder.functions; |
| 211 initializer.labels = holder.labels; | 211 initializer.labels = holder.labels; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 FunctionTypeImpl type = new FunctionTypeImpl.con1(element); | 344 FunctionTypeImpl type = new FunctionTypeImpl.con1(element); |
| 345 element.type = type; | 345 element.type = type; |
| 346 _currentHolder.addFunction(element); | 346 _currentHolder.addFunction(element); |
| 347 node.element = element; | 347 node.element = element; |
| 348 return null; | 348 return null; |
| 349 } | 349 } |
| 350 Object visitFunctionTypeAlias(FunctionTypeAlias node) { | 350 Object visitFunctionTypeAlias(FunctionTypeAlias node) { |
| 351 ElementHolder holder = new ElementHolder(); | 351 ElementHolder holder = new ElementHolder(); |
| 352 visitChildren(holder, node); | 352 visitChildren(holder, node); |
| 353 SimpleIdentifier aliasName = node.name; | 353 SimpleIdentifier aliasName = node.name; |
| 354 List<ParameterElement> parameters11 = holder.parameters; | 354 List<ParameterElement> parameters2 = holder.parameters; |
| 355 List<TypeVariableElement> typeVariables6 = holder.typeVariables; | 355 List<TypeVariableElement> typeVariables2 = holder.typeVariables; |
| 356 FunctionTypeAliasElementImpl element = new FunctionTypeAliasElementImpl(alia
sName); | 356 FunctionTypeAliasElementImpl element = new FunctionTypeAliasElementImpl(alia
sName); |
| 357 element.parameters = parameters11; | 357 element.parameters = parameters2; |
| 358 element.typeVariables = typeVariables6; | 358 element.typeVariables = typeVariables2; |
| 359 FunctionTypeImpl type = new FunctionTypeImpl.con2(element); | 359 FunctionTypeImpl type = new FunctionTypeImpl.con2(element); |
| 360 type.typeArguments = createTypeVariableTypes(typeVariables6); | 360 type.typeArguments = createTypeVariableTypes(typeVariables2); |
| 361 element.type = type; | 361 element.type = type; |
| 362 _currentHolder.addTypeAlias(element); | 362 _currentHolder.addTypeAlias(element); |
| 363 aliasName.element = element; | 363 aliasName.element = element; |
| 364 return null; | 364 return null; |
| 365 } | 365 } |
| 366 Object visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) { | 366 Object visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) { |
| 367 if (node.parent is! DefaultFormalParameter) { | 367 if (node.parent is! DefaultFormalParameter) { |
| 368 SimpleIdentifier parameterName = node.identifier; | 368 SimpleIdentifier parameterName = node.identifier; |
| 369 ParameterElementImpl parameter = new ParameterElementImpl(parameterName); | 369 ParameterElementImpl parameter = new ParameterElementImpl(parameterName); |
| 370 parameter.parameterKind = node.kind; | 370 parameter.parameterKind = node.kind; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 Object visitTypeParameter(TypeParameter node) { | 484 Object visitTypeParameter(TypeParameter node) { |
| 485 SimpleIdentifier parameterName = node.name; | 485 SimpleIdentifier parameterName = node.name; |
| 486 TypeVariableElementImpl element = new TypeVariableElementImpl(parameterName)
; | 486 TypeVariableElementImpl element = new TypeVariableElementImpl(parameterName)
; |
| 487 TypeVariableTypeImpl type = new TypeVariableTypeImpl(element); | 487 TypeVariableTypeImpl type = new TypeVariableTypeImpl(element); |
| 488 element.type = type; | 488 element.type = type; |
| 489 _currentHolder.addTypeVariable(element); | 489 _currentHolder.addTypeVariable(element); |
| 490 parameterName.element = element; | 490 parameterName.element = element; |
| 491 return super.visitTypeParameter(node); | 491 return super.visitTypeParameter(node); |
| 492 } | 492 } |
| 493 Object visitVariableDeclaration(VariableDeclaration node) { | 493 Object visitVariableDeclaration(VariableDeclaration node) { |
| 494 sc.Token keyword29 = ((node.parent as VariableDeclarationList)).keyword; | 494 sc.Token keyword2 = ((node.parent as VariableDeclarationList)).keyword; |
| 495 bool isConst = matches(keyword29, sc.Keyword.CONST); | 495 bool isConst = matches(keyword2, sc.Keyword.CONST); |
| 496 bool isFinal = matches(keyword29, sc.Keyword.FINAL); | 496 bool isFinal = matches(keyword2, sc.Keyword.FINAL); |
| 497 bool hasInitializer = node.initializer != null; | 497 bool hasInitializer = node.initializer != null; |
| 498 VariableElementImpl element; | 498 VariableElementImpl element; |
| 499 if (_inFieldContext) { | 499 if (_inFieldContext) { |
| 500 SimpleIdentifier fieldName = node.name; | 500 SimpleIdentifier fieldName = node.name; |
| 501 FieldElementImpl field; | 501 FieldElementImpl field; |
| 502 if (isConst && hasInitializer) { | 502 if (isConst && hasInitializer) { |
| 503 field = new ConstFieldElementImpl(fieldName); | 503 field = new ConstFieldElementImpl(fieldName); |
| 504 } else { | 504 } else { |
| 505 field = new FieldElementImpl.con1(fieldName); | 505 field = new FieldElementImpl.con1(fieldName); |
| 506 } | 506 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 } | 581 } |
| 582 return typeArguments; | 582 return typeArguments; |
| 583 } | 583 } |
| 584 /** | 584 /** |
| 585 * Return the body of the function that contains the given parameter, or {@cod
e null} if no | 585 * Return the body of the function that contains the given parameter, or {@cod
e null} if no |
| 586 * function body could be found. | 586 * function body could be found. |
| 587 * @param node the parameter contained in the function whose body is to be ret
urned | 587 * @param node the parameter contained in the function whose body is to be ret
urned |
| 588 * @return the body of the function that contains the given parameter | 588 * @return the body of the function that contains the given parameter |
| 589 */ | 589 */ |
| 590 FunctionBody getFunctionBody(FormalParameter node) { | 590 FunctionBody getFunctionBody(FormalParameter node) { |
| 591 ASTNode parent13 = node.parent; | 591 ASTNode parent2 = node.parent; |
| 592 while (parent13 != null) { | 592 while (parent2 != null) { |
| 593 if (parent13 is FunctionExpression) { | 593 if (parent2 is FunctionExpression) { |
| 594 return ((parent13 as FunctionExpression)).body; | 594 return ((parent2 as FunctionExpression)).body; |
| 595 } else if (parent13 is MethodDeclaration) { | 595 } else if (parent2 is MethodDeclaration) { |
| 596 return ((parent13 as MethodDeclaration)).body; | 596 return ((parent2 as MethodDeclaration)).body; |
| 597 } | 597 } |
| 598 parent13 = parent13.parent; | 598 parent2 = parent2.parent; |
| 599 } | 599 } |
| 600 return null; | 600 return null; |
| 601 } | 601 } |
| 602 /** | 602 /** |
| 603 * Return {@code true} if the given token is a token for the given keyword. | 603 * Return {@code true} if the given token is a token for the given keyword. |
| 604 * @param token the token being tested | 604 * @param token the token being tested |
| 605 * @param keyword the keyword being tested for | 605 * @param keyword the keyword being tested for |
| 606 * @return {@code true} if the given token is a token for the given keyword | 606 * @return {@code true} if the given token is a token for the given keyword |
| 607 */ | 607 */ |
| 608 bool matches(sc.Token token, sc.Keyword keyword37) => token != null && identic
al(token.type, sc.TokenType.KEYWORD) && identical(((token as sc.KeywordToken)).k
eyword, keyword37); | 608 bool matches(sc.Token token, sc.Keyword keyword2) => token != null && identica
l(token.type, sc.TokenType.KEYWORD) && identical(((token as sc.KeywordToken)).ke
yword, keyword2); |
| 609 /** | 609 /** |
| 610 * Make the given holder be the current holder while visiting the given node. | 610 * Make the given holder be the current holder while visiting the given node. |
| 611 * @param holder the holder that will gather elements that are built while vis
iting the children | 611 * @param holder the holder that will gather elements that are built while vis
iting the children |
| 612 * @param node the node to be visited | 612 * @param node the node to be visited |
| 613 */ | 613 */ |
| 614 void visit(ElementHolder holder, ASTNode node) { | 614 void visit(ElementHolder holder, ASTNode node) { |
| 615 if (node != null) { | 615 if (node != null) { |
| 616 ElementHolder previousHolder = _currentHolder; | 616 ElementHolder previousHolder = _currentHolder; |
| 617 _currentHolder = holder; | 617 _currentHolder = holder; |
| 618 try { | 618 try { |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 * @return the HTML element that was built | 813 * @return the HTML element that was built |
| 814 * @throws AnalysisException if the analysis could not be performed | 814 * @throws AnalysisException if the analysis could not be performed |
| 815 */ | 815 */ |
| 816 HtmlElementImpl buildHtmlElement(Source source) => buildHtmlElement2(source, _
context.parseHtmlUnit(source)); | 816 HtmlElementImpl buildHtmlElement(Source source) => buildHtmlElement2(source, _
context.parseHtmlUnit(source)); |
| 817 /** | 817 /** |
| 818 * Build the HTML element for the given source. | 818 * Build the HTML element for the given source. |
| 819 * @param source the source describing the compilation unit | 819 * @param source the source describing the compilation unit |
| 820 * @param unit the AST structure representing the HTML | 820 * @param unit the AST structure representing the HTML |
| 821 * @throws AnalysisException if the analysis could not be performed | 821 * @throws AnalysisException if the analysis could not be performed |
| 822 */ | 822 */ |
| 823 HtmlElementImpl buildHtmlElement2(Source source19, ht.HtmlUnit unit) { | 823 HtmlElementImpl buildHtmlElement2(Source source2, ht.HtmlUnit unit) { |
| 824 HtmlElementImpl result = new HtmlElementImpl(_context, source19.shortName); | 824 HtmlElementImpl result = new HtmlElementImpl(_context, source2.shortName); |
| 825 result.source = source19; | 825 result.source = source2; |
| 826 _htmlElement = result; | 826 _htmlElement = result; |
| 827 unit.accept(this); | 827 unit.accept(this); |
| 828 _htmlElement = null; | 828 _htmlElement = null; |
| 829 unit.element = result; | 829 unit.element = result; |
| 830 return result; | 830 return result; |
| 831 } | 831 } |
| 832 Object visitHtmlUnit(ht.HtmlUnit node) { | 832 Object visitHtmlUnit(ht.HtmlUnit node) { |
| 833 _scripts = new List<HtmlScriptElement>(); | 833 _scripts = new List<HtmlScriptElement>(); |
| 834 node.visitChildren(this); | 834 node.visitChildren(this); |
| 835 _htmlElement.scripts = new List.from(_scripts); | 835 _htmlElement.scripts = new List.from(_scripts); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 * Initialize a newly created resolver. | 946 * Initialize a newly created resolver. |
| 947 */ | 947 */ |
| 948 DeclarationResolver() : super() { | 948 DeclarationResolver() : super() { |
| 949 } | 949 } |
| 950 /** | 950 /** |
| 951 * Resolve the declarations within the given compilation unit to the elements
rooted at the given | 951 * Resolve the declarations within the given compilation unit to the elements
rooted at the given |
| 952 * element. | 952 * element. |
| 953 * @param unit the compilation unit to be resolved | 953 * @param unit the compilation unit to be resolved |
| 954 * @param element the root of the element model used to resolve the AST nodes | 954 * @param element the root of the element model used to resolve the AST nodes |
| 955 */ | 955 */ |
| 956 void resolve(CompilationUnit unit, CompilationUnitElement element67) { | 956 void resolve(CompilationUnit unit, CompilationUnitElement element2) { |
| 957 _enclosingUnit = element67; | 957 _enclosingUnit = element2; |
| 958 unit.element = element67; | 958 unit.element = element2; |
| 959 unit.accept(this); | 959 unit.accept(this); |
| 960 } | 960 } |
| 961 Object visitCatchClause(CatchClause node) { | 961 Object visitCatchClause(CatchClause node) { |
| 962 SimpleIdentifier exceptionParameter3 = node.exceptionParameter; | 962 SimpleIdentifier exceptionParameter2 = node.exceptionParameter; |
| 963 if (exceptionParameter3 != null) { | 963 if (exceptionParameter2 != null) { |
| 964 List<LocalVariableElement> localVariables3 = _enclosingExecutable.localVar
iables; | 964 List<LocalVariableElement> localVariables2 = _enclosingExecutable.localVar
iables; |
| 965 find3(localVariables3, exceptionParameter3); | 965 find3(localVariables2, exceptionParameter2); |
| 966 SimpleIdentifier stackTraceParameter3 = node.stackTraceParameter; | 966 SimpleIdentifier stackTraceParameter2 = node.stackTraceParameter; |
| 967 if (stackTraceParameter3 != null) { | 967 if (stackTraceParameter2 != null) { |
| 968 find3(localVariables3, stackTraceParameter3); | 968 find3(localVariables2, stackTraceParameter2); |
| 969 } | 969 } |
| 970 } | 970 } |
| 971 return super.visitCatchClause(node); | 971 return super.visitCatchClause(node); |
| 972 } | 972 } |
| 973 Object visitClassDeclaration(ClassDeclaration node) { | 973 Object visitClassDeclaration(ClassDeclaration node) { |
| 974 ClassElement outerClass = _enclosingClass; | 974 ClassElement outerClass = _enclosingClass; |
| 975 try { | 975 try { |
| 976 SimpleIdentifier className = node.name; | 976 SimpleIdentifier className = node.name; |
| 977 _enclosingClass = find3(_enclosingUnit.types, className); | 977 _enclosingClass = find3(_enclosingUnit.types, className); |
| 978 return super.visitClassDeclaration(node); | 978 return super.visitClassDeclaration(node); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 Object visitDefaultFormalParameter(DefaultFormalParameter node) { | 1014 Object visitDefaultFormalParameter(DefaultFormalParameter node) { |
| 1015 SimpleIdentifier parameterName = node.parameter.identifier; | 1015 SimpleIdentifier parameterName = node.parameter.identifier; |
| 1016 ParameterElement element = null; | 1016 ParameterElement element = null; |
| 1017 if (_enclosingExecutable != null) { | 1017 if (_enclosingExecutable != null) { |
| 1018 element = find3(_enclosingExecutable.parameters, parameterName); | 1018 element = find3(_enclosingExecutable.parameters, parameterName); |
| 1019 } else { | 1019 } else { |
| 1020 PrintStringWriter writer = new PrintStringWriter(); | 1020 PrintStringWriter writer = new PrintStringWriter(); |
| 1021 writer.println("Invalid state found in the Analysis Engine:"); | 1021 writer.println("Invalid state found in the Analysis Engine:"); |
| 1022 writer.println("DeclarationResolver.visitDefaultFormalParameter() is visit
ing a parameter that does not appear to be in a method or function."); | 1022 writer.println("DeclarationResolver.visitDefaultFormalParameter() is visit
ing a parameter that does not appear to be in a method or function."); |
| 1023 writer.println("Ancestors:"); | 1023 writer.println("Ancestors:"); |
| 1024 ASTNode parent14 = node.parent; | 1024 ASTNode parent2 = node.parent; |
| 1025 while (parent14 != null) { | 1025 while (parent2 != null) { |
| 1026 writer.println(parent14.runtimeType.toString()); | 1026 writer.println(parent2.runtimeType.toString()); |
| 1027 writer.println("---------"); | 1027 writer.println("---------"); |
| 1028 parent14 = parent14.parent; | 1028 parent2 = parent2.parent; |
| 1029 } | 1029 } |
| 1030 AnalysisEngine.instance.logger.logError2(writer.toString(), new AnalysisEx
ception()); | 1030 AnalysisEngine.instance.logger.logError2(writer.toString(), new AnalysisEx
ception()); |
| 1031 } | 1031 } |
| 1032 Expression defaultValue2 = node.defaultValue; | 1032 Expression defaultValue2 = node.defaultValue; |
| 1033 if (defaultValue2 != null) { | 1033 if (defaultValue2 != null) { |
| 1034 ExecutableElement outerExecutable = _enclosingExecutable; | 1034 ExecutableElement outerExecutable = _enclosingExecutable; |
| 1035 try { | 1035 try { |
| 1036 if (element == null) { | 1036 if (element == null) { |
| 1037 } else { | 1037 } else { |
| 1038 _enclosingExecutable = element.initializer; | 1038 _enclosingExecutable = element.initializer; |
| 1039 } | 1039 } |
| 1040 defaultValue2.accept(this); | 1040 defaultValue2.accept(this); |
| 1041 } finally { | 1041 } finally { |
| 1042 _enclosingExecutable = outerExecutable; | 1042 _enclosingExecutable = outerExecutable; |
| 1043 } | 1043 } |
| 1044 } | 1044 } |
| 1045 ParameterElement outerParameter = _enclosingParameter; | 1045 ParameterElement outerParameter = _enclosingParameter; |
| 1046 try { | 1046 try { |
| 1047 _enclosingParameter = element; | 1047 _enclosingParameter = element; |
| 1048 return super.visitDefaultFormalParameter(node); | 1048 return super.visitDefaultFormalParameter(node); |
| 1049 } finally { | 1049 } finally { |
| 1050 _enclosingParameter = outerParameter; | 1050 _enclosingParameter = outerParameter; |
| 1051 } | 1051 } |
| 1052 } | 1052 } |
| 1053 Object visitExportDirective(ExportDirective node) { | 1053 Object visitExportDirective(ExportDirective node) { |
| 1054 String uri3 = getStringValue(node.uri); | 1054 String uri2 = getStringValue(node.uri); |
| 1055 if (uri3 != null) { | 1055 if (uri2 != null) { |
| 1056 LibraryElement library31 = _enclosingUnit.library; | 1056 LibraryElement library2 = _enclosingUnit.library; |
| 1057 ExportElement exportElement = find5(library31.exports, _enclosingUnit.cont
ext.sourceFactory.resolveUri(_enclosingUnit.source, uri3)); | 1057 ExportElement exportElement = find5(library2.exports, _enclosingUnit.conte
xt.sourceFactory.resolveUri(_enclosingUnit.source, uri2)); |
| 1058 node.element = exportElement; | 1058 node.element = exportElement; |
| 1059 } | 1059 } |
| 1060 return super.visitExportDirective(node); | 1060 return super.visitExportDirective(node); |
| 1061 } | 1061 } |
| 1062 Object visitFieldFormalParameter(FieldFormalParameter node) { | 1062 Object visitFieldFormalParameter(FieldFormalParameter node) { |
| 1063 if (node.parent is! DefaultFormalParameter) { | 1063 if (node.parent is! DefaultFormalParameter) { |
| 1064 SimpleIdentifier parameterName = node.identifier; | 1064 SimpleIdentifier parameterName = node.identifier; |
| 1065 ParameterElement element = find3(_enclosingExecutable.parameters, paramete
rName); | 1065 ParameterElement element = find3(_enclosingExecutable.parameters, paramete
rName); |
| 1066 ParameterElement outerParameter = _enclosingParameter; | 1066 ParameterElement outerParameter = _enclosingParameter; |
| 1067 try { | 1067 try { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1131 _enclosingParameter = element; | 1131 _enclosingParameter = element; |
| 1132 return super.visitFunctionTypedFormalParameter(node); | 1132 return super.visitFunctionTypedFormalParameter(node); |
| 1133 } finally { | 1133 } finally { |
| 1134 _enclosingParameter = outerParameter; | 1134 _enclosingParameter = outerParameter; |
| 1135 } | 1135 } |
| 1136 } else { | 1136 } else { |
| 1137 return super.visitFunctionTypedFormalParameter(node); | 1137 return super.visitFunctionTypedFormalParameter(node); |
| 1138 } | 1138 } |
| 1139 } | 1139 } |
| 1140 Object visitImportDirective(ImportDirective node) { | 1140 Object visitImportDirective(ImportDirective node) { |
| 1141 String uri4 = getStringValue(node.uri); | 1141 String uri2 = getStringValue(node.uri); |
| 1142 if (uri4 != null) { | 1142 if (uri2 != null) { |
| 1143 LibraryElement library32 = _enclosingUnit.library; | 1143 LibraryElement library2 = _enclosingUnit.library; |
| 1144 ImportElement importElement = find6(library32.imports, _enclosingUnit.cont
ext.sourceFactory.resolveUri(_enclosingUnit.source, uri4), node.prefix); | 1144 ImportElement importElement = find6(library2.imports, _enclosingUnit.conte
xt.sourceFactory.resolveUri(_enclosingUnit.source, uri2), node.prefix); |
| 1145 node.element = importElement; | 1145 node.element = importElement; |
| 1146 } | 1146 } |
| 1147 return super.visitImportDirective(node); | 1147 return super.visitImportDirective(node); |
| 1148 } | 1148 } |
| 1149 Object visitLabeledStatement(LabeledStatement node) { | 1149 Object visitLabeledStatement(LabeledStatement node) { |
| 1150 for (Label label in node.labels) { | 1150 for (Label label in node.labels) { |
| 1151 SimpleIdentifier labelName = label.label; | 1151 SimpleIdentifier labelName = label.label; |
| 1152 find3(_enclosingExecutable.labels, labelName); | 1152 find3(_enclosingExecutable.labels, labelName); |
| 1153 } | 1153 } |
| 1154 return super.visitLabeledStatement(node); | 1154 return super.visitLabeledStatement(node); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1176 methodName.element = accessor; | 1176 methodName.element = accessor; |
| 1177 } | 1177 } |
| 1178 _enclosingExecutable = accessor; | 1178 _enclosingExecutable = accessor; |
| 1179 } | 1179 } |
| 1180 return super.visitMethodDeclaration(node); | 1180 return super.visitMethodDeclaration(node); |
| 1181 } finally { | 1181 } finally { |
| 1182 _enclosingExecutable = outerExecutable; | 1182 _enclosingExecutable = outerExecutable; |
| 1183 } | 1183 } |
| 1184 } | 1184 } |
| 1185 Object visitPartDirective(PartDirective node) { | 1185 Object visitPartDirective(PartDirective node) { |
| 1186 String uri5 = getStringValue(node.uri); | 1186 String uri2 = getStringValue(node.uri); |
| 1187 if (uri5 != null) { | 1187 if (uri2 != null) { |
| 1188 Source partSource = _enclosingUnit.context.sourceFactory.resolveUri(_enclo
singUnit.source, uri5); | 1188 Source partSource = _enclosingUnit.context.sourceFactory.resolveUri(_enclo
singUnit.source, uri2); |
| 1189 node.element = find(_enclosingUnit.library.parts, partSource); | 1189 node.element = find(_enclosingUnit.library.parts, partSource); |
| 1190 } | 1190 } |
| 1191 return super.visitPartDirective(node); | 1191 return super.visitPartDirective(node); |
| 1192 } | 1192 } |
| 1193 Object visitPartOfDirective(PartOfDirective node) { | 1193 Object visitPartOfDirective(PartOfDirective node) { |
| 1194 node.element = _enclosingUnit.library; | 1194 node.element = _enclosingUnit.library; |
| 1195 return super.visitPartOfDirective(node); | 1195 return super.visitPartOfDirective(node); |
| 1196 } | 1196 } |
| 1197 Object visitSimpleFormalParameter(SimpleFormalParameter node) { | 1197 Object visitSimpleFormalParameter(SimpleFormalParameter node) { |
| 1198 if (node.parent is! DefaultFormalParameter) { | 1198 if (node.parent is! DefaultFormalParameter) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1245 SimpleIdentifier variableName = node.name; | 1245 SimpleIdentifier variableName = node.name; |
| 1246 if (_enclosingExecutable != null) { | 1246 if (_enclosingExecutable != null) { |
| 1247 element = find3(_enclosingExecutable.localVariables, variableName); | 1247 element = find3(_enclosingExecutable.localVariables, variableName); |
| 1248 } | 1248 } |
| 1249 if (element == null && _enclosingClass != null) { | 1249 if (element == null && _enclosingClass != null) { |
| 1250 element = find3(_enclosingClass.fields, variableName); | 1250 element = find3(_enclosingClass.fields, variableName); |
| 1251 } | 1251 } |
| 1252 if (element == null && _enclosingUnit != null) { | 1252 if (element == null && _enclosingUnit != null) { |
| 1253 element = find3(_enclosingUnit.topLevelVariables, variableName); | 1253 element = find3(_enclosingUnit.topLevelVariables, variableName); |
| 1254 } | 1254 } |
| 1255 Expression initializer5 = node.initializer; | 1255 Expression initializer2 = node.initializer; |
| 1256 if (initializer5 != null) { | 1256 if (initializer2 != null) { |
| 1257 ExecutableElement outerExecutable = _enclosingExecutable; | 1257 ExecutableElement outerExecutable = _enclosingExecutable; |
| 1258 try { | 1258 try { |
| 1259 if (element == null) { | 1259 if (element == null) { |
| 1260 } else { | 1260 } else { |
| 1261 _enclosingExecutable = element.initializer; | 1261 _enclosingExecutable = element.initializer; |
| 1262 } | 1262 } |
| 1263 return super.visitVariableDeclaration(node); | 1263 return super.visitVariableDeclaration(node); |
| 1264 } finally { | 1264 } finally { |
| 1265 _enclosingExecutable = outerExecutable; | 1265 _enclosingExecutable = outerExecutable; |
| 1266 } | 1266 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1321 return element; | 1321 return element; |
| 1322 } | 1322 } |
| 1323 /** | 1323 /** |
| 1324 * Return the element in the given array of elements that was created for the
declaration with the | 1324 * Return the element in the given array of elements that was created for the
declaration with the |
| 1325 * given name at the given offset. | 1325 * given name at the given offset. |
| 1326 * @param elements the elements of the appropriate kind that exist in the curr
ent context | 1326 * @param elements the elements of the appropriate kind that exist in the curr
ent context |
| 1327 * @param name the name of the element to be returned | 1327 * @param name the name of the element to be returned |
| 1328 * @param offset the offset of the name of the element to be returned | 1328 * @param offset the offset of the name of the element to be returned |
| 1329 * @return the element with the given name and offset | 1329 * @return the element with the given name and offset |
| 1330 */ | 1330 */ |
| 1331 Element find4(List<Element> elements, String name30, int offset) { | 1331 Element find4(List<Element> elements, String name2, int offset) { |
| 1332 for (Element element in elements) { | 1332 for (Element element in elements) { |
| 1333 if (element.name == name30 && element.nameOffset == offset) { | 1333 if (element.name == name2 && element.nameOffset == offset) { |
| 1334 return element; | 1334 return element; |
| 1335 } | 1335 } |
| 1336 } | 1336 } |
| 1337 return null; | 1337 return null; |
| 1338 } | 1338 } |
| 1339 /** | 1339 /** |
| 1340 * Return the export element from the given array whose library has the given
source, or{@code null} if there is no such export. | 1340 * Return the export element from the given array whose library has the given
source, or{@code null} if there is no such export. |
| 1341 * @param exports the export elements being searched | 1341 * @param exports the export elements being searched |
| 1342 * @param source the source of the library associated with the export element
to being searched | 1342 * @param source the source of the library associated with the export element
to being searched |
| 1343 * for | 1343 * for |
| 1344 * @return the export element whose library has the given source | 1344 * @return the export element whose library has the given source |
| 1345 */ | 1345 */ |
| 1346 ExportElement find5(List<ExportElement> exports, Source source21) { | 1346 ExportElement find5(List<ExportElement> exports, Source source2) { |
| 1347 for (ExportElement export in exports) { | 1347 for (ExportElement export in exports) { |
| 1348 if (export.exportedLibrary.source == source21) { | 1348 if (export.exportedLibrary.source == source2) { |
| 1349 return export; | 1349 return export; |
| 1350 } | 1350 } |
| 1351 } | 1351 } |
| 1352 return null; | 1352 return null; |
| 1353 } | 1353 } |
| 1354 /** | 1354 /** |
| 1355 * Return the import element from the given array whose library has the given
source and that has | 1355 * Return the import element from the given array whose library has the given
source and that has |
| 1356 * the given prefix, or {@code null} if there is no such import. | 1356 * the given prefix, or {@code null} if there is no such import. |
| 1357 * @param imports the import elements being searched | 1357 * @param imports the import elements being searched |
| 1358 * @param source the source of the library associated with the import element
to being searched | 1358 * @param source the source of the library associated with the import element
to being searched |
| 1359 * for | 1359 * for |
| 1360 * @param prefix the prefix with which the library was imported | 1360 * @param prefix the prefix with which the library was imported |
| 1361 * @return the import element whose library has the given source and prefix | 1361 * @return the import element whose library has the given source and prefix |
| 1362 */ | 1362 */ |
| 1363 ImportElement find6(List<ImportElement> imports, Source source22, SimpleIdenti
fier prefix12) { | 1363 ImportElement find6(List<ImportElement> imports, Source source2, SimpleIdentif
ier prefix2) { |
| 1364 for (ImportElement element in imports) { | 1364 for (ImportElement element in imports) { |
| 1365 if (element.importedLibrary.source == source22) { | 1365 if (element.importedLibrary.source == source2) { |
| 1366 PrefixElement prefixElement = element.prefix; | 1366 PrefixElement prefixElement = element.prefix; |
| 1367 if (prefix12 == null) { | 1367 if (prefix2 == null) { |
| 1368 if (prefixElement == null) { | 1368 if (prefixElement == null) { |
| 1369 return element; | 1369 return element; |
| 1370 } | 1370 } |
| 1371 } else { | 1371 } else { |
| 1372 if (prefixElement != null && prefix12.name == prefixElement.name) { | 1372 if (prefixElement != null && prefix2.name == prefixElement.name) { |
| 1373 return element; | 1373 return element; |
| 1374 } | 1374 } |
| 1375 } | 1375 } |
| 1376 } | 1376 } |
| 1377 } | 1377 } |
| 1378 return null; | 1378 return null; |
| 1379 } | 1379 } |
| 1380 /** | 1380 /** |
| 1381 * Return the value of the given string literal, or {@code null} if the string
is not a constant | 1381 * Return the value of the given string literal, or {@code null} if the string
is not a constant |
| 1382 * string without any string interpolation. | 1382 * string without any string interpolation. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1449 */ | 1449 */ |
| 1450 ResolverVisitor _resolver; | 1450 ResolverVisitor _resolver; |
| 1451 /** | 1451 /** |
| 1452 * Initialize a newly created visitor to resolve the nodes in a compilation un
it. | 1452 * Initialize a newly created visitor to resolve the nodes in a compilation un
it. |
| 1453 * @param resolver the resolver driving this participant | 1453 * @param resolver the resolver driving this participant |
| 1454 */ | 1454 */ |
| 1455 ElementResolver(ResolverVisitor resolver) { | 1455 ElementResolver(ResolverVisitor resolver) { |
| 1456 this._resolver = resolver; | 1456 this._resolver = resolver; |
| 1457 } | 1457 } |
| 1458 Object visitAssignmentExpression(AssignmentExpression node) { | 1458 Object visitAssignmentExpression(AssignmentExpression node) { |
| 1459 sc.TokenType operator7 = node.operator.type; | 1459 sc.TokenType operator2 = node.operator.type; |
| 1460 if (operator7 != sc.TokenType.EQ) { | 1460 if (operator2 != sc.TokenType.EQ) { |
| 1461 operator7 = operatorFromCompoundAssignment(operator7); | 1461 operator2 = operatorFromCompoundAssignment(operator2); |
| 1462 Expression leftNode = node.leftHandSide; | 1462 Expression leftNode = node.leftHandSide; |
| 1463 if (leftNode != null) { | 1463 if (leftNode != null) { |
| 1464 Type2 leftType = getType(leftNode); | 1464 Type2 leftType = getType(leftNode); |
| 1465 if (leftType != null) { | 1465 if (leftType != null) { |
| 1466 MethodElement method = lookUpMethod(leftType, operator7.lexeme); | 1466 MethodElement method = lookUpMethod(leftType, operator2.lexeme); |
| 1467 if (method != null) { | 1467 if (method != null) { |
| 1468 node.element = method; | 1468 node.element = method; |
| 1469 } else { | 1469 } else { |
| 1470 } | 1470 } |
| 1471 } | 1471 } |
| 1472 } | 1472 } |
| 1473 } | 1473 } |
| 1474 return null; | 1474 return null; |
| 1475 } | 1475 } |
| 1476 Object visitBinaryExpression(BinaryExpression node) { | 1476 Object visitBinaryExpression(BinaryExpression node) { |
| 1477 sc.Token operator8 = node.operator; | 1477 sc.Token operator2 = node.operator; |
| 1478 if (operator8.isUserDefinableOperator()) { | 1478 if (operator2.isUserDefinableOperator()) { |
| 1479 Type2 leftType = getType(node.leftOperand); | 1479 Type2 leftType = getType(node.leftOperand); |
| 1480 if (leftType == null || leftType.isDynamic()) { | 1480 if (leftType == null || leftType.isDynamic()) { |
| 1481 return null; | 1481 return null; |
| 1482 } else if (leftType is FunctionType) { | 1482 } else if (leftType is FunctionType) { |
| 1483 leftType = _resolver.typeProvider.functionType; | 1483 leftType = _resolver.typeProvider.functionType; |
| 1484 } | 1484 } |
| 1485 String methodName = operator8.lexeme; | 1485 String methodName = operator2.lexeme; |
| 1486 MethodElement member = lookUpMethod(leftType, methodName); | 1486 MethodElement member = lookUpMethod(leftType, methodName); |
| 1487 if (member == null) { | 1487 if (member == null) { |
| 1488 _resolver.reportError3(StaticWarningCode.UNDEFINED_OPERATOR, operator8,
[methodName, leftType.name]); | 1488 _resolver.reportError3(StaticWarningCode.UNDEFINED_OPERATOR, operator2,
[methodName, leftType.name]); |
| 1489 } else { | 1489 } else { |
| 1490 node.element = member; | 1490 node.element = member; |
| 1491 } | 1491 } |
| 1492 } | 1492 } |
| 1493 return null; | 1493 return null; |
| 1494 } | 1494 } |
| 1495 Object visitBreakStatement(BreakStatement node) { | 1495 Object visitBreakStatement(BreakStatement node) { |
| 1496 SimpleIdentifier labelNode = node.label; | 1496 SimpleIdentifier labelNode = node.label; |
| 1497 LabelElementImpl labelElement = lookupLabel(node, labelNode); | 1497 LabelElementImpl labelElement = lookupLabel(node, labelNode); |
| 1498 if (labelElement != null && labelElement.isOnSwitchMember()) { | 1498 if (labelElement != null && labelElement.isOnSwitchMember()) { |
| 1499 _resolver.reportError(ResolverErrorCode.BREAK_LABEL_ON_SWITCH_MEMBER, labe
lNode, []); | 1499 _resolver.reportError(ResolverErrorCode.BREAK_LABEL_ON_SWITCH_MEMBER, labe
lNode, []); |
| 1500 } | 1500 } |
| 1501 return null; | 1501 return null; |
| 1502 } | 1502 } |
| 1503 Object visitConstructorFieldInitializer(ConstructorFieldInitializer node) { | 1503 Object visitConstructorFieldInitializer(ConstructorFieldInitializer node) { |
| 1504 FieldElement fieldElement = null; | 1504 FieldElement fieldElement = null; |
| 1505 SimpleIdentifier fieldName2 = node.fieldName; | 1505 SimpleIdentifier fieldName2 = node.fieldName; |
| 1506 ClassElement enclosingClass2 = _resolver.enclosingClass; | 1506 ClassElement enclosingClass2 = _resolver.enclosingClass; |
| 1507 fieldElement = ((enclosingClass2 as ClassElementImpl)).getField(fieldName2.n
ame); | 1507 fieldElement = ((enclosingClass2 as ClassElementImpl)).getField(fieldName2.n
ame); |
| 1508 if (fieldElement != null && !fieldElement.isSynthetic()) { | 1508 if (fieldElement != null && !fieldElement.isSynthetic()) { |
| 1509 recordResolution(fieldName2, fieldElement); | 1509 recordResolution(fieldName2, fieldElement); |
| 1510 } | 1510 } |
| 1511 return null; | 1511 return null; |
| 1512 } | 1512 } |
| 1513 Object visitConstructorName(ConstructorName node) { | 1513 Object visitConstructorName(ConstructorName node) { |
| 1514 Type2 type14 = node.type.type; | 1514 Type2 type2 = node.type.type; |
| 1515 if (type14 is DynamicTypeImpl) { | 1515 if (type2 is DynamicTypeImpl) { |
| 1516 return null; | 1516 return null; |
| 1517 } else if (type14 is! InterfaceType) { | 1517 } else if (type2 is! InterfaceType) { |
| 1518 ASTNode parent15 = node.parent; | 1518 ASTNode parent2 = node.parent; |
| 1519 if (parent15 is InstanceCreationExpression) { | 1519 if (parent2 is InstanceCreationExpression) { |
| 1520 if (((parent15 as InstanceCreationExpression)).isConst()) { | 1520 if (((parent2 as InstanceCreationExpression)).isConst()) { |
| 1521 } else { | 1521 } else { |
| 1522 } | 1522 } |
| 1523 } else { | 1523 } else { |
| 1524 } | 1524 } |
| 1525 return null; | 1525 return null; |
| 1526 } | 1526 } |
| 1527 ClassElement classElement = ((type14 as InterfaceType)).element; | 1527 ClassElement classElement = ((type2 as InterfaceType)).element; |
| 1528 ConstructorElement constructor; | 1528 ConstructorElement constructor; |
| 1529 SimpleIdentifier name17 = node.name; | 1529 SimpleIdentifier name2 = node.name; |
| 1530 if (name17 == null) { | 1530 if (name2 == null) { |
| 1531 constructor = classElement.unnamedConstructor; | 1531 constructor = classElement.unnamedConstructor; |
| 1532 } else { | 1532 } else { |
| 1533 constructor = classElement.getNamedConstructor(name17.name); | 1533 constructor = classElement.getNamedConstructor(name2.name); |
| 1534 name17.element = constructor; | 1534 name2.element = constructor; |
| 1535 } | 1535 } |
| 1536 node.element = constructor; | 1536 node.element = constructor; |
| 1537 return null; | 1537 return null; |
| 1538 } | 1538 } |
| 1539 Object visitContinueStatement(ContinueStatement node) { | 1539 Object visitContinueStatement(ContinueStatement node) { |
| 1540 SimpleIdentifier labelNode = node.label; | 1540 SimpleIdentifier labelNode = node.label; |
| 1541 LabelElementImpl labelElement = lookupLabel(node, labelNode); | 1541 LabelElementImpl labelElement = lookupLabel(node, labelNode); |
| 1542 if (labelElement != null && labelElement.isOnSwitchStatement()) { | 1542 if (labelElement != null && labelElement.isOnSwitchStatement()) { |
| 1543 _resolver.reportError(ResolverErrorCode.CONTINUE_LABEL_ON_SWITCH, labelNod
e, []); | 1543 _resolver.reportError(ResolverErrorCode.CONTINUE_LABEL_ON_SWITCH, labelNod
e, []); |
| 1544 } | 1544 } |
| 1545 return null; | 1545 return null; |
| 1546 } | 1546 } |
| 1547 Object visitExportDirective(ExportDirective node) { | 1547 Object visitExportDirective(ExportDirective node) { |
| 1548 Element element28 = node.element; | 1548 Element element2 = node.element; |
| 1549 if (element28 is ExportElement) { | 1549 if (element2 is ExportElement) { |
| 1550 resolveCombinators(((element28 as ExportElement)).exportedLibrary, node.co
mbinators); | 1550 resolveCombinators(((element2 as ExportElement)).exportedLibrary, node.com
binators); |
| 1551 } | 1551 } |
| 1552 return null; | 1552 return null; |
| 1553 } | 1553 } |
| 1554 Object visitFieldFormalParameter(FieldFormalParameter node) { | 1554 Object visitFieldFormalParameter(FieldFormalParameter node) { |
| 1555 String fieldName = node.identifier.name; | 1555 String fieldName = node.identifier.name; |
| 1556 ClassElement classElement = _resolver.enclosingClass; | 1556 ClassElement classElement = _resolver.enclosingClass; |
| 1557 if (classElement != null) { | 1557 if (classElement != null) { |
| 1558 FieldElement fieldElement = ((classElement as ClassElementImpl)).getField(
fieldName); | 1558 FieldElement fieldElement = ((classElement as ClassElementImpl)).getField(
fieldName); |
| 1559 if (fieldElement != null) { | 1559 if (fieldElement != null) { |
| 1560 if (!fieldElement.isSynthetic()) { | 1560 if (!fieldElement.isSynthetic()) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1577 SimpleIdentifier prefixNode = node.prefix; | 1577 SimpleIdentifier prefixNode = node.prefix; |
| 1578 if (prefixNode != null) { | 1578 if (prefixNode != null) { |
| 1579 String prefixName = prefixNode.name; | 1579 String prefixName = prefixNode.name; |
| 1580 for (PrefixElement prefixElement in _resolver.definingLibrary.prefixes) { | 1580 for (PrefixElement prefixElement in _resolver.definingLibrary.prefixes) { |
| 1581 if (prefixElement.name == prefixName) { | 1581 if (prefixElement.name == prefixName) { |
| 1582 recordResolution(prefixNode, prefixElement); | 1582 recordResolution(prefixNode, prefixElement); |
| 1583 break; | 1583 break; |
| 1584 } | 1584 } |
| 1585 } | 1585 } |
| 1586 } | 1586 } |
| 1587 Element element29 = node.element; | 1587 Element element2 = node.element; |
| 1588 if (element29 is ImportElement) { | 1588 if (element2 is ImportElement) { |
| 1589 resolveCombinators(((element29 as ImportElement)).importedLibrary, node.co
mbinators); | 1589 resolveCombinators(((element2 as ImportElement)).importedLibrary, node.com
binators); |
| 1590 } | 1590 } |
| 1591 return null; | 1591 return null; |
| 1592 } | 1592 } |
| 1593 Object visitIndexExpression(IndexExpression node) { | 1593 Object visitIndexExpression(IndexExpression node) { |
| 1594 Type2 arrayType = getType(node.realTarget); | 1594 Type2 arrayType = getType(node.realTarget); |
| 1595 if (arrayType == null || arrayType.isDynamic()) { | 1595 if (arrayType == null || arrayType.isDynamic()) { |
| 1596 return null; | 1596 return null; |
| 1597 } | 1597 } |
| 1598 String operator; | 1598 String operator; |
| 1599 if (node.inSetterContext()) { | 1599 if (node.inSetterContext()) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1615 resolveNamedArguments(node.argumentList, invokedConstructor); | 1615 resolveNamedArguments(node.argumentList, invokedConstructor); |
| 1616 return null; | 1616 return null; |
| 1617 } | 1617 } |
| 1618 Object visitMethodInvocation(MethodInvocation node) { | 1618 Object visitMethodInvocation(MethodInvocation node) { |
| 1619 SimpleIdentifier methodName2 = node.methodName; | 1619 SimpleIdentifier methodName2 = node.methodName; |
| 1620 Expression target = node.realTarget; | 1620 Expression target = node.realTarget; |
| 1621 Element element; | 1621 Element element; |
| 1622 if (target == null) { | 1622 if (target == null) { |
| 1623 element = _resolver.nameScope.lookup(methodName2, _resolver.definingLibrar
y); | 1623 element = _resolver.nameScope.lookup(methodName2, _resolver.definingLibrar
y); |
| 1624 if (element == null) { | 1624 if (element == null) { |
| 1625 ClassElement enclosingClass3 = _resolver.enclosingClass; | 1625 ClassElement enclosingClass2 = _resolver.enclosingClass; |
| 1626 if (enclosingClass3 != null) { | 1626 if (enclosingClass2 != null) { |
| 1627 InterfaceType enclosingType = enclosingClass3.type; | 1627 InterfaceType enclosingType = enclosingClass2.type; |
| 1628 element = lookUpMethod(enclosingType, methodName2.name); | 1628 element = lookUpMethod(enclosingType, methodName2.name); |
| 1629 if (element == null) { | 1629 if (element == null) { |
| 1630 PropertyAccessorElement getter = lookUpGetter(enclosingType, methodN
ame2.name); | 1630 PropertyAccessorElement getter = lookUpGetter(enclosingType, methodN
ame2.name); |
| 1631 if (getter != null) { | 1631 if (getter != null) { |
| 1632 FunctionType getterType = getter.type; | 1632 FunctionType getterType = getter.type; |
| 1633 if (getterType != null) { | 1633 if (getterType != null) { |
| 1634 Type2 returnType5 = getterType.returnType; | 1634 Type2 returnType2 = getterType.returnType; |
| 1635 if (!isExecutableType(returnType5)) { | 1635 if (!isExecutableType(returnType2)) { |
| 1636 _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_
FUNCTION, methodName2, [methodName2.name]); | 1636 _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_
FUNCTION, methodName2, [methodName2.name]); |
| 1637 } | 1637 } |
| 1638 } | 1638 } |
| 1639 recordResolution(methodName2, getter); | 1639 recordResolution(methodName2, getter); |
| 1640 return null; | 1640 return null; |
| 1641 } | 1641 } |
| 1642 } | 1642 } |
| 1643 } | 1643 } |
| 1644 } | 1644 } |
| 1645 } else { | 1645 } else { |
| 1646 Type2 targetType = getType(target); | 1646 Type2 targetType = getType(target); |
| 1647 if (targetType is InterfaceType) { | 1647 if (targetType is InterfaceType) { |
| 1648 InterfaceType classType = targetType as InterfaceType; | 1648 InterfaceType classType = targetType as InterfaceType; |
| 1649 element = lookUpMethod(classType, methodName2.name); | 1649 element = lookUpMethod(classType, methodName2.name); |
| 1650 if (element == null) { | 1650 if (element == null) { |
| 1651 PropertyAccessorElement accessor = classType.getGetter(methodName2.nam
e); | 1651 PropertyAccessorElement accessor = classType.getGetter(methodName2.nam
e); |
| 1652 if (accessor != null) { | 1652 if (accessor != null) { |
| 1653 Type2 returnType6 = accessor.type.returnType; | 1653 Type2 returnType3 = accessor.type.returnType; |
| 1654 if (!isExecutableType(returnType6)) { | 1654 if (!isExecutableType(returnType3)) { |
| 1655 _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNC
TION, methodName2, [methodName2.name]); | 1655 _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNC
TION, methodName2, [methodName2.name]); |
| 1656 return null; | 1656 return null; |
| 1657 } | 1657 } |
| 1658 element = accessor; | 1658 element = accessor; |
| 1659 } | 1659 } |
| 1660 } | 1660 } |
| 1661 if (element == null && target is SuperExpression) { | 1661 if (element == null && target is SuperExpression) { |
| 1662 _resolver.reportError(StaticTypeWarningCode.UNDEFINED_SUPER_METHOD, me
thodName2, [methodName2.name, targetType.element.name]); | 1662 _resolver.reportError(StaticTypeWarningCode.UNDEFINED_SUPER_METHOD, me
thodName2, [methodName2.name, targetType.element.name]); |
| 1663 return null; | 1663 return null; |
| 1664 } | 1664 } |
| 1665 } else if (target is SimpleIdentifier) { | 1665 } else if (target is SimpleIdentifier) { |
| 1666 Element targetElement = ((target as SimpleIdentifier)).element; | 1666 Element targetElement = ((target as SimpleIdentifier)).element; |
| 1667 if (targetElement is PrefixElement) { | 1667 if (targetElement is PrefixElement) { |
| 1668 String name10 = "${((target as SimpleIdentifier)).name}.${methodName2}
"; | 1668 String name3 = "${((target as SimpleIdentifier)).name}.${methodName2}"
; |
| 1669 Identifier functionName = new Identifier_8(name10); | 1669 Identifier functionName = new Identifier_8(name3); |
| 1670 element = _resolver.nameScope.lookup(functionName, _resolver.definingL
ibrary); | 1670 element = _resolver.nameScope.lookup(functionName, _resolver.definingL
ibrary); |
| 1671 } else { | 1671 } else { |
| 1672 return null; | 1672 return null; |
| 1673 } | 1673 } |
| 1674 } else { | 1674 } else { |
| 1675 return null; | 1675 return null; |
| 1676 } | 1676 } |
| 1677 } | 1677 } |
| 1678 ExecutableElement invokedMethod = null; | 1678 ExecutableElement invokedMethod = null; |
| 1679 if (element is PropertyAccessorElement) { | 1679 if (element is PropertyAccessorElement) { |
| 1680 PropertyAccessorElement getter = element as PropertyAccessorElement; | 1680 PropertyAccessorElement getter = element as PropertyAccessorElement; |
| 1681 FunctionType getterType = getter.type; | 1681 FunctionType getterType = getter.type; |
| 1682 if (getterType != null) { | 1682 if (getterType != null) { |
| 1683 Type2 returnType7 = getterType.returnType; | 1683 Type2 returnType4 = getterType.returnType; |
| 1684 if (!isExecutableType(returnType7)) { | 1684 if (!isExecutableType(returnType4)) { |
| 1685 _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION
, methodName2, [methodName2.name]); | 1685 _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION
, methodName2, [methodName2.name]); |
| 1686 } | 1686 } |
| 1687 } | 1687 } |
| 1688 recordResolution(methodName2, element); | 1688 recordResolution(methodName2, element); |
| 1689 return null; | 1689 return null; |
| 1690 } else if (element is ExecutableElement) { | 1690 } else if (element is ExecutableElement) { |
| 1691 invokedMethod = element as ExecutableElement; | 1691 invokedMethod = element as ExecutableElement; |
| 1692 } else { | 1692 } else { |
| 1693 if (element is PropertyInducingElement) { | 1693 if (element is PropertyInducingElement) { |
| 1694 PropertyAccessorElement getter3 = ((element as PropertyInducingElement))
.getter; | 1694 PropertyAccessorElement getter2 = ((element as PropertyInducingElement))
.getter; |
| 1695 FunctionType getterType = getter3.type; | 1695 FunctionType getterType = getter2.type; |
| 1696 if (getterType != null) { | 1696 if (getterType != null) { |
| 1697 Type2 returnType8 = getterType.returnType; | 1697 Type2 returnType5 = getterType.returnType; |
| 1698 if (!isExecutableType(returnType8)) { | 1698 if (!isExecutableType(returnType5)) { |
| 1699 _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTI
ON, methodName2, [methodName2.name]); | 1699 _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTI
ON, methodName2, [methodName2.name]); |
| 1700 } | 1700 } |
| 1701 } | 1701 } |
| 1702 recordResolution(methodName2, element); | 1702 recordResolution(methodName2, element); |
| 1703 return null; | 1703 return null; |
| 1704 } else if (element is VariableElement) { | 1704 } else if (element is VariableElement) { |
| 1705 Type2 variableType = _resolver.overrideManager.getType(element); | 1705 Type2 variableType = _resolver.overrideManager.getType(element); |
| 1706 if (variableType == null) { | 1706 if (variableType == null) { |
| 1707 variableType = ((element as VariableElement)).type; | 1707 variableType = ((element as VariableElement)).type; |
| 1708 } | 1708 } |
| 1709 if (!isExecutableType(variableType)) { | 1709 if (!isExecutableType(variableType)) { |
| 1710 _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION
, methodName2, [methodName2.name]); | 1710 _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION
, methodName2, [methodName2.name]); |
| 1711 } | 1711 } |
| 1712 recordResolution(methodName2, element); | 1712 recordResolution(methodName2, element); |
| 1713 return null; | 1713 return null; |
| 1714 } else { | 1714 } else { |
| 1715 if (target == null) { | 1715 if (target == null) { |
| 1716 ClassElement enclosingClass4 = _resolver.enclosingClass; | 1716 ClassElement enclosingClass3 = _resolver.enclosingClass; |
| 1717 if (enclosingClass4 == null) { | 1717 if (enclosingClass3 == null) { |
| 1718 _resolver.reportError(StaticTypeWarningCode.UNDEFINED_FUNCTION, meth
odName2, [methodName2.name]); | 1718 _resolver.reportError(StaticTypeWarningCode.UNDEFINED_FUNCTION, meth
odName2, [methodName2.name]); |
| 1719 } else if (element == null) { | 1719 } else if (element == null) { |
| 1720 _resolver.reportError(StaticTypeWarningCode.UNDEFINED_METHOD, method
Name2, [methodName2.name, enclosingClass4.name]); | 1720 _resolver.reportError(StaticTypeWarningCode.UNDEFINED_METHOD, method
Name2, [methodName2.name, enclosingClass3.name]); |
| 1721 } else { | 1721 } else { |
| 1722 _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTI
ON, methodName2, [methodName2.name]); | 1722 _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTI
ON, methodName2, [methodName2.name]); |
| 1723 } | 1723 } |
| 1724 } else { | 1724 } else { |
| 1725 Type2 targetType = getType(target); | 1725 Type2 targetType = getType(target); |
| 1726 String targetTypeName = targetType == null ? null : targetType.name; | 1726 String targetTypeName = targetType == null ? null : targetType.name; |
| 1727 if (targetTypeName == null) { | 1727 if (targetTypeName == null) { |
| 1728 _resolver.reportError(StaticTypeWarningCode.UNDEFINED_FUNCTION, meth
odName2, [methodName2.name]); | 1728 _resolver.reportError(StaticTypeWarningCode.UNDEFINED_FUNCTION, meth
odName2, [methodName2.name]); |
| 1729 } else { | 1729 } else { |
| 1730 _resolver.reportError(StaticTypeWarningCode.UNDEFINED_METHOD, method
Name2, [methodName2.name, targetTypeName]); | 1730 _resolver.reportError(StaticTypeWarningCode.UNDEFINED_METHOD, method
Name2, [methodName2.name, targetTypeName]); |
| 1731 } | 1731 } |
| 1732 } | 1732 } |
| 1733 return null; | 1733 return null; |
| 1734 } | 1734 } |
| 1735 } | 1735 } |
| 1736 recordResolution(methodName2, invokedMethod); | 1736 recordResolution(methodName2, invokedMethod); |
| 1737 resolveNamedArguments(node.argumentList, invokedMethod); | 1737 resolveNamedArguments(node.argumentList, invokedMethod); |
| 1738 return null; | 1738 return null; |
| 1739 } | 1739 } |
| 1740 Object visitPostfixExpression(PostfixExpression node) { | 1740 Object visitPostfixExpression(PostfixExpression node) { |
| 1741 sc.Token operator9 = node.operator; | 1741 sc.Token operator2 = node.operator; |
| 1742 Type2 operandType = getType(node.operand); | 1742 Type2 operandType = getType(node.operand); |
| 1743 if (operandType == null || operandType.isDynamic()) { | 1743 if (operandType == null || operandType.isDynamic()) { |
| 1744 return null; | 1744 return null; |
| 1745 } | 1745 } |
| 1746 String methodName; | 1746 String methodName; |
| 1747 if (identical(operator9.type, sc.TokenType.PLUS_PLUS)) { | 1747 if (identical(operator2.type, sc.TokenType.PLUS_PLUS)) { |
| 1748 methodName = sc.TokenType.PLUS.lexeme; | 1748 methodName = sc.TokenType.PLUS.lexeme; |
| 1749 } else { | 1749 } else { |
| 1750 methodName = sc.TokenType.MINUS.lexeme; | 1750 methodName = sc.TokenType.MINUS.lexeme; |
| 1751 } | 1751 } |
| 1752 MethodElement member = lookUpMethod(operandType, methodName); | 1752 MethodElement member = lookUpMethod(operandType, methodName); |
| 1753 if (member == null) { | 1753 if (member == null) { |
| 1754 _resolver.reportError3(StaticWarningCode.UNDEFINED_OPERATOR, operator9, [m
ethodName, operandType.name]); | 1754 _resolver.reportError3(StaticWarningCode.UNDEFINED_OPERATOR, operator2, [m
ethodName, operandType.name]); |
| 1755 } else { | 1755 } else { |
| 1756 node.element = member; | 1756 node.element = member; |
| 1757 } | 1757 } |
| 1758 return null; | 1758 return null; |
| 1759 } | 1759 } |
| 1760 Object visitPrefixedIdentifier(PrefixedIdentifier node) { | 1760 Object visitPrefixedIdentifier(PrefixedIdentifier node) { |
| 1761 SimpleIdentifier prefix6 = node.prefix; | 1761 SimpleIdentifier prefix2 = node.prefix; |
| 1762 SimpleIdentifier identifier14 = node.identifier; | 1762 SimpleIdentifier identifier2 = node.identifier; |
| 1763 Element prefixElement = prefix6.element; | 1763 Element prefixElement = prefix2.element; |
| 1764 if (prefixElement is PrefixElement) { | 1764 if (prefixElement is PrefixElement) { |
| 1765 Element element = _resolver.nameScope.lookup(node, _resolver.definingLibra
ry); | 1765 Element element = _resolver.nameScope.lookup(node, _resolver.definingLibra
ry); |
| 1766 if (element == null) { | 1766 if (element == null) { |
| 1767 return null; | 1767 return null; |
| 1768 } | 1768 } |
| 1769 recordResolution(identifier14, element); | 1769 recordResolution(identifier2, element); |
| 1770 return null; | 1770 return null; |
| 1771 } | 1771 } |
| 1772 if (prefixElement is ClassElement) { | 1772 if (prefixElement is ClassElement) { |
| 1773 Element memberElement; | 1773 Element memberElement; |
| 1774 if (node.identifier.inSetterContext()) { | 1774 if (node.identifier.inSetterContext()) { |
| 1775 memberElement = ((prefixElement as ClassElementImpl)).getSetter(identifi
er14.name); | 1775 memberElement = ((prefixElement as ClassElementImpl)).getSetter(identifi
er2.name); |
| 1776 } else { | 1776 } else { |
| 1777 memberElement = ((prefixElement as ClassElementImpl)).getGetter(identifi
er14.name); | 1777 memberElement = ((prefixElement as ClassElementImpl)).getGetter(identifi
er2.name); |
| 1778 } | 1778 } |
| 1779 if (memberElement == null) { | 1779 if (memberElement == null) { |
| 1780 MethodElement methodElement = lookUpMethod(((prefixElement as ClassEleme
nt)).type, identifier14.name); | 1780 MethodElement methodElement = lookUpMethod(((prefixElement as ClassEleme
nt)).type, identifier2.name); |
| 1781 if (methodElement != null) { | 1781 if (methodElement != null) { |
| 1782 recordResolution(identifier14, methodElement); | 1782 recordResolution(identifier2, methodElement); |
| 1783 return null; | 1783 return null; |
| 1784 } | 1784 } |
| 1785 } | 1785 } |
| 1786 if (memberElement == null) { | 1786 if (memberElement == null) { |
| 1787 reportGetterOrSetterNotFound(node, identifier14, prefixElement.name); | 1787 reportGetterOrSetterNotFound(node, identifier2, prefixElement.name); |
| 1788 } else { | 1788 } else { |
| 1789 recordResolution(identifier14, memberElement); | 1789 recordResolution(identifier2, memberElement); |
| 1790 } | 1790 } |
| 1791 return null; | 1791 return null; |
| 1792 } | 1792 } |
| 1793 Type2 variableType; | 1793 Type2 variableType; |
| 1794 if (prefixElement is PropertyAccessorElement) { | 1794 if (prefixElement is PropertyAccessorElement) { |
| 1795 PropertyAccessorElement accessor = prefixElement as PropertyAccessorElemen
t; | 1795 PropertyAccessorElement accessor = prefixElement as PropertyAccessorElemen
t; |
| 1796 FunctionType type15 = accessor.type; | 1796 FunctionType type2 = accessor.type; |
| 1797 if (type15 == null) { | 1797 if (type2 == null) { |
| 1798 return null; | 1798 return null; |
| 1799 } | 1799 } |
| 1800 if (accessor.isGetter()) { | 1800 if (accessor.isGetter()) { |
| 1801 variableType = type15.returnType; | 1801 variableType = type2.returnType; |
| 1802 } else { | 1802 } else { |
| 1803 variableType = type15.normalParameterTypes[0]; | 1803 variableType = type2.normalParameterTypes[0]; |
| 1804 } | 1804 } |
| 1805 if (variableType == null || variableType.isDynamic()) { | 1805 if (variableType == null || variableType.isDynamic()) { |
| 1806 return null; | 1806 return null; |
| 1807 } | 1807 } |
| 1808 } else if (prefixElement is VariableElement) { | 1808 } else if (prefixElement is VariableElement) { |
| 1809 variableType = _resolver.overrideManager.getType(prefixElement); | 1809 variableType = _resolver.overrideManager.getType(prefixElement); |
| 1810 if (variableType == null) { | 1810 if (variableType == null) { |
| 1811 variableType = ((prefixElement as VariableElement)).type; | 1811 variableType = ((prefixElement as VariableElement)).type; |
| 1812 } | 1812 } |
| 1813 if (variableType == null || variableType.isDynamic()) { | 1813 if (variableType == null || variableType.isDynamic()) { |
| 1814 return null; | 1814 return null; |
| 1815 } | 1815 } |
| 1816 } else { | 1816 } else { |
| 1817 return null; | 1817 return null; |
| 1818 } | 1818 } |
| 1819 PropertyAccessorElement memberElement = null; | 1819 PropertyAccessorElement memberElement = null; |
| 1820 if (node.identifier.inSetterContext()) { | 1820 if (node.identifier.inSetterContext()) { |
| 1821 memberElement = lookUpSetter(variableType, identifier14.name); | 1821 memberElement = lookUpSetter(variableType, identifier2.name); |
| 1822 } | 1822 } |
| 1823 if (memberElement == null && node.identifier.inGetterContext()) { | 1823 if (memberElement == null && node.identifier.inGetterContext()) { |
| 1824 memberElement = lookUpGetter(variableType, identifier14.name); | 1824 memberElement = lookUpGetter(variableType, identifier2.name); |
| 1825 } | 1825 } |
| 1826 if (memberElement == null) { | 1826 if (memberElement == null) { |
| 1827 MethodElement methodElement = lookUpMethod(variableType, identifier14.name
); | 1827 MethodElement methodElement = lookUpMethod(variableType, identifier2.name)
; |
| 1828 if (methodElement != null) { | 1828 if (methodElement != null) { |
| 1829 recordResolution(identifier14, methodElement); | 1829 recordResolution(identifier2, methodElement); |
| 1830 return null; | 1830 return null; |
| 1831 } | 1831 } |
| 1832 } | 1832 } |
| 1833 if (memberElement == null) { | 1833 if (memberElement == null) { |
| 1834 reportGetterOrSetterNotFound(node, identifier14, variableType.element.name
); | 1834 reportGetterOrSetterNotFound(node, identifier2, variableType.element.name)
; |
| 1835 } else { | 1835 } else { |
| 1836 recordResolution(identifier14, memberElement); | 1836 recordResolution(identifier2, memberElement); |
| 1837 } | 1837 } |
| 1838 return null; | 1838 return null; |
| 1839 } | 1839 } |
| 1840 Object visitPrefixExpression(PrefixExpression node) { | 1840 Object visitPrefixExpression(PrefixExpression node) { |
| 1841 sc.Token operator10 = node.operator; | 1841 sc.Token operator2 = node.operator; |
| 1842 sc.TokenType operatorType = operator10.type; | 1842 sc.TokenType operatorType = operator2.type; |
| 1843 if (operatorType.isUserDefinableOperator() || identical(operatorType, sc.Tok
enType.PLUS_PLUS) || identical(operatorType, sc.TokenType.MINUS_MINUS)) { | 1843 if (operatorType.isUserDefinableOperator() || identical(operatorType, sc.Tok
enType.PLUS_PLUS) || identical(operatorType, sc.TokenType.MINUS_MINUS)) { |
| 1844 Type2 operandType = getType(node.operand); | 1844 Type2 operandType = getType(node.operand); |
| 1845 if (operandType == null || operandType.isDynamic()) { | 1845 if (operandType == null || operandType.isDynamic()) { |
| 1846 return null; | 1846 return null; |
| 1847 } | 1847 } |
| 1848 String methodName; | 1848 String methodName; |
| 1849 if (identical(operatorType, sc.TokenType.PLUS_PLUS)) { | 1849 if (identical(operatorType, sc.TokenType.PLUS_PLUS)) { |
| 1850 methodName = sc.TokenType.PLUS.lexeme; | 1850 methodName = sc.TokenType.PLUS.lexeme; |
| 1851 } else if (identical(operatorType, sc.TokenType.MINUS_MINUS)) { | 1851 } else if (identical(operatorType, sc.TokenType.MINUS_MINUS)) { |
| 1852 methodName = sc.TokenType.MINUS.lexeme; | 1852 methodName = sc.TokenType.MINUS.lexeme; |
| 1853 } else if (identical(operatorType, sc.TokenType.MINUS)) { | 1853 } else if (identical(operatorType, sc.TokenType.MINUS)) { |
| 1854 methodName = "unary-"; | 1854 methodName = "unary-"; |
| 1855 } else { | 1855 } else { |
| 1856 methodName = operator10.lexeme; | 1856 methodName = operator2.lexeme; |
| 1857 } | 1857 } |
| 1858 MethodElement member = lookUpMethod(operandType, methodName); | 1858 MethodElement member = lookUpMethod(operandType, methodName); |
| 1859 if (member == null) { | 1859 if (member == null) { |
| 1860 _resolver.reportError3(StaticWarningCode.UNDEFINED_OPERATOR, operator10,
[methodName, operandType.name]); | 1860 _resolver.reportError3(StaticWarningCode.UNDEFINED_OPERATOR, operator2,
[methodName, operandType.name]); |
| 1861 } else { | 1861 } else { |
| 1862 node.element = member; | 1862 node.element = member; |
| 1863 } | 1863 } |
| 1864 } | 1864 } |
| 1865 return null; | 1865 return null; |
| 1866 } | 1866 } |
| 1867 Object visitPropertyAccess(PropertyAccess node) { | 1867 Object visitPropertyAccess(PropertyAccess node) { |
| 1868 Type2 targetType = getType(node.realTarget); | 1868 Type2 targetType = getType(node.realTarget); |
| 1869 if (targetType is! InterfaceType) { | 1869 if (targetType is! InterfaceType) { |
| 1870 return null; | 1870 return null; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1891 _resolver.reportError(StaticWarningCode.UNDEFINED_GETTER, identifier, [i
dentifier.name, targetType.name]); | 1891 _resolver.reportError(StaticWarningCode.UNDEFINED_GETTER, identifier, [i
dentifier.name, targetType.name]); |
| 1892 } else { | 1892 } else { |
| 1893 _resolver.reportError(StaticWarningCode.UNDEFINED_IDENTIFIER, identifier
, [identifier.name]); | 1893 _resolver.reportError(StaticWarningCode.UNDEFINED_IDENTIFIER, identifier
, [identifier.name]); |
| 1894 } | 1894 } |
| 1895 } else { | 1895 } else { |
| 1896 recordResolution(identifier, memberElement); | 1896 recordResolution(identifier, memberElement); |
| 1897 } | 1897 } |
| 1898 return null; | 1898 return null; |
| 1899 } | 1899 } |
| 1900 Object visitRedirectingConstructorInvocation(RedirectingConstructorInvocation
node) { | 1900 Object visitRedirectingConstructorInvocation(RedirectingConstructorInvocation
node) { |
| 1901 ClassElement enclosingClass5 = _resolver.enclosingClass; | 1901 ClassElement enclosingClass2 = _resolver.enclosingClass; |
| 1902 if (enclosingClass5 == null) { | 1902 if (enclosingClass2 == null) { |
| 1903 return null; | 1903 return null; |
| 1904 } | 1904 } |
| 1905 SimpleIdentifier name = node.constructorName; | 1905 SimpleIdentifier name = node.constructorName; |
| 1906 ConstructorElement element; | 1906 ConstructorElement element; |
| 1907 if (name == null) { | 1907 if (name == null) { |
| 1908 element = enclosingClass5.unnamedConstructor; | 1908 element = enclosingClass2.unnamedConstructor; |
| 1909 } else { | 1909 } else { |
| 1910 element = enclosingClass5.getNamedConstructor(name.name); | 1910 element = enclosingClass2.getNamedConstructor(name.name); |
| 1911 } | 1911 } |
| 1912 if (element == null) { | 1912 if (element == null) { |
| 1913 return null; | 1913 return null; |
| 1914 } | 1914 } |
| 1915 if (name != null) { | 1915 if (name != null) { |
| 1916 recordResolution(name, element); | 1916 recordResolution(name, element); |
| 1917 } | 1917 } |
| 1918 node.element = element; | 1918 node.element = element; |
| 1919 resolveNamedArguments(node.argumentList, element); | 1919 resolveNamedArguments(node.argumentList, element); |
| 1920 return null; | 1920 return null; |
| 1921 } | 1921 } |
| 1922 Object visitSimpleIdentifier(SimpleIdentifier node) { | 1922 Object visitSimpleIdentifier(SimpleIdentifier node) { |
| 1923 if (node.element != null) { | 1923 if (node.element != null) { |
| 1924 return null; | 1924 return null; |
| 1925 } | 1925 } |
| 1926 Element element = _resolver.nameScope.lookup(node, _resolver.definingLibrary
); | 1926 Element element = _resolver.nameScope.lookup(node, _resolver.definingLibrary
); |
| 1927 if (element is PropertyAccessorElement && node.inSetterContext()) { | 1927 if (element is PropertyAccessorElement && node.inSetterContext()) { |
| 1928 PropertyInducingElement variable5 = ((element as PropertyAccessorElement))
.variable; | 1928 PropertyInducingElement variable2 = ((element as PropertyAccessorElement))
.variable; |
| 1929 if (variable5 != null) { | 1929 if (variable2 != null) { |
| 1930 PropertyAccessorElement setter3 = variable5.setter; | 1930 PropertyAccessorElement setter2 = variable2.setter; |
| 1931 if (setter3 != null) { | 1931 if (setter2 != null) { |
| 1932 element = setter3; | 1932 element = setter2; |
| 1933 } | 1933 } |
| 1934 } | 1934 } |
| 1935 } | 1935 } |
| 1936 ClassElement enclosingClass6 = _resolver.enclosingClass; | 1936 ClassElement enclosingClass2 = _resolver.enclosingClass; |
| 1937 if (element == null && enclosingClass6 != null) { | 1937 if (element == null && enclosingClass2 != null) { |
| 1938 InterfaceType enclosingType = enclosingClass6.type; | 1938 InterfaceType enclosingType = enclosingClass2.type; |
| 1939 if (element == null && node.inSetterContext()) { | 1939 if (element == null && node.inSetterContext()) { |
| 1940 element = lookUpSetter(enclosingType, node.name); | 1940 element = lookUpSetter(enclosingType, node.name); |
| 1941 } | 1941 } |
| 1942 if (element == null && node.inGetterContext()) { | 1942 if (element == null && node.inGetterContext()) { |
| 1943 element = lookUpGetter(enclosingType, node.name); | 1943 element = lookUpGetter(enclosingType, node.name); |
| 1944 } | 1944 } |
| 1945 if (element == null) { | 1945 if (element == null) { |
| 1946 element = lookUpMethod(enclosingType, node.name); | 1946 element = lookUpMethod(enclosingType, node.name); |
| 1947 } | 1947 } |
| 1948 } | 1948 } |
| 1949 if (element == null) { | 1949 if (element == null) { |
| 1950 _resolver.reportError(StaticWarningCode.UNDEFINED_IDENTIFIER, node, [node.
name]); | 1950 _resolver.reportError(StaticWarningCode.UNDEFINED_IDENTIFIER, node, [node.
name]); |
| 1951 } | 1951 } |
| 1952 recordResolution(node, element); | 1952 recordResolution(node, element); |
| 1953 return null; | 1953 return null; |
| 1954 } | 1954 } |
| 1955 Object visitSuperConstructorInvocation(SuperConstructorInvocation node) { | 1955 Object visitSuperConstructorInvocation(SuperConstructorInvocation node) { |
| 1956 ClassElement enclosingClass7 = _resolver.enclosingClass; | 1956 ClassElement enclosingClass2 = _resolver.enclosingClass; |
| 1957 if (enclosingClass7 == null) { | 1957 if (enclosingClass2 == null) { |
| 1958 return null; | 1958 return null; |
| 1959 } | 1959 } |
| 1960 ClassElement superclass = getSuperclass(enclosingClass7); | 1960 ClassElement superclass = getSuperclass(enclosingClass2); |
| 1961 if (superclass == null) { | 1961 if (superclass == null) { |
| 1962 return null; | 1962 return null; |
| 1963 } | 1963 } |
| 1964 SimpleIdentifier name = node.constructorName; | 1964 SimpleIdentifier name = node.constructorName; |
| 1965 ConstructorElement element; | 1965 ConstructorElement element; |
| 1966 if (name == null) { | 1966 if (name == null) { |
| 1967 element = superclass.unnamedConstructor; | 1967 element = superclass.unnamedConstructor; |
| 1968 } else { | 1968 } else { |
| 1969 element = superclass.getNamedConstructor(name.name); | 1969 element = superclass.getNamedConstructor(name.name); |
| 1970 } | 1970 } |
| 1971 if (element == null) { | 1971 if (element == null) { |
| 1972 return null; | 1972 return null; |
| 1973 } | 1973 } |
| 1974 if (name != null) { | 1974 if (name != null) { |
| 1975 recordResolution(name, element); | 1975 recordResolution(name, element); |
| 1976 } | 1976 } |
| 1977 node.element = element; | 1977 node.element = element; |
| 1978 resolveNamedArguments(node.argumentList, element); | 1978 resolveNamedArguments(node.argumentList, element); |
| 1979 return null; | 1979 return null; |
| 1980 } | 1980 } |
| 1981 Object visitTypeParameter(TypeParameter node) { | 1981 Object visitTypeParameter(TypeParameter node) { |
| 1982 TypeName bound3 = node.bound; | 1982 TypeName bound2 = node.bound; |
| 1983 if (bound3 != null) { | 1983 if (bound2 != null) { |
| 1984 TypeVariableElementImpl variable = node.name.element as TypeVariableElemen
tImpl; | 1984 TypeVariableElementImpl variable = node.name.element as TypeVariableElemen
tImpl; |
| 1985 if (variable != null) { | 1985 if (variable != null) { |
| 1986 variable.bound = bound3.type; | 1986 variable.bound = bound2.type; |
| 1987 } | 1987 } |
| 1988 } | 1988 } |
| 1989 return null; | 1989 return null; |
| 1990 } | 1990 } |
| 1991 /** | 1991 /** |
| 1992 * Search through the array of parameters for a parameter whose name matches t
he given name. | 1992 * Search through the array of parameters for a parameter whose name matches t
he given name. |
| 1993 * Return the parameter with the given name, or {@code null} if there is no su
ch parameter. | 1993 * Return the parameter with the given name, or {@code null} if there is no su
ch parameter. |
| 1994 * @param parameters the parameters being searched | 1994 * @param parameters the parameters being searched |
| 1995 * @param name the name being searched for | 1995 * @param name the name being searched for |
| 1996 * @return the parameter with the given name | 1996 * @return the parameter with the given name |
| 1997 */ | 1997 */ |
| 1998 ParameterElement findNamedParameter(List<ParameterElement> parameters, String
name31) { | 1998 ParameterElement findNamedParameter(List<ParameterElement> parameters, String
name2) { |
| 1999 for (ParameterElement parameter in parameters) { | 1999 for (ParameterElement parameter in parameters) { |
| 2000 if (identical(parameter.parameterKind, ParameterKind.NAMED)) { | 2000 if (identical(parameter.parameterKind, ParameterKind.NAMED)) { |
| 2001 String parameteName = parameter.name; | 2001 String parameteName = parameter.name; |
| 2002 if (parameteName != null && parameteName == name31) { | 2002 if (parameteName != null && parameteName == name2) { |
| 2003 return parameter; | 2003 return parameter; |
| 2004 } | 2004 } |
| 2005 } | 2005 } |
| 2006 } | 2006 } |
| 2007 return null; | 2007 return null; |
| 2008 } | 2008 } |
| 2009 /** | 2009 /** |
| 2010 * Return the element representing the superclass of the given class. | 2010 * Return the element representing the superclass of the given class. |
| 2011 * @param targetClass the class whose superclass is to be returned | 2011 * @param targetClass the class whose superclass is to be returned |
| 2012 * @return the element representing the superclass of the given class | 2012 * @return the element representing the superclass of the given class |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2082 PropertyAccessorElement getter = targetType.getGetter(getterName); | 2082 PropertyAccessorElement getter = targetType.getGetter(getterName); |
| 2083 if (getter != null) { | 2083 if (getter != null) { |
| 2084 return getter; | 2084 return getter; |
| 2085 } | 2085 } |
| 2086 for (InterfaceType interfaceType in targetType.interfaces) { | 2086 for (InterfaceType interfaceType in targetType.interfaces) { |
| 2087 getter = lookUpGetterInInterfaces(interfaceType, getterName, visitedInterf
aces); | 2087 getter = lookUpGetterInInterfaces(interfaceType, getterName, visitedInterf
aces); |
| 2088 if (getter != null) { | 2088 if (getter != null) { |
| 2089 return getter; | 2089 return getter; |
| 2090 } | 2090 } |
| 2091 } | 2091 } |
| 2092 InterfaceType superclass3 = targetType.superclass; | 2092 InterfaceType superclass2 = targetType.superclass; |
| 2093 if (superclass3 == null) { | 2093 if (superclass2 == null) { |
| 2094 return null; | 2094 return null; |
| 2095 } | 2095 } |
| 2096 return lookUpGetterInInterfaces(superclass3, getterName, visitedInterfaces); | 2096 return lookUpGetterInInterfaces(superclass2, getterName, visitedInterfaces); |
| 2097 } | 2097 } |
| 2098 /** | 2098 /** |
| 2099 * Find the element corresponding to the given label node in the current label
scope. | 2099 * Find the element corresponding to the given label node in the current label
scope. |
| 2100 * @param parentNode the node containing the given label | 2100 * @param parentNode the node containing the given label |
| 2101 * @param labelNode the node representing the label being looked up | 2101 * @param labelNode the node representing the label being looked up |
| 2102 * @return the element corresponding to the given label node in the current sc
ope | 2102 * @return the element corresponding to the given label node in the current sc
ope |
| 2103 */ | 2103 */ |
| 2104 LabelElementImpl lookupLabel(ASTNode parentNode, SimpleIdentifier labelNode) { | 2104 LabelElementImpl lookupLabel(ASTNode parentNode, SimpleIdentifier labelNode) { |
| 2105 LabelScope labelScope2 = _resolver.labelScope; | 2105 LabelScope labelScope2 = _resolver.labelScope; |
| 2106 LabelElementImpl labelElement = null; | 2106 LabelElementImpl labelElement = null; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2170 MethodElement method = targetType.getMethod(methodName); | 2170 MethodElement method = targetType.getMethod(methodName); |
| 2171 if (method != null) { | 2171 if (method != null) { |
| 2172 return method; | 2172 return method; |
| 2173 } | 2173 } |
| 2174 for (InterfaceType interfaceType in targetType.interfaces) { | 2174 for (InterfaceType interfaceType in targetType.interfaces) { |
| 2175 method = lookUpMethodInInterfaces(interfaceType, methodName, visitedInterf
aces); | 2175 method = lookUpMethodInInterfaces(interfaceType, methodName, visitedInterf
aces); |
| 2176 if (method != null) { | 2176 if (method != null) { |
| 2177 return method; | 2177 return method; |
| 2178 } | 2178 } |
| 2179 } | 2179 } |
| 2180 InterfaceType superclass4 = targetType.superclass; | 2180 InterfaceType superclass2 = targetType.superclass; |
| 2181 if (superclass4 == null) { | 2181 if (superclass2 == null) { |
| 2182 return null; | 2182 return null; |
| 2183 } | 2183 } |
| 2184 return lookUpMethodInInterfaces(superclass4, methodName, visitedInterfaces); | 2184 return lookUpMethodInInterfaces(superclass2, methodName, visitedInterfaces); |
| 2185 } | 2185 } |
| 2186 /** | 2186 /** |
| 2187 * Look up the setter with the given name in the given type. Return the elemen
t representing the | 2187 * Look up the setter with the given name in the given type. Return the elemen
t representing the |
| 2188 * setter that was found, or {@code null} if there is no setter with the given
name. | 2188 * setter that was found, or {@code null} if there is no setter with the given
name. |
| 2189 * @param type the type in which the setter is defined | 2189 * @param type the type in which the setter is defined |
| 2190 * @param setterName the name of the setter being looked up | 2190 * @param setterName the name of the setter being looked up |
| 2191 * @return the element representing the setter that was found | 2191 * @return the element representing the setter that was found |
| 2192 */ | 2192 */ |
| 2193 PropertyAccessorElement lookUpSetter(Type2 type, String setterName) { | 2193 PropertyAccessorElement lookUpSetter(Type2 type, String setterName) { |
| 2194 type = resolveTypeVariable(type); | 2194 type = resolveTypeVariable(type); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2220 PropertyAccessorElement setter = targetType.getGetter(setterName); | 2220 PropertyAccessorElement setter = targetType.getGetter(setterName); |
| 2221 if (setter != null) { | 2221 if (setter != null) { |
| 2222 return setter; | 2222 return setter; |
| 2223 } | 2223 } |
| 2224 for (InterfaceType interfaceType in targetType.interfaces) { | 2224 for (InterfaceType interfaceType in targetType.interfaces) { |
| 2225 setter = lookUpSetterInInterfaces(interfaceType, setterName, visitedInterf
aces); | 2225 setter = lookUpSetterInInterfaces(interfaceType, setterName, visitedInterf
aces); |
| 2226 if (setter != null) { | 2226 if (setter != null) { |
| 2227 return setter; | 2227 return setter; |
| 2228 } | 2228 } |
| 2229 } | 2229 } |
| 2230 InterfaceType superclass5 = targetType.superclass; | 2230 InterfaceType superclass2 = targetType.superclass; |
| 2231 if (superclass5 == null) { | 2231 if (superclass2 == null) { |
| 2232 return null; | 2232 return null; |
| 2233 } | 2233 } |
| 2234 return lookUpSetterInInterfaces(superclass5, setterName, visitedInterfaces); | 2234 return lookUpSetterInInterfaces(superclass2, setterName, visitedInterfaces); |
| 2235 } | 2235 } |
| 2236 /** | 2236 /** |
| 2237 * Return the binary operator that is invoked by the given compound assignment
operator. | 2237 * Return the binary operator that is invoked by the given compound assignment
operator. |
| 2238 * @param operator the assignment operator being mapped | 2238 * @param operator the assignment operator being mapped |
| 2239 * @return the binary operator that invoked by the given assignment operator | 2239 * @return the binary operator that invoked by the given assignment operator |
| 2240 */ | 2240 */ |
| 2241 sc.TokenType operatorFromCompoundAssignment(sc.TokenType operator) { | 2241 sc.TokenType operatorFromCompoundAssignment(sc.TokenType operator) { |
| 2242 while (true) { | 2242 while (true) { |
| 2243 if (operator == sc.TokenType.AMPERSAND_EQ) { | 2243 if (operator == sc.TokenType.AMPERSAND_EQ) { |
| 2244 return sc.TokenType.AMPERSAND; | 2244 return sc.TokenType.AMPERSAND; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2266 break; | 2266 break; |
| 2267 } | 2267 } |
| 2268 AnalysisEngine.instance.logger.logError("Failed to map ${operator.lexeme} to
it's corresponding operator"); | 2268 AnalysisEngine.instance.logger.logError("Failed to map ${operator.lexeme} to
it's corresponding operator"); |
| 2269 return operator; | 2269 return operator; |
| 2270 } | 2270 } |
| 2271 /** | 2271 /** |
| 2272 * Record the fact that the given AST node was resolved to the given element. | 2272 * Record the fact that the given AST node was resolved to the given element. |
| 2273 * @param node the AST node that was resolved | 2273 * @param node the AST node that was resolved |
| 2274 * @param element the element to which the AST node was resolved | 2274 * @param element the element to which the AST node was resolved |
| 2275 */ | 2275 */ |
| 2276 void recordResolution(SimpleIdentifier node, Element element68) { | 2276 void recordResolution(SimpleIdentifier node, Element element2) { |
| 2277 if (element68 != null) { | 2277 if (element2 != null) { |
| 2278 node.element = element68; | 2278 node.element = element2; |
| 2279 } | 2279 } |
| 2280 } | 2280 } |
| 2281 /** | 2281 /** |
| 2282 * Report the {@link StaticTypeWarningCode}s <code>UNDEFINED_SETTER</code> and | 2282 * Report the {@link StaticTypeWarningCode}s <code>UNDEFINED_SETTER</code> and |
| 2283 * <code>UNDEFINED_GETTER</code>. | 2283 * <code>UNDEFINED_GETTER</code>. |
| 2284 * @param node the prefixed identifier that gives the context to determine if
the error on the | 2284 * @param node the prefixed identifier that gives the context to determine if
the error on the |
| 2285 * undefined identifier is a getter or a setter | 2285 * undefined identifier is a getter or a setter |
| 2286 * @param identifier the identifier in the passed prefix identifier | 2286 * @param identifier the identifier in the passed prefix identifier |
| 2287 * @param typeName the name of the type of the left hand side of the passed pr
efixed identifier | 2287 * @param typeName the name of the type of the left hand side of the passed pr
efixed identifier |
| 2288 */ | 2288 */ |
| 2289 void reportGetterOrSetterNotFound(PrefixedIdentifier node, SimpleIdentifier id
entifier32, String typeName) { | 2289 void reportGetterOrSetterNotFound(PrefixedIdentifier node, SimpleIdentifier id
entifier2, String typeName) { |
| 2290 bool isSetterContext = node.identifier.inSetterContext(); | 2290 bool isSetterContext = node.identifier.inSetterContext(); |
| 2291 ErrorCode errorCode = isSetterContext ? StaticTypeWarningCode.UNDEFINED_SETT
ER : StaticTypeWarningCode.UNDEFINED_GETTER; | 2291 ErrorCode errorCode = isSetterContext ? StaticTypeWarningCode.UNDEFINED_SETT
ER : StaticTypeWarningCode.UNDEFINED_GETTER; |
| 2292 _resolver.reportError(errorCode, identifier32, [identifier32.name, typeName]
); | 2292 _resolver.reportError(errorCode, identifier2, [identifier2.name, typeName]); |
| 2293 } | 2293 } |
| 2294 /** | 2294 /** |
| 2295 * Resolve the names in the given combinators in the scope of the given librar
y. | 2295 * Resolve the names in the given combinators in the scope of the given librar
y. |
| 2296 * @param library the library that defines the names | 2296 * @param library the library that defines the names |
| 2297 * @param combinators the combinators containing the names to be resolved | 2297 * @param combinators the combinators containing the names to be resolved |
| 2298 */ | 2298 */ |
| 2299 void resolveCombinators(LibraryElement library, NodeList<Combinator> combinato
rs) { | 2299 void resolveCombinators(LibraryElement library, NodeList<Combinator> combinato
rs) { |
| 2300 if (library == null) { | 2300 if (library == null) { |
| 2301 return; | 2301 return; |
| 2302 } | 2302 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2320 * Resolve the names associated with any named arguments to the parameter elem
ents named by the | 2320 * Resolve the names associated with any named arguments to the parameter elem
ents named by the |
| 2321 * argument. | 2321 * argument. |
| 2322 * @param argumentList the arguments to be resolved | 2322 * @param argumentList the arguments to be resolved |
| 2323 * @param invokedMethod the method or function defining the parameters to whic
h the named | 2323 * @param invokedMethod the method or function defining the parameters to whic
h the named |
| 2324 * arguments are to be resolved | 2324 * arguments are to be resolved |
| 2325 */ | 2325 */ |
| 2326 void resolveNamedArguments(ArgumentList argumentList, ExecutableElement invoke
dMethod) { | 2326 void resolveNamedArguments(ArgumentList argumentList, ExecutableElement invoke
dMethod) { |
| 2327 if (invokedMethod == null) { | 2327 if (invokedMethod == null) { |
| 2328 return; | 2328 return; |
| 2329 } | 2329 } |
| 2330 List<ParameterElement> parameters13 = invokedMethod.parameters; | 2330 List<ParameterElement> parameters2 = invokedMethod.parameters; |
| 2331 for (Expression argument in argumentList.arguments) { | 2331 for (Expression argument in argumentList.arguments) { |
| 2332 if (argument is NamedExpression) { | 2332 if (argument is NamedExpression) { |
| 2333 SimpleIdentifier name18 = ((argument as NamedExpression)).name.label; | 2333 SimpleIdentifier name2 = ((argument as NamedExpression)).name.label; |
| 2334 ParameterElement parameter = findNamedParameter(parameters13, name18.nam
e); | 2334 ParameterElement parameter = findNamedParameter(parameters2, name2.name)
; |
| 2335 if (parameter != null) { | 2335 if (parameter != null) { |
| 2336 recordResolution(name18, parameter); | 2336 recordResolution(name2, parameter); |
| 2337 } | 2337 } |
| 2338 } | 2338 } |
| 2339 } | 2339 } |
| 2340 } | 2340 } |
| 2341 /** | 2341 /** |
| 2342 * If the given type is a type variable, resolve it to the type that should be
used when looking | 2342 * If the given type is a type variable, resolve it to the type that should be
used when looking |
| 2343 * up members. Otherwise, return the original type. | 2343 * up members. Otherwise, return the original type. |
| 2344 * @param type the type that is to be resolved if it is a type variable | 2344 * @param type the type that is to be resolved if it is a type variable |
| 2345 * @return the type that should be used in place of the argument if it is a ty
pe variable, or the | 2345 * @return the type that should be used in place of the argument if it is a ty
pe variable, or the |
| 2346 * original argument if it isn't a type variable | 2346 * original argument if it isn't a type variable |
| 2347 */ | 2347 */ |
| 2348 Type2 resolveTypeVariable(Type2 type) { | 2348 Type2 resolveTypeVariable(Type2 type) { |
| 2349 if (type is TypeVariableType) { | 2349 if (type is TypeVariableType) { |
| 2350 Type2 bound4 = ((type as TypeVariableType)).element.bound; | 2350 Type2 bound2 = ((type as TypeVariableType)).element.bound; |
| 2351 if (bound4 == null) { | 2351 if (bound2 == null) { |
| 2352 return _resolver.typeProvider.objectType; | 2352 return _resolver.typeProvider.objectType; |
| 2353 } | 2353 } |
| 2354 return bound4; | 2354 return bound2; |
| 2355 } | 2355 } |
| 2356 return type; | 2356 return type; |
| 2357 } | 2357 } |
| 2358 } | 2358 } |
| 2359 class Identifier_8 extends Identifier { | 2359 class Identifier_8 extends Identifier { |
| 2360 String name10; | 2360 String name3; |
| 2361 Identifier_8(this.name10) : super(); | 2361 Identifier_8(this.name3) : super(); |
| 2362 accept(ASTVisitor visitor) => null; | 2362 accept(ASTVisitor visitor) => null; |
| 2363 sc.Token get beginToken => null; | 2363 sc.Token get beginToken => null; |
| 2364 Element get element => null; | 2364 Element get element => null; |
| 2365 sc.Token get endToken => null; | 2365 sc.Token get endToken => null; |
| 2366 String get name => name10; | 2366 String get name => name3; |
| 2367 void visitChildren(ASTVisitor<Object> visitor) { | 2367 void visitChildren(ASTVisitor<Object> visitor) { |
| 2368 } | 2368 } |
| 2369 } | 2369 } |
| 2370 /** | 2370 /** |
| 2371 * Instances of the class {@code Library} represent the data about a single libr
ary during the | 2371 * Instances of the class {@code Library} represent the data about a single libr
ary during the |
| 2372 * resolution of some (possibly different) library. They are not intended to be
used except during | 2372 * resolution of some (possibly different) library. They are not intended to be
used except during |
| 2373 * the resolution process. | 2373 * the resolution process. |
| 2374 * @coverage dart.engine.resolver | 2374 * @coverage dart.engine.resolver |
| 2375 */ | 2375 */ |
| 2376 class Library { | 2376 class Library { |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2644 } | 2644 } |
| 2645 /** | 2645 /** |
| 2646 * Build the library element for the given library. | 2646 * Build the library element for the given library. |
| 2647 * @param library the library for which an element model is to be built | 2647 * @param library the library for which an element model is to be built |
| 2648 * @return the library element that was built | 2648 * @return the library element that was built |
| 2649 * @throws AnalysisException if the analysis could not be performed | 2649 * @throws AnalysisException if the analysis could not be performed |
| 2650 */ | 2650 */ |
| 2651 LibraryElementImpl buildLibrary(Library library) { | 2651 LibraryElementImpl buildLibrary(Library library) { |
| 2652 CompilationUnitBuilder builder = new CompilationUnitBuilder(); | 2652 CompilationUnitBuilder builder = new CompilationUnitBuilder(); |
| 2653 Source librarySource2 = library.librarySource; | 2653 Source librarySource2 = library.librarySource; |
| 2654 CompilationUnit definingCompilationUnit3 = library.definingCompilationUnit; | 2654 CompilationUnit definingCompilationUnit2 = library.definingCompilationUnit; |
| 2655 CompilationUnitElementImpl definingCompilationUnitElement = builder.buildCom
pilationUnit(librarySource2, definingCompilationUnit3); | 2655 CompilationUnitElementImpl definingCompilationUnitElement = builder.buildCom
pilationUnit(librarySource2, definingCompilationUnit2); |
| 2656 NodeList<Directive> directives3 = definingCompilationUnit3.directives; | 2656 NodeList<Directive> directives2 = definingCompilationUnit2.directives; |
| 2657 LibraryIdentifier libraryNameNode = null; | 2657 LibraryIdentifier libraryNameNode = null; |
| 2658 bool hasPartDirective = false; | 2658 bool hasPartDirective = false; |
| 2659 FunctionElement entryPoint = findEntryPoint(definingCompilationUnitElement); | 2659 FunctionElement entryPoint = findEntryPoint(definingCompilationUnitElement); |
| 2660 List<Directive> directivesToResolve = new List<Directive>(); | 2660 List<Directive> directivesToResolve = new List<Directive>(); |
| 2661 List<CompilationUnitElementImpl> sourcedCompilationUnits = new List<Compilat
ionUnitElementImpl>(); | 2661 List<CompilationUnitElementImpl> sourcedCompilationUnits = new List<Compilat
ionUnitElementImpl>(); |
| 2662 for (Directive directive in directives3) { | 2662 for (Directive directive in directives2) { |
| 2663 if (directive is LibraryDirective) { | 2663 if (directive is LibraryDirective) { |
| 2664 if (libraryNameNode == null) { | 2664 if (libraryNameNode == null) { |
| 2665 libraryNameNode = ((directive as LibraryDirective)).name; | 2665 libraryNameNode = ((directive as LibraryDirective)).name; |
| 2666 directivesToResolve.add(directive); | 2666 directivesToResolve.add(directive); |
| 2667 } | 2667 } |
| 2668 } else if (directive is PartDirective) { | 2668 } else if (directive is PartDirective) { |
| 2669 hasPartDirective = true; | 2669 hasPartDirective = true; |
| 2670 StringLiteral partUri = ((directive as PartDirective)).uri; | 2670 StringLiteral partUri = ((directive as PartDirective)).uri; |
| 2671 Source partSource = library.getSource(partUri); | 2671 Source partSource = library.getSource(partUri); |
| 2672 if (partSource != null && partSource.exists()) { | 2672 if (partSource != null && partSource.exists()) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2722 * @param directivesToResolve a list of directives that should be resolved to
the library being | 2722 * @param directivesToResolve a list of directives that should be resolved to
the library being |
| 2723 * built | 2723 * built |
| 2724 * @return the name of the library that the given part is declared to be a par
t of | 2724 * @return the name of the library that the given part is declared to be a par
t of |
| 2725 */ | 2725 */ |
| 2726 String getPartLibraryName(Library library, Source partSource, List<Directive>
directivesToResolve) { | 2726 String getPartLibraryName(Library library, Source partSource, List<Directive>
directivesToResolve) { |
| 2727 try { | 2727 try { |
| 2728 CompilationUnit partUnit = library.getAST(partSource); | 2728 CompilationUnit partUnit = library.getAST(partSource); |
| 2729 for (Directive directive in partUnit.directives) { | 2729 for (Directive directive in partUnit.directives) { |
| 2730 if (directive is PartOfDirective) { | 2730 if (directive is PartOfDirective) { |
| 2731 directivesToResolve.add(directive); | 2731 directivesToResolve.add(directive); |
| 2732 LibraryIdentifier libraryName3 = ((directive as PartOfDirective)).libr
aryName; | 2732 LibraryIdentifier libraryName2 = ((directive as PartOfDirective)).libr
aryName; |
| 2733 if (libraryName3 != null) { | 2733 if (libraryName2 != null) { |
| 2734 return libraryName3.name; | 2734 return libraryName2.name; |
| 2735 } | 2735 } |
| 2736 } | 2736 } |
| 2737 } | 2737 } |
| 2738 } on AnalysisException catch (exception) { | 2738 } on AnalysisException catch (exception) { |
| 2739 } | 2739 } |
| 2740 return null; | 2740 return null; |
| 2741 } | 2741 } |
| 2742 } | 2742 } |
| 2743 /** | 2743 /** |
| 2744 * Instances of the class {@code LibraryResolver} are used to resolve one or mor
e mutually dependent | 2744 * Instances of the class {@code LibraryResolver} are used to resolve one or mor
e mutually dependent |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2989 if (exportedLibrary != null) { | 2989 if (exportedLibrary != null) { |
| 2990 LibraryElement exportedLibraryElement = exportedLibrary.libraryEleme
nt; | 2990 LibraryElement exportedLibraryElement = exportedLibrary.libraryEleme
nt; |
| 2991 if (exportedLibraryElement != null) { | 2991 if (exportedLibraryElement != null) { |
| 2992 exportElement.exportedLibrary = exportedLibraryElement; | 2992 exportElement.exportedLibrary = exportedLibraryElement; |
| 2993 } | 2993 } |
| 2994 directive.element = exportElement; | 2994 directive.element = exportElement; |
| 2995 exports.add(exportElement); | 2995 exports.add(exportElement); |
| 2996 } | 2996 } |
| 2997 } | 2997 } |
| 2998 } | 2998 } |
| 2999 Source librarySource3 = library.librarySource; | 2999 Source librarySource2 = library.librarySource; |
| 3000 if (!library.explicitlyImportsCore && _coreLibrarySource != librarySource3
) { | 3000 if (!library.explicitlyImportsCore && _coreLibrarySource != librarySource2
) { |
| 3001 ImportElementImpl importElement = new ImportElementImpl(); | 3001 ImportElementImpl importElement = new ImportElementImpl(); |
| 3002 importElement.importedLibrary = _coreLibrary.libraryElement; | 3002 importElement.importedLibrary = _coreLibrary.libraryElement; |
| 3003 importElement.synthetic = true; | 3003 importElement.synthetic = true; |
| 3004 imports.add(importElement); | 3004 imports.add(importElement); |
| 3005 } | 3005 } |
| 3006 LibraryElementImpl libraryElement3 = library.libraryElement; | 3006 LibraryElementImpl libraryElement2 = library.libraryElement; |
| 3007 libraryElement3.imports = new List.from(imports); | 3007 libraryElement2.imports = new List.from(imports); |
| 3008 libraryElement3.exports = new List.from(exports); | 3008 libraryElement2.exports = new List.from(exports); |
| 3009 } | 3009 } |
| 3010 } | 3010 } |
| 3011 /** | 3011 /** |
| 3012 * Build element models for all of the libraries in the current cycle. | 3012 * Build element models for all of the libraries in the current cycle. |
| 3013 * @throws AnalysisException if any of the element models cannot be built | 3013 * @throws AnalysisException if any of the element models cannot be built |
| 3014 */ | 3014 */ |
| 3015 void buildElementModels() { | 3015 void buildElementModels() { |
| 3016 for (Library library in _librariesInCycles) { | 3016 for (Library library in _librariesInCycles) { |
| 3017 LibraryElementBuilder builder = new LibraryElementBuilder(this); | 3017 LibraryElementBuilder builder = new LibraryElementBuilder(this); |
| 3018 LibraryElementImpl libraryElement = builder.buildLibrary(library); | 3018 LibraryElementImpl libraryElement = builder.buildLibrary(library); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3156 } | 3156 } |
| 3157 _libraryMap[librarySource] = library; | 3157 _libraryMap[librarySource] = library; |
| 3158 return library; | 3158 return library; |
| 3159 } | 3159 } |
| 3160 /** | 3160 /** |
| 3161 * Return {@code true} if and only if the passed {@link CompilationUnit} has a
part-of directive. | 3161 * Return {@code true} if and only if the passed {@link CompilationUnit} has a
part-of directive. |
| 3162 * @param node the {@link CompilationUnit} to test | 3162 * @param node the {@link CompilationUnit} to test |
| 3163 * @return {@code true} if and only if the passed {@link CompilationUnit} has
a part-of directive | 3163 * @return {@code true} if and only if the passed {@link CompilationUnit} has
a part-of directive |
| 3164 */ | 3164 */ |
| 3165 bool doesCompilationUnitHavePartOfDirective(CompilationUnit node) { | 3165 bool doesCompilationUnitHavePartOfDirective(CompilationUnit node) { |
| 3166 NodeList<Directive> directives4 = node.directives; | 3166 NodeList<Directive> directives2 = node.directives; |
| 3167 for (Directive directive in directives4) { | 3167 for (Directive directive in directives2) { |
| 3168 if (directive is PartOfDirective) { | 3168 if (directive is PartOfDirective) { |
| 3169 return true; | 3169 return true; |
| 3170 } | 3170 } |
| 3171 } | 3171 } |
| 3172 return false; | 3172 return false; |
| 3173 } | 3173 } |
| 3174 /** | 3174 /** |
| 3175 * Return an array containing the lexical identifiers associated with the node
s in the given list. | 3175 * Return an array containing the lexical identifiers associated with the node
s in the given list. |
| 3176 * @param names the AST nodes representing the identifiers | 3176 * @param names the AST nodes representing the identifiers |
| 3177 * @return the lexical identifiers associated with the nodes in the list | 3177 * @return the lexical identifiers associated with the nodes in the list |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3346 /** | 3346 /** |
| 3347 * Return the object keeping track of which elements have had their types over
ridden. | 3347 * Return the object keeping track of which elements have had their types over
ridden. |
| 3348 * @return the object keeping track of which elements have had their types ove
rridden | 3348 * @return the object keeping track of which elements have had their types ove
rridden |
| 3349 */ | 3349 */ |
| 3350 TypeOverrideManager get overrideManager => _overrideManager; | 3350 TypeOverrideManager get overrideManager => _overrideManager; |
| 3351 Object visitAsExpression(AsExpression node) { | 3351 Object visitAsExpression(AsExpression node) { |
| 3352 super.visitAsExpression(node); | 3352 super.visitAsExpression(node); |
| 3353 if (StaticTypeAnalyzer.USE_TYPE_PROPAGATION) { | 3353 if (StaticTypeAnalyzer.USE_TYPE_PROPAGATION) { |
| 3354 VariableElement element = getOverridableElement(node.expression); | 3354 VariableElement element = getOverridableElement(node.expression); |
| 3355 if (element != null) { | 3355 if (element != null) { |
| 3356 Type2 type16 = node.type.type; | 3356 Type2 type2 = node.type.type; |
| 3357 if (type16 != null) { | 3357 if (type2 != null) { |
| 3358 _overrideManager.setType(element, type16); | 3358 _overrideManager.setType(element, type2); |
| 3359 } | 3359 } |
| 3360 } | 3360 } |
| 3361 } | 3361 } |
| 3362 return null; | 3362 return null; |
| 3363 } | 3363 } |
| 3364 Object visitAssertStatement(AssertStatement node) { | 3364 Object visitAssertStatement(AssertStatement node) { |
| 3365 Expression condition3 = node.condition; | 3365 Expression condition2 = node.condition; |
| 3366 condition3.accept(this); | 3366 condition2.accept(this); |
| 3367 propagateTrueState(condition3); | 3367 propagateTrueState(condition2); |
| 3368 return null; | 3368 return null; |
| 3369 } | 3369 } |
| 3370 Object visitBreakStatement(BreakStatement node) { | 3370 Object visitBreakStatement(BreakStatement node) { |
| 3371 node.accept(_elementResolver); | 3371 node.accept(_elementResolver); |
| 3372 node.accept(_typeAnalyzer); | 3372 node.accept(_typeAnalyzer); |
| 3373 return null; | 3373 return null; |
| 3374 } | 3374 } |
| 3375 Object visitClassDeclaration(ClassDeclaration node) { | 3375 Object visitClassDeclaration(ClassDeclaration node) { |
| 3376 ClassElement outerType = _enclosingClass; | 3376 ClassElement outerType = _enclosingClass; |
| 3377 try { | 3377 try { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 3401 } | 3401 } |
| 3402 for (CompilationUnitMember declaration in classes) { | 3402 for (CompilationUnitMember declaration in classes) { |
| 3403 declaration.accept(this); | 3403 declaration.accept(this); |
| 3404 } | 3404 } |
| 3405 } finally { | 3405 } finally { |
| 3406 _overrideManager.exitScope(); | 3406 _overrideManager.exitScope(); |
| 3407 } | 3407 } |
| 3408 return null; | 3408 return null; |
| 3409 } | 3409 } |
| 3410 Object visitConditionalExpression(ConditionalExpression node) { | 3410 Object visitConditionalExpression(ConditionalExpression node) { |
| 3411 Expression condition4 = node.condition; | 3411 Expression condition2 = node.condition; |
| 3412 condition4.accept(this); | 3412 condition2.accept(this); |
| 3413 Expression thenExpression2 = node.thenExpression; | 3413 Expression thenExpression2 = node.thenExpression; |
| 3414 if (thenExpression2 != null) { | 3414 if (thenExpression2 != null) { |
| 3415 try { | 3415 try { |
| 3416 _overrideManager.enterScope(); | 3416 _overrideManager.enterScope(); |
| 3417 propagateTrueState(condition4); | 3417 propagateTrueState(condition2); |
| 3418 thenExpression2.accept(this); | 3418 thenExpression2.accept(this); |
| 3419 } finally { | 3419 } finally { |
| 3420 _overrideManager.exitScope(); | 3420 _overrideManager.exitScope(); |
| 3421 } | 3421 } |
| 3422 } | 3422 } |
| 3423 Expression elseExpression2 = node.elseExpression; | 3423 Expression elseExpression2 = node.elseExpression; |
| 3424 if (elseExpression2 != null) { | 3424 if (elseExpression2 != null) { |
| 3425 try { | 3425 try { |
| 3426 _overrideManager.enterScope(); | 3426 _overrideManager.enterScope(); |
| 3427 propagateFalseState(condition4); | 3427 propagateFalseState(condition2); |
| 3428 elseExpression2.accept(this); | 3428 elseExpression2.accept(this); |
| 3429 } finally { | 3429 } finally { |
| 3430 _overrideManager.exitScope(); | 3430 _overrideManager.exitScope(); |
| 3431 } | 3431 } |
| 3432 } | 3432 } |
| 3433 if (StaticTypeAnalyzer.USE_TYPE_PROPAGATION) { | 3433 if (StaticTypeAnalyzer.USE_TYPE_PROPAGATION) { |
| 3434 bool thenIsAbrupt = thenExpression2 != null && isAbruptTermination(thenExp
ression2); | 3434 bool thenIsAbrupt = thenExpression2 != null && isAbruptTermination(thenExp
ression2); |
| 3435 bool elseIsAbrupt = elseExpression2 != null && isAbruptTermination(elseExp
ression2); | 3435 bool elseIsAbrupt = elseExpression2 != null && isAbruptTermination(elseExp
ression2); |
| 3436 if (elseIsAbrupt && !thenIsAbrupt) { | 3436 if (elseIsAbrupt && !thenIsAbrupt) { |
| 3437 propagateTrueState(condition4); | 3437 propagateTrueState(condition2); |
| 3438 } else if (thenIsAbrupt && !elseIsAbrupt) { | 3438 } else if (thenIsAbrupt && !elseIsAbrupt) { |
| 3439 propagateFalseState(condition4); | 3439 propagateFalseState(condition2); |
| 3440 } | 3440 } |
| 3441 } | 3441 } |
| 3442 return null; | 3442 return null; |
| 3443 } | 3443 } |
| 3444 Object visitConstructorDeclaration(ConstructorDeclaration node) { | 3444 Object visitConstructorDeclaration(ConstructorDeclaration node) { |
| 3445 ExecutableElement outerFunction = _enclosingFunction; | 3445 ExecutableElement outerFunction = _enclosingFunction; |
| 3446 try { | 3446 try { |
| 3447 _enclosingFunction = node.element; | 3447 _enclosingFunction = node.element; |
| 3448 super.visitConstructorDeclaration(node); | 3448 super.visitConstructorDeclaration(node); |
| 3449 } finally { | 3449 } finally { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3516 _overrideManager.enterScope(); | 3516 _overrideManager.enterScope(); |
| 3517 super.visitFunctionExpression(node); | 3517 super.visitFunctionExpression(node); |
| 3518 } finally { | 3518 } finally { |
| 3519 _overrideManager.exitScope(); | 3519 _overrideManager.exitScope(); |
| 3520 _enclosingFunction = outerFunction; | 3520 _enclosingFunction = outerFunction; |
| 3521 } | 3521 } |
| 3522 return null; | 3522 return null; |
| 3523 } | 3523 } |
| 3524 Object visitHideCombinator(HideCombinator node) => null; | 3524 Object visitHideCombinator(HideCombinator node) => null; |
| 3525 Object visitIfStatement(IfStatement node) { | 3525 Object visitIfStatement(IfStatement node) { |
| 3526 Expression condition5 = node.condition; | 3526 Expression condition2 = node.condition; |
| 3527 condition5.accept(this); | 3527 condition2.accept(this); |
| 3528 Statement thenStatement2 = node.thenStatement; | 3528 Statement thenStatement2 = node.thenStatement; |
| 3529 if (thenStatement2 != null) { | 3529 if (thenStatement2 != null) { |
| 3530 try { | 3530 try { |
| 3531 _overrideManager.enterScope(); | 3531 _overrideManager.enterScope(); |
| 3532 propagateTrueState(condition5); | 3532 propagateTrueState(condition2); |
| 3533 thenStatement2.accept(this); | 3533 thenStatement2.accept(this); |
| 3534 } finally { | 3534 } finally { |
| 3535 _overrideManager.exitScope(); | 3535 _overrideManager.exitScope(); |
| 3536 } | 3536 } |
| 3537 } | 3537 } |
| 3538 Statement elseStatement2 = node.elseStatement; | 3538 Statement elseStatement2 = node.elseStatement; |
| 3539 if (elseStatement2 != null) { | 3539 if (elseStatement2 != null) { |
| 3540 try { | 3540 try { |
| 3541 _overrideManager.enterScope(); | 3541 _overrideManager.enterScope(); |
| 3542 propagateFalseState(condition5); | 3542 propagateFalseState(condition2); |
| 3543 elseStatement2.accept(this); | 3543 elseStatement2.accept(this); |
| 3544 } finally { | 3544 } finally { |
| 3545 _overrideManager.exitScope(); | 3545 _overrideManager.exitScope(); |
| 3546 } | 3546 } |
| 3547 } | 3547 } |
| 3548 if (StaticTypeAnalyzer.USE_TYPE_PROPAGATION) { | 3548 if (StaticTypeAnalyzer.USE_TYPE_PROPAGATION) { |
| 3549 bool thenIsAbrupt = thenStatement2 != null && isAbruptTermination2(thenSta
tement2); | 3549 bool thenIsAbrupt = thenStatement2 != null && isAbruptTermination2(thenSta
tement2); |
| 3550 bool elseIsAbrupt = elseStatement2 != null && isAbruptTermination2(elseSta
tement2); | 3550 bool elseIsAbrupt = elseStatement2 != null && isAbruptTermination2(elseSta
tement2); |
| 3551 if (elseIsAbrupt && !thenIsAbrupt) { | 3551 if (elseIsAbrupt && !thenIsAbrupt) { |
| 3552 propagateTrueState(condition5); | 3552 propagateTrueState(condition2); |
| 3553 } else if (thenIsAbrupt && !elseIsAbrupt) { | 3553 } else if (thenIsAbrupt && !elseIsAbrupt) { |
| 3554 propagateFalseState(condition5); | 3554 propagateFalseState(condition2); |
| 3555 } | 3555 } |
| 3556 } | 3556 } |
| 3557 return null; | 3557 return null; |
| 3558 } | 3558 } |
| 3559 Object visitLabel(Label node) => null; | 3559 Object visitLabel(Label node) => null; |
| 3560 Object visitLibraryIdentifier(LibraryIdentifier node) => null; | 3560 Object visitLibraryIdentifier(LibraryIdentifier node) => null; |
| 3561 Object visitMethodDeclaration(MethodDeclaration node) { | 3561 Object visitMethodDeclaration(MethodDeclaration node) { |
| 3562 ExecutableElement outerFunction = _enclosingFunction; | 3562 ExecutableElement outerFunction = _enclosingFunction; |
| 3563 try { | 3563 try { |
| 3564 _enclosingFunction = node.element; | 3564 _enclosingFunction = node.element; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3650 * @return the element representing the function containing the current node | 3650 * @return the element representing the function containing the current node |
| 3651 */ | 3651 */ |
| 3652 ExecutableElement get enclosingFunction => _enclosingFunction; | 3652 ExecutableElement get enclosingFunction => _enclosingFunction; |
| 3653 /** | 3653 /** |
| 3654 * Return the element associated with the given expression whose type can be o
verridden, or{@code null} if there is no element whose type can be overridden. | 3654 * Return the element associated with the given expression whose type can be o
verridden, or{@code null} if there is no element whose type can be overridden. |
| 3655 * @param expression the expression with which the element is associated | 3655 * @param expression the expression with which the element is associated |
| 3656 * @return the element associated with the given expression | 3656 * @return the element associated with the given expression |
| 3657 */ | 3657 */ |
| 3658 VariableElement getOverridableElement(Expression expression) { | 3658 VariableElement getOverridableElement(Expression expression) { |
| 3659 if (expression is SimpleIdentifier) { | 3659 if (expression is SimpleIdentifier) { |
| 3660 Element element30 = ((expression as SimpleIdentifier)).element; | 3660 Element element2 = ((expression as SimpleIdentifier)).element; |
| 3661 if (element30 is VariableElement) { | 3661 if (element2 is VariableElement) { |
| 3662 return element30 as VariableElement; | 3662 return element2 as VariableElement; |
| 3663 } | 3663 } |
| 3664 } | 3664 } |
| 3665 return null; | 3665 return null; |
| 3666 } | 3666 } |
| 3667 /** | 3667 /** |
| 3668 * Return a map from the elements for the variables in the given list that hav
e their types | 3668 * Return a map from the elements for the variables in the given list that hav
e their types |
| 3669 * overridden to the overriding type. | 3669 * overridden to the overriding type. |
| 3670 * @param variableList the list of variables whose overriding types are to be
captured | 3670 * @param variableList the list of variables whose overriding types are to be
captured |
| 3671 * @return a table mapping elements to their overriding types | 3671 * @return a table mapping elements to their overriding types |
| 3672 */ | 3672 */ |
| 3673 Map<Element, Type2> captureOverrides(VariableDeclarationList variableList) { | 3673 Map<Element, Type2> captureOverrides(VariableDeclarationList variableList) { |
| 3674 Map<Element, Type2> overrides = new Map<Element, Type2>(); | 3674 Map<Element, Type2> overrides = new Map<Element, Type2>(); |
| 3675 if (StaticTypeAnalyzer.USE_TYPE_PROPAGATION) { | 3675 if (StaticTypeAnalyzer.USE_TYPE_PROPAGATION) { |
| 3676 if (variableList.isConst() || variableList.isFinal()) { | 3676 if (variableList.isConst() || variableList.isFinal()) { |
| 3677 for (VariableDeclaration variable in variableList.variables) { | 3677 for (VariableDeclaration variable in variableList.variables) { |
| 3678 Element element31 = variable.element; | 3678 Element element2 = variable.element; |
| 3679 if (element31 != null) { | 3679 if (element2 != null) { |
| 3680 Type2 type = _overrideManager.getType(element31); | 3680 Type2 type = _overrideManager.getType(element2); |
| 3681 if (type != null) { | 3681 if (type != null) { |
| 3682 overrides[element31] = type; | 3682 overrides[element2] = type; |
| 3683 } | 3683 } |
| 3684 } | 3684 } |
| 3685 } | 3685 } |
| 3686 } | 3686 } |
| 3687 } | 3687 } |
| 3688 return overrides; | 3688 return overrides; |
| 3689 } | 3689 } |
| 3690 /** | 3690 /** |
| 3691 * Return {@code true} if the given expression terminates abruptly (that is, i
f any expression | 3691 * Return {@code true} if the given expression terminates abruptly (that is, i
f any expression |
| 3692 * following the given expression will not be reached). | 3692 * following the given expression will not be reached). |
| 3693 * @param expression the expression being tested | 3693 * @param expression the expression being tested |
| 3694 * @return {@code true} if the given expression terminates abruptly | 3694 * @return {@code true} if the given expression terminates abruptly |
| 3695 */ | 3695 */ |
| 3696 bool isAbruptTermination(Expression expression19) { | 3696 bool isAbruptTermination(Expression expression2) { |
| 3697 while (expression19 is ParenthesizedExpression) { | 3697 while (expression2 is ParenthesizedExpression) { |
| 3698 expression19 = ((expression19 as ParenthesizedExpression)).expression; | 3698 expression2 = ((expression2 as ParenthesizedExpression)).expression; |
| 3699 } | 3699 } |
| 3700 return expression19 is ThrowExpression || expression19 is RethrowExpression; | 3700 return expression2 is ThrowExpression || expression2 is RethrowExpression; |
| 3701 } | 3701 } |
| 3702 /** | 3702 /** |
| 3703 * Return {@code true} if the given statement terminates abruptly (that is, if
any statement | 3703 * Return {@code true} if the given statement terminates abruptly (that is, if
any statement |
| 3704 * following the given statement will not be reached). | 3704 * following the given statement will not be reached). |
| 3705 * @param statement the statement being tested | 3705 * @param statement the statement being tested |
| 3706 * @return {@code true} if the given statement terminates abruptly | 3706 * @return {@code true} if the given statement terminates abruptly |
| 3707 */ | 3707 */ |
| 3708 bool isAbruptTermination2(Statement statement) { | 3708 bool isAbruptTermination2(Statement statement) { |
| 3709 if (statement is ReturnStatement) { | 3709 if (statement is ReturnStatement) { |
| 3710 return true; | 3710 return true; |
| 3711 } else if (statement is ExpressionStatement) { | 3711 } else if (statement is ExpressionStatement) { |
| 3712 return isAbruptTermination(((statement as ExpressionStatement)).expression
); | 3712 return isAbruptTermination(((statement as ExpressionStatement)).expression
); |
| 3713 } else if (statement is Block) { | 3713 } else if (statement is Block) { |
| 3714 NodeList<Statement> statements2 = ((statement as Block)).statements; | 3714 NodeList<Statement> statements2 = ((statement as Block)).statements; |
| 3715 int size6 = statements2.length; | 3715 int size2 = statements2.length; |
| 3716 if (size6 == 0) { | 3716 if (size2 == 0) { |
| 3717 return false; | 3717 return false; |
| 3718 } | 3718 } |
| 3719 return isAbruptTermination2(statements2[size6 - 1]); | 3719 return isAbruptTermination2(statements2[size2 - 1]); |
| 3720 } | 3720 } |
| 3721 return false; | 3721 return false; |
| 3722 } | 3722 } |
| 3723 /** | 3723 /** |
| 3724 * Propagate any type information that results from knowing that the given con
dition will have | 3724 * Propagate any type information that results from knowing that the given con
dition will have |
| 3725 * evaluated to 'false'. | 3725 * evaluated to 'false'. |
| 3726 * @param condition the condition that will have evaluated to 'false' | 3726 * @param condition the condition that will have evaluated to 'false' |
| 3727 */ | 3727 */ |
| 3728 void propagateFalseState(Expression condition) { | 3728 void propagateFalseState(Expression condition) { |
| 3729 while (condition is ParenthesizedExpression) { | 3729 while (condition is ParenthesizedExpression) { |
| 3730 condition = ((condition as ParenthesizedExpression)).expression; | 3730 condition = ((condition as ParenthesizedExpression)).expression; |
| 3731 } | 3731 } |
| 3732 if (condition is IsExpression) { | 3732 if (condition is IsExpression) { |
| 3733 IsExpression is2 = condition as IsExpression; | 3733 IsExpression is2 = condition as IsExpression; |
| 3734 if (is2.notOperator != null) { | 3734 if (is2.notOperator != null) { |
| 3735 Element element = getOverridableElement(is2.expression); | 3735 Element element = getOverridableElement(is2.expression); |
| 3736 if (element != null) { | 3736 if (element != null) { |
| 3737 Type2 type17 = is2.type.type; | 3737 Type2 type2 = is2.type.type; |
| 3738 if (type17 != null) { | 3738 if (type2 != null) { |
| 3739 _overrideManager.setType(element, type17); | 3739 _overrideManager.setType(element, type2); |
| 3740 } | 3740 } |
| 3741 } | 3741 } |
| 3742 } | 3742 } |
| 3743 } else if (condition is BinaryExpression) { | 3743 } else if (condition is BinaryExpression) { |
| 3744 BinaryExpression binary = condition as BinaryExpression; | 3744 BinaryExpression binary = condition as BinaryExpression; |
| 3745 if (identical(binary.operator.type, sc.TokenType.BAR_BAR)) { | 3745 if (identical(binary.operator.type, sc.TokenType.BAR_BAR)) { |
| 3746 propagateFalseState(binary.leftOperand); | 3746 propagateFalseState(binary.leftOperand); |
| 3747 propagateFalseState(binary.rightOperand); | 3747 propagateFalseState(binary.rightOperand); |
| 3748 } | 3748 } |
| 3749 } | 3749 } |
| 3750 } | 3750 } |
| 3751 /** | 3751 /** |
| 3752 * Propagate any type information that results from knowing that the given con
dition will have | 3752 * Propagate any type information that results from knowing that the given con
dition will have |
| 3753 * evaluated to 'true'. | 3753 * evaluated to 'true'. |
| 3754 * @param condition the condition that will have evaluated to 'true' | 3754 * @param condition the condition that will have evaluated to 'true' |
| 3755 */ | 3755 */ |
| 3756 void propagateTrueState(Expression condition) { | 3756 void propagateTrueState(Expression condition) { |
| 3757 while (condition is ParenthesizedExpression) { | 3757 while (condition is ParenthesizedExpression) { |
| 3758 condition = ((condition as ParenthesizedExpression)).expression; | 3758 condition = ((condition as ParenthesizedExpression)).expression; |
| 3759 } | 3759 } |
| 3760 if (condition is IsExpression) { | 3760 if (condition is IsExpression) { |
| 3761 IsExpression is3 = condition as IsExpression; | 3761 IsExpression is2 = condition as IsExpression; |
| 3762 if (is3.notOperator == null) { | 3762 if (is2.notOperator == null) { |
| 3763 Element element = getOverridableElement(is3.expression); | 3763 Element element = getOverridableElement(is2.expression); |
| 3764 if (element != null) { | 3764 if (element != null) { |
| 3765 Type2 type18 = is3.type.type; | 3765 Type2 type2 = is2.type.type; |
| 3766 if (type18 != null) { | 3766 if (type2 != null) { |
| 3767 _overrideManager.setType(element, type18); | 3767 _overrideManager.setType(element, type2); |
| 3768 } | 3768 } |
| 3769 } | 3769 } |
| 3770 } | 3770 } |
| 3771 } else if (condition is BinaryExpression) { | 3771 } else if (condition is BinaryExpression) { |
| 3772 BinaryExpression binary = condition as BinaryExpression; | 3772 BinaryExpression binary = condition as BinaryExpression; |
| 3773 if (identical(binary.operator.type, sc.TokenType.AMPERSAND_AMPERSAND)) { | 3773 if (identical(binary.operator.type, sc.TokenType.AMPERSAND_AMPERSAND)) { |
| 3774 propagateTrueState(binary.leftOperand); | 3774 propagateTrueState(binary.leftOperand); |
| 3775 propagateTrueState(binary.rightOperand); | 3775 propagateTrueState(binary.rightOperand); |
| 3776 } | 3776 } |
| 3777 } | 3777 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3825 /** | 3825 /** |
| 3826 * The scope used to resolve labels for {@code break} and {@code continue} sta
tements, or{@code null} if no labels have been defined in the current context. | 3826 * The scope used to resolve labels for {@code break} and {@code continue} sta
tements, or{@code null} if no labels have been defined in the current context. |
| 3827 */ | 3827 */ |
| 3828 LabelScope _labelScope; | 3828 LabelScope _labelScope; |
| 3829 /** | 3829 /** |
| 3830 * Initialize a newly created visitor to resolve the nodes in a compilation un
it. | 3830 * Initialize a newly created visitor to resolve the nodes in a compilation un
it. |
| 3831 * @param library the library containing the compilation unit being resolved | 3831 * @param library the library containing the compilation unit being resolved |
| 3832 * @param source the source representing the compilation unit being visited | 3832 * @param source the source representing the compilation unit being visited |
| 3833 * @param typeProvider the object used to access the types from the core libra
ry | 3833 * @param typeProvider the object used to access the types from the core libra
ry |
| 3834 */ | 3834 */ |
| 3835 ScopedVisitor.con1(Library library, Source source8, TypeProvider typeProvider2
) { | 3835 ScopedVisitor.con1(Library library, Source source2, TypeProvider typeProvider2
) { |
| 3836 _jtd_constructor_267_impl(library, source8, typeProvider2); | 3836 _jtd_constructor_267_impl(library, source2, typeProvider2); |
| 3837 } | 3837 } |
| 3838 _jtd_constructor_267_impl(Library library, Source source8, TypeProvider typePr
ovider2) { | 3838 _jtd_constructor_267_impl(Library library, Source source2, TypeProvider typePr
ovider2) { |
| 3839 this._definingLibrary = library.libraryElement; | 3839 this._definingLibrary = library.libraryElement; |
| 3840 this._source = source8; | 3840 this._source = source2; |
| 3841 LibraryScope libraryScope2 = library.libraryScope; | 3841 LibraryScope libraryScope2 = library.libraryScope; |
| 3842 this._errorListener = libraryScope2.errorListener; | 3842 this._errorListener = libraryScope2.errorListener; |
| 3843 this._nameScope = libraryScope2; | 3843 this._nameScope = libraryScope2; |
| 3844 this._typeProvider = typeProvider2; | 3844 this._typeProvider = typeProvider2; |
| 3845 } | 3845 } |
| 3846 /** | 3846 /** |
| 3847 * Initialize a newly created visitor to resolve the nodes in a compilation un
it. | 3847 * Initialize a newly created visitor to resolve the nodes in a compilation un
it. |
| 3848 * @param definingLibrary the element for the library containing the compilati
on unit being | 3848 * @param definingLibrary the element for the library containing the compilati
on unit being |
| 3849 * visited | 3849 * visited |
| 3850 * @param source the source representing the compilation unit being visited | 3850 * @param source the source representing the compilation unit being visited |
| 3851 * @param typeProvider the object used to access the types from the core libra
ry | 3851 * @param typeProvider the object used to access the types from the core libra
ry |
| 3852 * @param errorListener the error listener that will be informed of any errors
that are found | 3852 * @param errorListener the error listener that will be informed of any errors
that are found |
| 3853 * during resolution | 3853 * during resolution |
| 3854 */ | 3854 */ |
| 3855 ScopedVisitor.con2(LibraryElement definingLibrary2, Source source9, TypeProvid
er typeProvider3, AnalysisErrorListener errorListener2) { | 3855 ScopedVisitor.con2(LibraryElement definingLibrary2, Source source2, TypeProvid
er typeProvider2, AnalysisErrorListener errorListener2) { |
| 3856 _jtd_constructor_268_impl(definingLibrary2, source9, typeProvider3, errorLis
tener2); | 3856 _jtd_constructor_268_impl(definingLibrary2, source2, typeProvider2, errorLis
tener2); |
| 3857 } | 3857 } |
| 3858 _jtd_constructor_268_impl(LibraryElement definingLibrary2, Source source9, Typ
eProvider typeProvider3, AnalysisErrorListener errorListener2) { | 3858 _jtd_constructor_268_impl(LibraryElement definingLibrary2, Source source2, Typ
eProvider typeProvider2, AnalysisErrorListener errorListener2) { |
| 3859 this._definingLibrary = definingLibrary2; | 3859 this._definingLibrary = definingLibrary2; |
| 3860 this._source = source9; | 3860 this._source = source2; |
| 3861 this._errorListener = errorListener2; | 3861 this._errorListener = errorListener2; |
| 3862 this._nameScope = new LibraryScope(definingLibrary2, errorListener2); | 3862 this._nameScope = new LibraryScope(definingLibrary2, errorListener2); |
| 3863 this._typeProvider = typeProvider3; | 3863 this._typeProvider = typeProvider2; |
| 3864 } | 3864 } |
| 3865 /** | 3865 /** |
| 3866 * Return the library element for the library containing the compilation unit
being resolved. | 3866 * Return the library element for the library containing the compilation unit
being resolved. |
| 3867 * @return the library element for the library containing the compilation unit
being resolved | 3867 * @return the library element for the library containing the compilation unit
being resolved |
| 3868 */ | 3868 */ |
| 3869 LibraryElement get definingLibrary => _definingLibrary; | 3869 LibraryElement get definingLibrary => _definingLibrary; |
| 3870 /** | 3870 /** |
| 3871 * Return the object used to access the types from the core library. | 3871 * Return the object used to access the types from the core library. |
| 3872 * @return the object used to access the types from the core library | 3872 * @return the object used to access the types from the core library |
| 3873 */ | 3873 */ |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3924 Scope outerScope = _nameScope; | 3924 Scope outerScope = _nameScope; |
| 3925 try { | 3925 try { |
| 3926 _nameScope = new FunctionScope(_nameScope, node.element); | 3926 _nameScope = new FunctionScope(_nameScope, node.element); |
| 3927 super.visitConstructorDeclaration(node); | 3927 super.visitConstructorDeclaration(node); |
| 3928 } finally { | 3928 } finally { |
| 3929 _nameScope = outerScope; | 3929 _nameScope = outerScope; |
| 3930 } | 3930 } |
| 3931 return null; | 3931 return null; |
| 3932 } | 3932 } |
| 3933 Object visitDeclaredIdentifier(DeclaredIdentifier node) { | 3933 Object visitDeclaredIdentifier(DeclaredIdentifier node) { |
| 3934 VariableElement element32 = node.element; | 3934 VariableElement element2 = node.element; |
| 3935 if (element32 != null) { | 3935 if (element2 != null) { |
| 3936 _nameScope.define(element32); | 3936 _nameScope.define(element2); |
| 3937 } | 3937 } |
| 3938 super.visitDeclaredIdentifier(node); | 3938 super.visitDeclaredIdentifier(node); |
| 3939 return null; | 3939 return null; |
| 3940 } | 3940 } |
| 3941 Object visitDoStatement(DoStatement node) { | 3941 Object visitDoStatement(DoStatement node) { |
| 3942 LabelScope outerScope = _labelScope; | 3942 LabelScope outerScope = _labelScope; |
| 3943 _labelScope = new LabelScope.con1(outerScope, false, false); | 3943 _labelScope = new LabelScope.con1(outerScope, false, false); |
| 3944 try { | 3944 try { |
| 3945 super.visitDoStatement(node); | 3945 super.visitDoStatement(node); |
| 3946 } finally { | 3946 } finally { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4068 } | 4068 } |
| 4069 try { | 4069 try { |
| 4070 super.visitSwitchStatement(node); | 4070 super.visitSwitchStatement(node); |
| 4071 } finally { | 4071 } finally { |
| 4072 _labelScope = outerScope; | 4072 _labelScope = outerScope; |
| 4073 } | 4073 } |
| 4074 return null; | 4074 return null; |
| 4075 } | 4075 } |
| 4076 Object visitVariableDeclaration(VariableDeclaration node) { | 4076 Object visitVariableDeclaration(VariableDeclaration node) { |
| 4077 if (node.parent.parent is! TopLevelVariableDeclaration && node.parent.parent
is! FieldDeclaration) { | 4077 if (node.parent.parent is! TopLevelVariableDeclaration && node.parent.parent
is! FieldDeclaration) { |
| 4078 VariableElement element33 = node.element; | 4078 VariableElement element2 = node.element; |
| 4079 if (element33 != null) { | 4079 if (element2 != null) { |
| 4080 _nameScope.define(element33); | 4080 _nameScope.define(element2); |
| 4081 } | 4081 } |
| 4082 } | 4082 } |
| 4083 super.visitVariableDeclaration(node); | 4083 super.visitVariableDeclaration(node); |
| 4084 return null; | 4084 return null; |
| 4085 } | 4085 } |
| 4086 Object visitWhileStatement(WhileStatement node) { | 4086 Object visitWhileStatement(WhileStatement node) { |
| 4087 LabelScope outerScope = _labelScope; | 4087 LabelScope outerScope = _labelScope; |
| 4088 _labelScope = new LabelScope.con1(outerScope, false, false); | 4088 _labelScope = new LabelScope.con1(outerScope, false, false); |
| 4089 try { | 4089 try { |
| 4090 super.visitWhileStatement(node); | 4090 super.visitWhileStatement(node); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4313 * A compound assignment of the form <i>v op= e</i> is equivalent to <i>v = v
op e</i>. A compound | 4313 * A compound assignment of the form <i>v op= e</i> is equivalent to <i>v = v
op e</i>. A compound |
| 4314 * assignment of the form <i>C.v op= e</i> is equivalent to <i>C.v = C.v op e<
/i>. A compound | 4314 * assignment of the form <i>C.v op= e</i> is equivalent to <i>C.v = C.v op e<
/i>. A compound |
| 4315 * assignment of the form <i>e<sub>1</sub>.v op= e<sub>2</sub></i> is equivale
nt to <i>((x) => x.v | 4315 * assignment of the form <i>e<sub>1</sub>.v op= e<sub>2</sub></i> is equivale
nt to <i>((x) => x.v |
| 4316 * = x.v op e<sub>2</sub>)(e<sub>1</sub>)</i> where <i>x</i> is a variable tha
t is not used in | 4316 * = x.v op e<sub>2</sub>)(e<sub>1</sub>)</i> where <i>x</i> is a variable tha
t is not used in |
| 4317 * <i>e<sub>2</sub></i>. A compound assignment of the form <i>e<sub>1</sub>[e<
sub>2</sub>] op= | 4317 * <i>e<sub>2</sub></i>. A compound assignment of the form <i>e<sub>1</sub>[e<
sub>2</sub>] op= |
| 4318 * e<sub>3</sub></i> is equivalent to <i>((a, i) => a[i] = a[i] op e<sub>3</su
b>)(e<sub>1</sub>, | 4318 * e<sub>3</sub></i> is equivalent to <i>((a, i) => a[i] = a[i] op e<sub>3</su
b>)(e<sub>1</sub>, |
| 4319 * e<sub>2</sub>)</i> where <i>a</i> and <i>i</i> are a variables that are not
used in | 4319 * e<sub>2</sub>)</i> where <i>a</i> and <i>i</i> are a variables that are not
used in |
| 4320 * <i>e<sub>3</sub></i>. </blockquote> | 4320 * <i>e<sub>3</sub></i>. </blockquote> |
| 4321 */ | 4321 */ |
| 4322 Object visitAssignmentExpression(AssignmentExpression node) { | 4322 Object visitAssignmentExpression(AssignmentExpression node) { |
| 4323 sc.TokenType operator11 = node.operator.type; | 4323 sc.TokenType operator2 = node.operator.type; |
| 4324 if (operator11 != sc.TokenType.EQ) { | 4324 if (operator2 != sc.TokenType.EQ) { |
| 4325 return recordReturnType(node, node.element); | 4325 return recordReturnType(node, node.element); |
| 4326 } | 4326 } |
| 4327 Type2 rightType = getType2(node.rightHandSide); | 4327 Type2 rightType = getType2(node.rightHandSide); |
| 4328 if (USE_TYPE_PROPAGATION) { | 4328 if (USE_TYPE_PROPAGATION) { |
| 4329 VariableElement element = _resolver.getOverridableElement(node.leftHandSid
e); | 4329 VariableElement element = _resolver.getOverridableElement(node.leftHandSid
e); |
| 4330 if (element != null) { | 4330 if (element != null) { |
| 4331 override(element, getType(element), rightType); | 4331 override(element, getType(element), rightType); |
| 4332 } | 4332 } |
| 4333 } | 4333 } |
| 4334 return recordType(node, rightType); | 4334 return recordType(node, rightType); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 4364 * e<sub>2</sub></i> is equivalent to the method invocation | 4364 * e<sub>2</sub></i> is equivalent to the method invocation |
| 4365 * <i>super.op(e<sub>2</sub>)</i>.</blockquote> | 4365 * <i>super.op(e<sub>2</sub>)</i>.</blockquote> |
| 4366 * <p> | 4366 * <p> |
| 4367 * The Dart Language Specification, 12.26: <blockquote>A multiplicative expres
sion of the form | 4367 * The Dart Language Specification, 12.26: <blockquote>A multiplicative expres
sion of the form |
| 4368 * <i>e<sub>1</sub> op e<sub>2</sub></i> is equivalent to the method invocatio
n | 4368 * <i>e<sub>1</sub> op e<sub>2</sub></i> is equivalent to the method invocatio
n |
| 4369 * <i>e<sub>1</sub>.op(e<sub>2</sub>)</i>. A multiplicative expression of the
form <i>super op | 4369 * <i>e<sub>1</sub>.op(e<sub>2</sub>)</i>. A multiplicative expression of the
form <i>super op |
| 4370 * e<sub>2</sub></i> is equivalent to the method invocation | 4370 * e<sub>2</sub></i> is equivalent to the method invocation |
| 4371 * <i>super.op(e<sub>2</sub>)</i>.</blockquote> | 4371 * <i>super.op(e<sub>2</sub>)</i>.</blockquote> |
| 4372 */ | 4372 */ |
| 4373 Object visitBinaryExpression(BinaryExpression node) { | 4373 Object visitBinaryExpression(BinaryExpression node) { |
| 4374 sc.TokenType operator12 = node.operator.type; | 4374 sc.TokenType operator2 = node.operator.type; |
| 4375 while (true) { | 4375 while (true) { |
| 4376 if (operator12 == sc.TokenType.AMPERSAND_AMPERSAND || operator12 == sc.Tok
enType.BAR_BAR || operator12 == sc.TokenType.EQ_EQ || operator12 == sc.TokenType
.BANG_EQ) { | 4376 if (operator2 == sc.TokenType.AMPERSAND_AMPERSAND || operator2 == sc.Token
Type.BAR_BAR || operator2 == sc.TokenType.EQ_EQ || operator2 == sc.TokenType.BAN
G_EQ) { |
| 4377 return recordType(node, _typeProvider.boolType); | 4377 return recordType(node, _typeProvider.boolType); |
| 4378 } else if (operator12 == sc.TokenType.MINUS || operator12 == sc.TokenType.
PERCENT || operator12 == sc.TokenType.PLUS || operator12 == sc.TokenType.STAR ||
operator12 == sc.TokenType.TILDE_SLASH) { | 4378 } else if (operator2 == sc.TokenType.MINUS || operator2 == sc.TokenType.PE
RCENT || operator2 == sc.TokenType.PLUS || operator2 == sc.TokenType.STAR || ope
rator2 == sc.TokenType.TILDE_SLASH) { |
| 4379 Type2 intType2 = _typeProvider.intType; | 4379 Type2 intType2 = _typeProvider.intType; |
| 4380 if (identical(getType2(node.leftOperand), intType2) && identical(getType
2(node.rightOperand), intType2)) { | 4380 if (identical(getType2(node.leftOperand), intType2) && identical(getType
2(node.rightOperand), intType2)) { |
| 4381 return recordType(node, intType2); | 4381 return recordType(node, intType2); |
| 4382 } | 4382 } |
| 4383 } else if (operator12 == sc.TokenType.SLASH) { | 4383 } else if (operator2 == sc.TokenType.SLASH) { |
| 4384 Type2 doubleType2 = _typeProvider.doubleType; | 4384 Type2 doubleType2 = _typeProvider.doubleType; |
| 4385 if (identical(getType2(node.leftOperand), doubleType2) || identical(getT
ype2(node.rightOperand), doubleType2)) { | 4385 if (identical(getType2(node.leftOperand), doubleType2) || identical(getT
ype2(node.rightOperand), doubleType2)) { |
| 4386 return recordType(node, doubleType2); | 4386 return recordType(node, doubleType2); |
| 4387 } | 4387 } |
| 4388 } | 4388 } |
| 4389 break; | 4389 break; |
| 4390 } | 4390 } |
| 4391 return recordReturnType(node, node.element); | 4391 return recordReturnType(node, node.element); |
| 4392 } | 4392 } |
| 4393 /** | 4393 /** |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4494 * The Dart Language Specification, 12.11.1: <blockquote>The static type of a
new expression of | 4494 * The Dart Language Specification, 12.11.1: <blockquote>The static type of a
new expression of |
| 4495 * either the form <i>new T.id(a<sub>1</sub>, …, a<sub>n</sub>)</i> or
the form <i>new | 4495 * either the form <i>new T.id(a<sub>1</sub>, …, a<sub>n</sub>)</i> or
the form <i>new |
| 4496 * T(a<sub>1</sub>, …, a<sub>n</sub>)</i> is <i>T</i>.</blockquote> | 4496 * T(a<sub>1</sub>, …, a<sub>n</sub>)</i> is <i>T</i>.</blockquote> |
| 4497 * <p> | 4497 * <p> |
| 4498 * The Dart Language Specification, 12.11.2: <blockquote>The static type of a
constant object | 4498 * The Dart Language Specification, 12.11.2: <blockquote>The static type of a
constant object |
| 4499 * expression of either the form <i>const T.id(a<sub>1</sub>, …, a<sub>
n</sub>)</i> or the | 4499 * expression of either the form <i>const T.id(a<sub>1</sub>, …, a<sub>
n</sub>)</i> or the |
| 4500 * form <i>const T(a<sub>1</sub>, …, a<sub>n</sub>)</i> is <i>T</i>. </
blockquote> | 4500 * form <i>const T(a<sub>1</sub>, …, a<sub>n</sub>)</i> is <i>T</i>. </
blockquote> |
| 4501 */ | 4501 */ |
| 4502 Object visitInstanceCreationExpression(InstanceCreationExpression node) { | 4502 Object visitInstanceCreationExpression(InstanceCreationExpression node) { |
| 4503 if (USE_TYPE_PROPAGATION) { | 4503 if (USE_TYPE_PROPAGATION) { |
| 4504 ConstructorElement element34 = node.element; | 4504 ConstructorElement element2 = node.element; |
| 4505 if (element34 != null && "Element" == element34.enclosingElement.name && "
tag" == element34.name) { | 4505 if (element2 != null && "Element" == element2.enclosingElement.name && "ta
g" == element2.name) { |
| 4506 LibraryElement library33 = element34.library; | 4506 LibraryElement library2 = element2.library; |
| 4507 if (isHtmlLibrary(library33)) { | 4507 if (isHtmlLibrary(library2)) { |
| 4508 Type2 returnType = getFirstArgumentAsType2(library33, node.argumentLis
t, _HTML_ELEMENT_TO_CLASS_MAP); | 4508 Type2 returnType = getFirstArgumentAsType2(library2, node.argumentList
, _HTML_ELEMENT_TO_CLASS_MAP); |
| 4509 if (returnType != null) { | 4509 if (returnType != null) { |
| 4510 return recordType(node, returnType); | 4510 return recordType(node, returnType); |
| 4511 } | 4511 } |
| 4512 } | 4512 } |
| 4513 } | 4513 } |
| 4514 } | 4514 } |
| 4515 return recordType(node, node.constructorName.type.type); | 4515 return recordType(node, node.constructorName.type.type); |
| 4516 } | 4516 } |
| 4517 /** | 4517 /** |
| 4518 * The Dart Language Specification, 12.3: <blockquote>The static type of an in
teger literal is{@code int}.</blockquote> | 4518 * The Dart Language Specification, 12.3: <blockquote>The static type of an in
teger literal is{@code int}.</blockquote> |
| 4519 */ | 4519 */ |
| 4520 Object visitIntegerLiteral(IntegerLiteral node) => recordType(node, _typeProvi
der.intType); | 4520 Object visitIntegerLiteral(IntegerLiteral node) => recordType(node, _typeProvi
der.intType); |
| 4521 /** | 4521 /** |
| 4522 * The Dart Language Specification, 12.31: <blockquote>It is a static warning
if <i>T</i> does not | 4522 * The Dart Language Specification, 12.31: <blockquote>It is a static warning
if <i>T</i> does not |
| 4523 * denote a type available in the current lexical scope. | 4523 * denote a type available in the current lexical scope. |
| 4524 * <p> | 4524 * <p> |
| 4525 * The static type of an is-expression is {@code bool}.</blockquote> | 4525 * The static type of an is-expression is {@code bool}.</blockquote> |
| 4526 */ | 4526 */ |
| 4527 Object visitIsExpression(IsExpression node) => recordType(node, _typeProvider.
boolType); | 4527 Object visitIsExpression(IsExpression node) => recordType(node, _typeProvider.
boolType); |
| 4528 /** | 4528 /** |
| 4529 * The Dart Language Specification, 12.6: <blockquote>The static type of a lis
t literal of the | 4529 * The Dart Language Specification, 12.6: <blockquote>The static type of a lis
t literal of the |
| 4530 * form <i><b>const</b> <E>[e<sub>1</sub>, …, e<sub>n</sub>]</i>
or the form | 4530 * form <i><b>const</b> <E>[e<sub>1</sub>, …, e<sub>n</sub>]</i>
or the form |
| 4531 * <i><E>[e<sub>1</sub>, …, e<sub>n</sub>]</i> is {@code List<
E>}. The static | 4531 * <i><E>[e<sub>1</sub>, …, e<sub>n</sub>]</i> is {@code List<
E>}. The static |
| 4532 * type a list literal of the form <i><b>const</b> [e<sub>1</sub>, …, e
<sub>n</sub>]</i> or | 4532 * type a list literal of the form <i><b>const</b> [e<sub>1</sub>, …, e
<sub>n</sub>]</i> or |
| 4533 * the form <i>[e<sub>1</sub>, …, e<sub>n</sub>]</i> is {@code List<
dynamic>}.</blockquote> | 4533 * the form <i>[e<sub>1</sub>, …, e<sub>n</sub>]</i> is {@code List<
dynamic>}.</blockquote> |
| 4534 */ | 4534 */ |
| 4535 Object visitListLiteral(ListLiteral node) { | 4535 Object visitListLiteral(ListLiteral node) { |
| 4536 TypeArgumentList typeArguments8 = node.typeArguments; | 4536 TypeArgumentList typeArguments2 = node.typeArguments; |
| 4537 if (typeArguments8 != null) { | 4537 if (typeArguments2 != null) { |
| 4538 NodeList<TypeName> arguments4 = typeArguments8.arguments; | 4538 NodeList<TypeName> arguments2 = typeArguments2.arguments; |
| 4539 if (arguments4 != null && arguments4.length == 1) { | 4539 if (arguments2 != null && arguments2.length == 1) { |
| 4540 TypeName argumentType = arguments4[0]; | 4540 TypeName argumentType = arguments2[0]; |
| 4541 return recordType(node, _typeProvider.listType.substitute5(<Type2> [getT
ype4(argumentType)])); | 4541 return recordType(node, _typeProvider.listType.substitute5(<Type2> [getT
ype4(argumentType)])); |
| 4542 } | 4542 } |
| 4543 } | 4543 } |
| 4544 return recordType(node, _typeProvider.listType.substitute5(<Type2> [_dynamic
Type])); | 4544 return recordType(node, _typeProvider.listType.substitute5(<Type2> [_dynamic
Type])); |
| 4545 } | 4545 } |
| 4546 /** | 4546 /** |
| 4547 * The Dart Language Specification, 12.7: <blockquote>The static type of a map
literal of the form | 4547 * The Dart Language Specification, 12.7: <blockquote>The static type of a map
literal of the form |
| 4548 * <i><b>const</b> <String, V> {k<sub>1</sub>:e<sub>1</sub>, …, | 4548 * <i><b>const</b> <String, V> {k<sub>1</sub>:e<sub>1</sub>, …, |
| 4549 * k<sub>n</sub>:e<sub>n</sub>}</i> or the form <i><String, V> {k<sub>1<
/sub>:e<sub>1</sub>, | 4549 * k<sub>n</sub>:e<sub>n</sub>}</i> or the form <i><String, V> {k<sub>1<
/sub>:e<sub>1</sub>, |
| 4550 * …, k<sub>n</sub>:e<sub>n</sub>}</i> is {@code Map<String, V>}.
The static type a | 4550 * …, k<sub>n</sub>:e<sub>n</sub>}</i> is {@code Map<String, V>}.
The static type a |
| 4551 * map literal of the form <i><b>const</b> {k<sub>1</sub>:e<sub>1</sub>, &hell
ip;, | 4551 * map literal of the form <i><b>const</b> {k<sub>1</sub>:e<sub>1</sub>, &hell
ip;, |
| 4552 * k<sub>n</sub>:e<sub>n</sub>}</i> or the form <i>{k<sub>1</sub>:e<sub>1</sub
>, …, | 4552 * k<sub>n</sub>:e<sub>n</sub>}</i> or the form <i>{k<sub>1</sub>:e<sub>1</sub
>, …, |
| 4553 * k<sub>n</sub>:e<sub>n</sub>}</i> is {@code Map<String, dynamic>}. | 4553 * k<sub>n</sub>:e<sub>n</sub>}</i> is {@code Map<String, dynamic>}. |
| 4554 * <p> | 4554 * <p> |
| 4555 * It is a compile-time error if the first type argument to a map literal is n
ot | 4555 * It is a compile-time error if the first type argument to a map literal is n
ot |
| 4556 * <i>String</i>.</blockquote> | 4556 * <i>String</i>.</blockquote> |
| 4557 */ | 4557 */ |
| 4558 Object visitMapLiteral(MapLiteral node) { | 4558 Object visitMapLiteral(MapLiteral node) { |
| 4559 TypeArgumentList typeArguments9 = node.typeArguments; | 4559 TypeArgumentList typeArguments2 = node.typeArguments; |
| 4560 if (typeArguments9 != null) { | 4560 if (typeArguments2 != null) { |
| 4561 NodeList<TypeName> arguments5 = typeArguments9.arguments; | 4561 NodeList<TypeName> arguments2 = typeArguments2.arguments; |
| 4562 if (arguments5 != null && arguments5.length == 2) { | 4562 if (arguments2 != null && arguments2.length == 2) { |
| 4563 TypeName keyType = arguments5[0]; | 4563 TypeName keyType = arguments2[0]; |
| 4564 if (keyType != _typeProvider.stringType) { | 4564 if (keyType != _typeProvider.stringType) { |
| 4565 } | 4565 } |
| 4566 TypeName valueType = arguments5[1]; | 4566 TypeName valueType = arguments2[1]; |
| 4567 return recordType(node, _typeProvider.mapType.substitute5(<Type2> [_type
Provider.stringType, getType4(valueType)])); | 4567 return recordType(node, _typeProvider.mapType.substitute5(<Type2> [_type
Provider.stringType, getType4(valueType)])); |
| 4568 } | 4568 } |
| 4569 } | 4569 } |
| 4570 return recordType(node, _typeProvider.mapType.substitute5(<Type2> [_typeProv
ider.stringType, _dynamicType])); | 4570 return recordType(node, _typeProvider.mapType.substitute5(<Type2> [_typeProv
ider.stringType, _dynamicType])); |
| 4571 } | 4571 } |
| 4572 /** | 4572 /** |
| 4573 * The Dart Language Specification, 12.15.1: <blockquote>An ordinary method in
vocation <i>i</i> | 4573 * The Dart Language Specification, 12.15.1: <blockquote>An ordinary method in
vocation <i>i</i> |
| 4574 * has the form <i>o.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>
: a<sub>n+1</sub>, | 4574 * has the form <i>o.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>
: a<sub>n+1</sub>, |
| 4575 * …, x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. | 4575 * …, x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. |
| 4576 * <p> | 4576 * <p> |
| (...skipping 23 matching lines...) Expand all Loading... |
| 4600 * It is a static type warning if <i>S</i> does not have an accessible instanc
e member named m. If | 4600 * It is a static type warning if <i>S</i> does not have an accessible instanc
e member named m. If |
| 4601 * <i>S.m</i> exists, it is a static warning if the type <i>F</i> of <i>S.m</i
> may not be | 4601 * <i>S.m</i> exists, it is a static warning if the type <i>F</i> of <i>S.m</i
> may not be |
| 4602 * assigned to a function type. | 4602 * assigned to a function type. |
| 4603 * <p> | 4603 * <p> |
| 4604 * If <i>S.m</i> does not exist, or if <i>F</i> is not a function type, the st
atic type of | 4604 * If <i>S.m</i> does not exist, or if <i>F</i> is not a function type, the st
atic type of |
| 4605 * <i>i</i> is dynamic. Otherwise the static type of <i>i</i> is the declared
return type of | 4605 * <i>i</i> is dynamic. Otherwise the static type of <i>i</i> is the declared
return type of |
| 4606 * <i>F</i>.</blockquote> | 4606 * <i>F</i>.</blockquote> |
| 4607 */ | 4607 */ |
| 4608 Object visitMethodInvocation(MethodInvocation node) { | 4608 Object visitMethodInvocation(MethodInvocation node) { |
| 4609 if (USE_TYPE_PROPAGATION) { | 4609 if (USE_TYPE_PROPAGATION) { |
| 4610 String methodName3 = node.methodName.name; | 4610 String methodName2 = node.methodName.name; |
| 4611 if (methodName3 == "\$dom_createEvent") { | 4611 if (methodName2 == "\$dom_createEvent") { |
| 4612 Expression target = node.realTarget; | 4612 Expression target = node.realTarget; |
| 4613 if (target != null) { | 4613 if (target != null) { |
| 4614 Type2 targetType = getType2(target); | 4614 Type2 targetType = getType2(target); |
| 4615 if (targetType is InterfaceType && (targetType.name == "HtmlDocument"
|| targetType.name == "Document")) { | 4615 if (targetType is InterfaceType && (targetType.name == "HtmlDocument"
|| targetType.name == "Document")) { |
| 4616 LibraryElement library34 = targetType.element.library; | 4616 LibraryElement library2 = targetType.element.library; |
| 4617 if (isHtmlLibrary(library34)) { | 4617 if (isHtmlLibrary(library2)) { |
| 4618 Type2 returnType = getFirstArgumentAsType(library34, node.argument
List); | 4618 Type2 returnType = getFirstArgumentAsType(library2, node.argumentL
ist); |
| 4619 if (returnType != null) { | 4619 if (returnType != null) { |
| 4620 return recordType(node, returnType); | 4620 return recordType(node, returnType); |
| 4621 } | 4621 } |
| 4622 } | 4622 } |
| 4623 } | 4623 } |
| 4624 } | 4624 } |
| 4625 } else if (methodName3 == "query") { | 4625 } else if (methodName2 == "query") { |
| 4626 Expression target = node.realTarget; | 4626 Expression target = node.realTarget; |
| 4627 if (target == null) { | 4627 if (target == null) { |
| 4628 Element methodElement = node.methodName.element; | 4628 Element methodElement = node.methodName.element; |
| 4629 if (methodElement != null) { | 4629 if (methodElement != null) { |
| 4630 LibraryElement library35 = methodElement.library; | 4630 LibraryElement library3 = methodElement.library; |
| 4631 if (isHtmlLibrary(library35)) { | 4631 if (isHtmlLibrary(library3)) { |
| 4632 Type2 returnType = getFirstArgumentAsQuery(library35, node.argumen
tList); | 4632 Type2 returnType = getFirstArgumentAsQuery(library3, node.argument
List); |
| 4633 if (returnType != null) { | 4633 if (returnType != null) { |
| 4634 return recordType(node, returnType); | 4634 return recordType(node, returnType); |
| 4635 } | 4635 } |
| 4636 } | 4636 } |
| 4637 } | 4637 } |
| 4638 } else { | 4638 } else { |
| 4639 Type2 targetType = getType2(target); | 4639 Type2 targetType = getType2(target); |
| 4640 if (targetType is InterfaceType && (targetType.name == "HtmlDocument"
|| targetType.name == "Document")) { | 4640 if (targetType is InterfaceType && (targetType.name == "HtmlDocument"
|| targetType.name == "Document")) { |
| 4641 LibraryElement library36 = targetType.element.library; | 4641 LibraryElement library4 = targetType.element.library; |
| 4642 if (isHtmlLibrary(library36)) { | 4642 if (isHtmlLibrary(library4)) { |
| 4643 Type2 returnType = getFirstArgumentAsQuery(library36, node.argumen
tList); | 4643 Type2 returnType = getFirstArgumentAsQuery(library4, node.argument
List); |
| 4644 if (returnType != null) { | 4644 if (returnType != null) { |
| 4645 return recordType(node, returnType); | 4645 return recordType(node, returnType); |
| 4646 } | 4646 } |
| 4647 } | 4647 } |
| 4648 } | 4648 } |
| 4649 } | 4649 } |
| 4650 } else if (methodName3 == "JS") { | 4650 } else if (methodName2 == "JS") { |
| 4651 Type2 returnType = getFirstArgumentAsType(_typeProvider.objectType.eleme
nt.library, node.argumentList); | 4651 Type2 returnType = getFirstArgumentAsType(_typeProvider.objectType.eleme
nt.library, node.argumentList); |
| 4652 if (returnType != null) { | 4652 if (returnType != null) { |
| 4653 return recordType(node, returnType); | 4653 return recordType(node, returnType); |
| 4654 } | 4654 } |
| 4655 } | 4655 } |
| 4656 } | 4656 } |
| 4657 return recordReturnType(node, node.methodName.element); | 4657 return recordReturnType(node, node.methodName.element); |
| 4658 } | 4658 } |
| 4659 Object visitNamedExpression(NamedExpression node) => recordType(node, getType2
(node.expression)); | 4659 Object visitNamedExpression(NamedExpression node) => recordType(node, getType2
(node.expression)); |
| 4660 /** | 4660 /** |
| (...skipping 27 matching lines...) Expand all Loading... |
| 4688 * <p> | 4688 * <p> |
| 4689 * A postfix expression of the form <i>e1[e2]--</i> is equivalent to <i>(a, i)
{var r = a[i]; a[i] | 4689 * A postfix expression of the form <i>e1[e2]--</i> is equivalent to <i>(a, i)
{var r = a[i]; a[i] |
| 4690 * = r - 1; return r}(e1, e2)</i></blockquote> | 4690 * = r - 1; return r}(e1, e2)</i></blockquote> |
| 4691 */ | 4691 */ |
| 4692 Object visitPostfixExpression(PostfixExpression node) => recordType(node, getT
ype2(node.operand)); | 4692 Object visitPostfixExpression(PostfixExpression node) => recordType(node, getT
ype2(node.operand)); |
| 4693 /** | 4693 /** |
| 4694 * See {@link #visitSimpleIdentifier(SimpleIdentifier)}. | 4694 * See {@link #visitSimpleIdentifier(SimpleIdentifier)}. |
| 4695 */ | 4695 */ |
| 4696 Object visitPrefixedIdentifier(PrefixedIdentifier node) { | 4696 Object visitPrefixedIdentifier(PrefixedIdentifier node) { |
| 4697 SimpleIdentifier prefixedIdentifier = node.identifier; | 4697 SimpleIdentifier prefixedIdentifier = node.identifier; |
| 4698 Element element35 = prefixedIdentifier.element; | 4698 Element element2 = prefixedIdentifier.element; |
| 4699 if (element35 == null) { | 4699 if (element2 == null) { |
| 4700 return recordType(node, _dynamicType); | 4700 return recordType(node, _dynamicType); |
| 4701 } | 4701 } |
| 4702 if (USE_TYPE_PROPAGATION) { | 4702 if (USE_TYPE_PROPAGATION) { |
| 4703 Type2 type = _overrideManager.getType(element35); | 4703 Type2 type = _overrideManager.getType(element2); |
| 4704 if (type != null) { | 4704 if (type != null) { |
| 4705 return recordType(node, type); | 4705 return recordType(node, type); |
| 4706 } | 4706 } |
| 4707 } | 4707 } |
| 4708 Type2 type; | 4708 Type2 type; |
| 4709 if (element35 is ClassElement) { | 4709 if (element2 is ClassElement) { |
| 4710 if (isNotTypeLiteral(node)) { | 4710 if (isNotTypeLiteral(node)) { |
| 4711 type = ((element35 as ClassElement)).type; | 4711 type = ((element2 as ClassElement)).type; |
| 4712 } else { | 4712 } else { |
| 4713 type = _typeProvider.typeType; | 4713 type = _typeProvider.typeType; |
| 4714 } | 4714 } |
| 4715 } else if (element35 is FunctionTypeAliasElement) { | 4715 } else if (element2 is FunctionTypeAliasElement) { |
| 4716 type = ((element35 as FunctionTypeAliasElement)).type; | 4716 type = ((element2 as FunctionTypeAliasElement)).type; |
| 4717 } else if (element35 is MethodElement) { | 4717 } else if (element2 is MethodElement) { |
| 4718 type = ((element35 as MethodElement)).type; | 4718 type = ((element2 as MethodElement)).type; |
| 4719 } else if (element35 is PropertyAccessorElement) { | 4719 } else if (element2 is PropertyAccessorElement) { |
| 4720 type = getType3((element35 as PropertyAccessorElement), node.prefix.static
Type); | 4720 type = getType3((element2 as PropertyAccessorElement), node.prefix.staticT
ype); |
| 4721 } else if (element35 is ExecutableElement) { | 4721 } else if (element2 is ExecutableElement) { |
| 4722 type = ((element35 as ExecutableElement)).type; | 4722 type = ((element2 as ExecutableElement)).type; |
| 4723 } else if (element35 is TypeVariableElement) { | 4723 } else if (element2 is TypeVariableElement) { |
| 4724 type = ((element35 as TypeVariableElement)).type; | 4724 type = ((element2 as TypeVariableElement)).type; |
| 4725 } else if (element35 is VariableElement) { | 4725 } else if (element2 is VariableElement) { |
| 4726 type = ((element35 as VariableElement)).type; | 4726 type = ((element2 as VariableElement)).type; |
| 4727 } else { | 4727 } else { |
| 4728 type = _dynamicType; | 4728 type = _dynamicType; |
| 4729 } | 4729 } |
| 4730 recordType(prefixedIdentifier, type); | 4730 recordType(prefixedIdentifier, type); |
| 4731 return recordType(node, type); | 4731 return recordType(node, type); |
| 4732 } | 4732 } |
| 4733 /** | 4733 /** |
| 4734 * The Dart Language Specification, 12.27: <blockquote>A unary expression <i>u
</i> of the form | 4734 * The Dart Language Specification, 12.27: <blockquote>A unary expression <i>u
</i> of the form |
| 4735 * <i>op e</i> is equivalent to a method invocation <i>expression e.op()</i>.
An expression of the | 4735 * <i>op e</i> is equivalent to a method invocation <i>expression e.op()</i>.
An expression of the |
| 4736 * form <i>op super</i> is equivalent to the method invocation <i>super.op()<i
>.</blockquote> | 4736 * form <i>op super</i> is equivalent to the method invocation <i>super.op()<i
>.</blockquote> |
| 4737 */ | 4737 */ |
| 4738 Object visitPrefixExpression(PrefixExpression node) { | 4738 Object visitPrefixExpression(PrefixExpression node) { |
| 4739 sc.TokenType operator13 = node.operator.type; | 4739 sc.TokenType operator2 = node.operator.type; |
| 4740 if (identical(operator13, sc.TokenType.BANG)) { | 4740 if (identical(operator2, sc.TokenType.BANG)) { |
| 4741 return recordType(node, _typeProvider.boolType); | 4741 return recordType(node, _typeProvider.boolType); |
| 4742 } | 4742 } |
| 4743 return recordReturnType(node, node.element); | 4743 return recordReturnType(node, node.element); |
| 4744 } | 4744 } |
| 4745 /** | 4745 /** |
| 4746 * The Dart Language Specification, 12.13: <blockquote> Property extraction al
lows for a member of | 4746 * The Dart Language Specification, 12.13: <blockquote> Property extraction al
lows for a member of |
| 4747 * an object to be concisely extracted from the object. If <i>o</i> is an obje
ct, and if <i>m</i> | 4747 * an object to be concisely extracted from the object. If <i>o</i> is an obje
ct, and if <i>m</i> |
| 4748 * is the name of a method member of <i>o</i>, then | 4748 * is the name of a method member of <i>o</i>, then |
| 4749 * <ul> | 4749 * <ul> |
| 4750 * <li><i>o.m</i> is defined to be equivalent to: <i>(r<sub>1</sub>, …,
r<sub>n</sub>, | 4750 * <li><i>o.m</i> is defined to be equivalent to: <i>(r<sub>1</sub>, …,
r<sub>n</sub>, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 4780 * The static type of <i>i</i> is the declared return type of <i>C.m</i> if it
exists or dynamic | 4780 * The static type of <i>i</i> is the declared return type of <i>C.m</i> if it
exists or dynamic |
| 4781 * otherwise. | 4781 * otherwise. |
| 4782 * <p> | 4782 * <p> |
| 4783 * ... a top-level getter invocation <i>i</i> of the form <i>m</i>, where <i>m
</i> is an | 4783 * ... a top-level getter invocation <i>i</i> of the form <i>m</i>, where <i>m
</i> is an |
| 4784 * identifier ... | 4784 * identifier ... |
| 4785 * <p> | 4785 * <p> |
| 4786 * The static type of <i>i</i> is the declared return type of <i>m</i>.</block
quote> | 4786 * The static type of <i>i</i> is the declared return type of <i>m</i>.</block
quote> |
| 4787 */ | 4787 */ |
| 4788 Object visitPropertyAccess(PropertyAccess node) { | 4788 Object visitPropertyAccess(PropertyAccess node) { |
| 4789 SimpleIdentifier propertyName2 = node.propertyName; | 4789 SimpleIdentifier propertyName2 = node.propertyName; |
| 4790 Element element36 = propertyName2.element; | 4790 Element element2 = propertyName2.element; |
| 4791 if (USE_TYPE_PROPAGATION) { | 4791 if (USE_TYPE_PROPAGATION) { |
| 4792 Type2 type = _overrideManager.getType(element36); | 4792 Type2 type = _overrideManager.getType(element2); |
| 4793 if (type != null) { | 4793 if (type != null) { |
| 4794 return recordType(node, type); | 4794 return recordType(node, type); |
| 4795 } | 4795 } |
| 4796 } | 4796 } |
| 4797 if (element36 is MethodElement) { | 4797 if (element2 is MethodElement) { |
| 4798 FunctionType type19 = ((element36 as MethodElement)).type; | 4798 FunctionType type2 = ((element2 as MethodElement)).type; |
| 4799 recordType(propertyName2, type19); | 4799 recordType(propertyName2, type2); |
| 4800 return recordType(node, type19); | 4800 return recordType(node, type2); |
| 4801 } else if (element36 is PropertyAccessorElement) { | 4801 } else if (element2 is PropertyAccessorElement) { |
| 4802 Type2 propertyType = getType3((element36 as PropertyAccessorElement), node
.target != null ? node.target.staticType : null); | 4802 Type2 propertyType = getType3((element2 as PropertyAccessorElement), node.
target != null ? node.target.staticType : null); |
| 4803 recordType(propertyName2, propertyType); | 4803 recordType(propertyName2, propertyType); |
| 4804 return recordType(node, propertyType); | 4804 return recordType(node, propertyType); |
| 4805 } else { | 4805 } else { |
| 4806 } | 4806 } |
| 4807 recordType(propertyName2, _dynamicType); | 4807 recordType(propertyName2, _dynamicType); |
| 4808 return recordType(node, _dynamicType); | 4808 return recordType(node, _dynamicType); |
| 4809 } | 4809 } |
| 4810 /** | 4810 /** |
| 4811 * The Dart Language Specification, 12.9: <blockquote>The static type of a ret
hrow expression is | 4811 * The Dart Language Specification, 12.9: <blockquote>The static type of a ret
hrow expression is |
| 4812 * bottom.</blockquote> | 4812 * bottom.</blockquote> |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4848 * <li>If <i>d</i> is the declaration of a top level getter, then <i>e</i> is
equivalent to the | 4848 * <li>If <i>d</i> is the declaration of a top level getter, then <i>e</i> is
equivalent to the |
| 4849 * getter invocation <i>id</i>. | 4849 * getter invocation <i>id</i>. |
| 4850 * <li>Otherwise, if <i>e</i> occurs inside a top level or static function (be
it function, | 4850 * <li>Otherwise, if <i>e</i> occurs inside a top level or static function (be
it function, |
| 4851 * method, getter, or setter) or variable initializer, evaluation of e causes
a NoSuchMethodError | 4851 * method, getter, or setter) or variable initializer, evaluation of e causes
a NoSuchMethodError |
| 4852 * to be thrown. | 4852 * to be thrown. |
| 4853 * <li>Otherwise <i>e</i> is equivalent to the property extraction <i>this.id<
/i>. | 4853 * <li>Otherwise <i>e</i> is equivalent to the property extraction <i>this.id<
/i>. |
| 4854 * </ul> | 4854 * </ul> |
| 4855 * </blockquote> | 4855 * </blockquote> |
| 4856 */ | 4856 */ |
| 4857 Object visitSimpleIdentifier(SimpleIdentifier node) { | 4857 Object visitSimpleIdentifier(SimpleIdentifier node) { |
| 4858 Element element37 = node.element; | 4858 Element element2 = node.element; |
| 4859 if (element37 == null) { | 4859 if (element2 == null) { |
| 4860 return recordType(node, _dynamicType); | 4860 return recordType(node, _dynamicType); |
| 4861 } | 4861 } |
| 4862 if (USE_TYPE_PROPAGATION) { | 4862 if (USE_TYPE_PROPAGATION) { |
| 4863 Type2 type = _overrideManager.getType(element37); | 4863 Type2 type = _overrideManager.getType(element2); |
| 4864 if (type != null) { | 4864 if (type != null) { |
| 4865 return recordType(node, type); | 4865 return recordType(node, type); |
| 4866 } | 4866 } |
| 4867 } | 4867 } |
| 4868 Type2 type; | 4868 Type2 type; |
| 4869 if (element37 is ClassElement) { | 4869 if (element2 is ClassElement) { |
| 4870 if (isNotTypeLiteral(node)) { | 4870 if (isNotTypeLiteral(node)) { |
| 4871 type = ((element37 as ClassElement)).type; | 4871 type = ((element2 as ClassElement)).type; |
| 4872 } else { | 4872 } else { |
| 4873 type = _typeProvider.typeType; | 4873 type = _typeProvider.typeType; |
| 4874 } | 4874 } |
| 4875 } else if (element37 is FunctionTypeAliasElement) { | 4875 } else if (element2 is FunctionTypeAliasElement) { |
| 4876 type = ((element37 as FunctionTypeAliasElement)).type; | 4876 type = ((element2 as FunctionTypeAliasElement)).type; |
| 4877 } else if (element37 is MethodElement) { | 4877 } else if (element2 is MethodElement) { |
| 4878 type = ((element37 as MethodElement)).type; | 4878 type = ((element2 as MethodElement)).type; |
| 4879 } else if (element37 is PropertyAccessorElement) { | 4879 } else if (element2 is PropertyAccessorElement) { |
| 4880 type = getType3((element37 as PropertyAccessorElement), null); | 4880 type = getType3((element2 as PropertyAccessorElement), null); |
| 4881 } else if (element37 is ExecutableElement) { | 4881 } else if (element2 is ExecutableElement) { |
| 4882 type = ((element37 as ExecutableElement)).type; | 4882 type = ((element2 as ExecutableElement)).type; |
| 4883 } else if (element37 is TypeVariableElement) { | 4883 } else if (element2 is TypeVariableElement) { |
| 4884 type = ((element37 as TypeVariableElement)).type; | 4884 type = ((element2 as TypeVariableElement)).type; |
| 4885 } else if (element37 is VariableElement) { | 4885 } else if (element2 is VariableElement) { |
| 4886 type = ((element37 as VariableElement)).type; | 4886 type = ((element2 as VariableElement)).type; |
| 4887 } else if (element37 is PrefixElement) { | 4887 } else if (element2 is PrefixElement) { |
| 4888 return null; | 4888 return null; |
| 4889 } else { | 4889 } else { |
| 4890 type = _dynamicType; | 4890 type = _dynamicType; |
| 4891 } | 4891 } |
| 4892 return recordType(node, type); | 4892 return recordType(node, type); |
| 4893 } | 4893 } |
| 4894 /** | 4894 /** |
| 4895 * The Dart Language Specification, 12.5: <blockquote>The static type of a str
ing literal is{@code String}.</blockquote> | 4895 * The Dart Language Specification, 12.5: <blockquote>The static type of a str
ing literal is{@code String}.</blockquote> |
| 4896 */ | 4896 */ |
| 4897 Object visitSimpleStringLiteral(SimpleStringLiteral node) => recordType(node,
_typeProvider.stringType); | 4897 Object visitSimpleStringLiteral(SimpleStringLiteral node) => recordType(node,
_typeProvider.stringType); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 4917 return recordType(node, _thisType); | 4917 return recordType(node, _thisType); |
| 4918 } | 4918 } |
| 4919 } | 4919 } |
| 4920 /** | 4920 /** |
| 4921 * The Dart Language Specification, 12.8: <blockquote>The static type of a thr
ow expression is | 4921 * The Dart Language Specification, 12.8: <blockquote>The static type of a thr
ow expression is |
| 4922 * bottom.</blockquote> | 4922 * bottom.</blockquote> |
| 4923 */ | 4923 */ |
| 4924 Object visitThrowExpression(ThrowExpression node) => recordType(node, _typePro
vider.bottomType); | 4924 Object visitThrowExpression(ThrowExpression node) => recordType(node, _typePro
vider.bottomType); |
| 4925 Object visitVariableDeclaration(VariableDeclaration node) { | 4925 Object visitVariableDeclaration(VariableDeclaration node) { |
| 4926 if (USE_TYPE_PROPAGATION) { | 4926 if (USE_TYPE_PROPAGATION) { |
| 4927 Expression initializer6 = node.initializer; | 4927 Expression initializer2 = node.initializer; |
| 4928 if (initializer6 != null) { | 4928 if (initializer2 != null) { |
| 4929 Type2 rightType = getType2(initializer6); | 4929 Type2 rightType = getType2(initializer2); |
| 4930 VariableElement element38 = node.name.element as VariableElement; | 4930 VariableElement element2 = node.name.element as VariableElement; |
| 4931 if (element38 != null) { | 4931 if (element2 != null) { |
| 4932 override(element38, getType(element38), rightType); | 4932 override(element2, getType(element2), rightType); |
| 4933 } | 4933 } |
| 4934 } | 4934 } |
| 4935 } | 4935 } |
| 4936 return null; | 4936 return null; |
| 4937 } | 4937 } |
| 4938 /** | 4938 /** |
| 4939 * Given a function declaration, compute the return type of the function. The
return type of | 4939 * Given a function declaration, compute the return type of the function. The
return type of |
| 4940 * functions with a block body is {@code dynamicType}, with an expression body
it is the type of | 4940 * functions with a block body is {@code dynamicType}, with an expression body
it is the type of |
| 4941 * the expression. | 4941 * the expression. |
| 4942 * @param node the function expression whose return type is to be computed | 4942 * @param node the function expression whose return type is to be computed |
| 4943 * @return the return type that was computed | 4943 * @return the return type that was computed |
| 4944 */ | 4944 */ |
| 4945 Type2 computeReturnType(FunctionDeclaration node) { | 4945 Type2 computeReturnType(FunctionDeclaration node) { |
| 4946 TypeName returnType9 = node.returnType; | 4946 TypeName returnType2 = node.returnType; |
| 4947 if (returnType9 == null) { | 4947 if (returnType2 == null) { |
| 4948 return computeReturnType2(node.functionExpression); | 4948 return computeReturnType2(node.functionExpression); |
| 4949 } | 4949 } |
| 4950 return returnType9.type; | 4950 return returnType2.type; |
| 4951 } | 4951 } |
| 4952 /** | 4952 /** |
| 4953 * Given a function expression, compute the return type of the function. The r
eturn type of | 4953 * Given a function expression, compute the return type of the function. The r
eturn type of |
| 4954 * functions with a block body is {@code dynamicType}, with an expression body
it is the type of | 4954 * functions with a block body is {@code dynamicType}, with an expression body
it is the type of |
| 4955 * the expression. | 4955 * the expression. |
| 4956 * @param node the function expression whose return type is to be computed | 4956 * @param node the function expression whose return type is to be computed |
| 4957 * @return the return type that was computed | 4957 * @return the return type that was computed |
| 4958 */ | 4958 */ |
| 4959 Type2 computeReturnType2(FunctionExpression node) { | 4959 Type2 computeReturnType2(FunctionExpression node) { |
| 4960 FunctionBody body4 = node.body; | 4960 FunctionBody body2 = node.body; |
| 4961 if (body4 is ExpressionFunctionBody) { | 4961 if (body2 is ExpressionFunctionBody) { |
| 4962 return getType2(((body4 as ExpressionFunctionBody)).expression); | 4962 return getType2(((body2 as ExpressionFunctionBody)).expression); |
| 4963 } | 4963 } |
| 4964 return _dynamicType; | 4964 return _dynamicType; |
| 4965 } | 4965 } |
| 4966 /** | 4966 /** |
| 4967 * If the given argument list contains at least one argument, and if the argum
ent is a simple | 4967 * If the given argument list contains at least one argument, and if the argum
ent is a simple |
| 4968 * string literal, then parse that argument as a query string and return the t
ype specified by the | 4968 * string literal, then parse that argument as a query string and return the t
ype specified by the |
| 4969 * argument. | 4969 * argument. |
| 4970 * @param library the library in which the specified type would be defined | 4970 * @param library the library in which the specified type would be defined |
| 4971 * @param argumentList the list of arguments from which a type is to be extrac
ted | 4971 * @param argumentList the list of arguments from which a type is to be extrac
ted |
| 4972 * @return the type specified by the first argument in the argument list | 4972 * @return the type specified by the first argument in the argument list |
| (...skipping 17 matching lines...) Expand all Loading... |
| 4990 } | 4990 } |
| 4991 return null; | 4991 return null; |
| 4992 } | 4992 } |
| 4993 /** | 4993 /** |
| 4994 * If the given argument list contains at least one argument, and if the argum
ent is a simple | 4994 * If the given argument list contains at least one argument, and if the argum
ent is a simple |
| 4995 * string literal, return the String value of the argument. | 4995 * string literal, return the String value of the argument. |
| 4996 * @param argumentList the list of arguments from which a string value is to b
e extracted | 4996 * @param argumentList the list of arguments from which a string value is to b
e extracted |
| 4997 * @return the string specified by the first argument in the argument list | 4997 * @return the string specified by the first argument in the argument list |
| 4998 */ | 4998 */ |
| 4999 String getFirstArgumentAsString(ArgumentList argumentList) { | 4999 String getFirstArgumentAsString(ArgumentList argumentList) { |
| 5000 NodeList<Expression> arguments6 = argumentList.arguments; | 5000 NodeList<Expression> arguments2 = argumentList.arguments; |
| 5001 if (arguments6.length > 0) { | 5001 if (arguments2.length > 0) { |
| 5002 Expression argument = arguments6[0]; | 5002 Expression argument = arguments2[0]; |
| 5003 if (argument is SimpleStringLiteral) { | 5003 if (argument is SimpleStringLiteral) { |
| 5004 return ((argument as SimpleStringLiteral)).value; | 5004 return ((argument as SimpleStringLiteral)).value; |
| 5005 } | 5005 } |
| 5006 } | 5006 } |
| 5007 return null; | 5007 return null; |
| 5008 } | 5008 } |
| 5009 /** | 5009 /** |
| 5010 * If the given argument list contains at least one argument, and if the argum
ent is a simple | 5010 * If the given argument list contains at least one argument, and if the argum
ent is a simple |
| 5011 * string literal, and if the value of the argument is the name of a class def
ined within the | 5011 * string literal, and if the value of the argument is the name of a class def
ined within the |
| 5012 * given library, return the type specified by the argument. | 5012 * given library, return the type specified by the argument. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5067 Type2 getType3(PropertyAccessorElement accessor, Type2 context) { | 5067 Type2 getType3(PropertyAccessorElement accessor, Type2 context) { |
| 5068 FunctionType functionType = accessor.type; | 5068 FunctionType functionType = accessor.type; |
| 5069 if (functionType == null) { | 5069 if (functionType == null) { |
| 5070 return _dynamicType; | 5070 return _dynamicType; |
| 5071 } | 5071 } |
| 5072 if (accessor.isSetter()) { | 5072 if (accessor.isSetter()) { |
| 5073 List<Type2> parameterTypes = functionType.normalParameterTypes; | 5073 List<Type2> parameterTypes = functionType.normalParameterTypes; |
| 5074 if (parameterTypes != null && parameterTypes.length > 0) { | 5074 if (parameterTypes != null && parameterTypes.length > 0) { |
| 5075 return parameterTypes[0]; | 5075 return parameterTypes[0]; |
| 5076 } | 5076 } |
| 5077 PropertyAccessorElement getter4 = accessor.variable.getter; | 5077 PropertyAccessorElement getter2 = accessor.variable.getter; |
| 5078 if (getter4 != null) { | 5078 if (getter2 != null) { |
| 5079 functionType = getter4.type; | 5079 functionType = getter2.type; |
| 5080 if (functionType != null) { | 5080 if (functionType != null) { |
| 5081 return functionType.returnType; | 5081 return functionType.returnType; |
| 5082 } | 5082 } |
| 5083 } | 5083 } |
| 5084 return _dynamicType; | 5084 return _dynamicType; |
| 5085 } | 5085 } |
| 5086 Type2 returnType10 = functionType.returnType; | 5086 Type2 returnType2 = functionType.returnType; |
| 5087 if (returnType10 is TypeVariableType && context is InterfaceType) { | 5087 if (returnType2 is TypeVariableType && context is InterfaceType) { |
| 5088 InterfaceType interfaceTypeContext = (context as InterfaceType); | 5088 InterfaceType interfaceTypeContext = (context as InterfaceType); |
| 5089 List<TypeVariableElement> parameterElements = interfaceTypeContext.element
!= null ? interfaceTypeContext.element.typeVariables : null; | 5089 List<TypeVariableElement> parameterElements = interfaceTypeContext.element
!= null ? interfaceTypeContext.element.typeVariables : null; |
| 5090 if (parameterElements != null) { | 5090 if (parameterElements != null) { |
| 5091 for (int i = 0; i < parameterElements.length; i++) { | 5091 for (int i = 0; i < parameterElements.length; i++) { |
| 5092 TypeVariableElement varElt = parameterElements[i]; | 5092 TypeVariableElement varElt = parameterElements[i]; |
| 5093 if (returnType10.name == varElt.name) { | 5093 if (returnType2.name == varElt.name) { |
| 5094 return interfaceTypeContext.typeArguments[i]; | 5094 return interfaceTypeContext.typeArguments[i]; |
| 5095 } | 5095 } |
| 5096 } | 5096 } |
| 5097 } | 5097 } |
| 5098 } | 5098 } |
| 5099 return returnType10; | 5099 return returnType2; |
| 5100 } | 5100 } |
| 5101 /** | 5101 /** |
| 5102 * Return the type represented by the given type name. | 5102 * Return the type represented by the given type name. |
| 5103 * @param typeName the type name representing the type to be returned | 5103 * @param typeName the type name representing the type to be returned |
| 5104 * @return the type represented by the type name | 5104 * @return the type represented by the type name |
| 5105 */ | 5105 */ |
| 5106 Type2 getType4(TypeName typeName) { | 5106 Type2 getType4(TypeName typeName) { |
| 5107 Type2 type20 = typeName.type; | 5107 Type2 type2 = typeName.type; |
| 5108 if (type20 == null) { | 5108 if (type2 == null) { |
| 5109 return _dynamicType; | 5109 return _dynamicType; |
| 5110 } | 5110 } |
| 5111 return type20; | 5111 return type2; |
| 5112 } | 5112 } |
| 5113 /** | 5113 /** |
| 5114 * Return {@code true} if the given library is the 'dart:html' library. | 5114 * Return {@code true} if the given library is the 'dart:html' library. |
| 5115 * @param library the library being tested | 5115 * @param library the library being tested |
| 5116 * @return {@code true} if the library is 'dart:html' | 5116 * @return {@code true} if the library is 'dart:html' |
| 5117 */ | 5117 */ |
| 5118 bool isHtmlLibrary(LibraryElement library) => library.name == "dart.dom.html"; | 5118 bool isHtmlLibrary(LibraryElement library) => library.name == "dart.dom.html"; |
| 5119 /** | 5119 /** |
| 5120 * Return {@code true} if the given node is not a type literal. | 5120 * Return {@code true} if the given node is not a type literal. |
| 5121 * @param node the node being tested | 5121 * @param node the node being tested |
| 5122 * @return {@code true} if the given node is not a type literal | 5122 * @return {@code true} if the given node is not a type literal |
| 5123 */ | 5123 */ |
| 5124 bool isNotTypeLiteral(Identifier node) { | 5124 bool isNotTypeLiteral(Identifier node) { |
| 5125 ASTNode parent16 = node.parent; | 5125 ASTNode parent2 = node.parent; |
| 5126 return parent16 is TypeName || (parent16 is PrefixedIdentifier && (parent16.
parent is TypeName || identical(((parent16 as PrefixedIdentifier)).prefix, node)
)) || (parent16 is PropertyAccess && identical(((parent16 as PropertyAccess)).ta
rget, node)) || (parent16 is MethodInvocation && identical(node, ((parent16 as M
ethodInvocation)).target)); | 5126 return parent2 is TypeName || (parent2 is PrefixedIdentifier && (parent2.par
ent is TypeName || identical(((parent2 as PrefixedIdentifier)).prefix, node))) |
| (parent2 is PropertyAccess && identical(((parent2 as PropertyAccess)).target,
node)) || (parent2 is MethodInvocation && identical(node, ((parent2 as MethodInv
ocation)).target)); |
| 5127 } | 5127 } |
| 5128 /** | 5128 /** |
| 5129 * If it is appropriate to do so, override the type of the given element. Use
the static type and | 5129 * If it is appropriate to do so, override the type of the given element. Use
the static type and |
| 5130 * inferred type of the element to determine whether or not it is appropriate. | 5130 * inferred type of the element to determine whether or not it is appropriate. |
| 5131 * @param element the element whose type might be overridden | 5131 * @param element the element whose type might be overridden |
| 5132 * @param staticType the static type of the element | 5132 * @param staticType the static type of the element |
| 5133 * @param inferredType the inferred type of the element | 5133 * @param inferredType the inferred type of the element |
| 5134 */ | 5134 */ |
| 5135 void override(VariableElement element, Type2 staticType, Type2 inferredType) { | 5135 void override(VariableElement element, Type2 staticType, Type2 inferredType) { |
| 5136 if (identical(inferredType, BottomTypeImpl.instance) || element is! Variable
Element) { | 5136 if (identical(inferredType, BottomTypeImpl.instance) || element is! Variable
Element) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 5147 } | 5147 } |
| 5148 } | 5148 } |
| 5149 /** | 5149 /** |
| 5150 * Record that the static type of the given node is the type of the second arg
ument to the method | 5150 * Record that the static type of the given node is the type of the second arg
ument to the method |
| 5151 * represented by the given element. | 5151 * represented by the given element. |
| 5152 * @param expression the node whose type is to be recorded | 5152 * @param expression the node whose type is to be recorded |
| 5153 * @param element the element representing the method invoked by the given nod
e | 5153 * @param element the element representing the method invoked by the given nod
e |
| 5154 */ | 5154 */ |
| 5155 Object recordArgumentType(IndexExpression expression, MethodElement element) { | 5155 Object recordArgumentType(IndexExpression expression, MethodElement element) { |
| 5156 if (element != null) { | 5156 if (element != null) { |
| 5157 List<ParameterElement> parameters14 = element.parameters; | 5157 List<ParameterElement> parameters2 = element.parameters; |
| 5158 if (parameters14 != null && parameters14.length == 2) { | 5158 if (parameters2 != null && parameters2.length == 2) { |
| 5159 return recordType(expression, parameters14[1].type); | 5159 return recordType(expression, parameters2[1].type); |
| 5160 } | 5160 } |
| 5161 } | 5161 } |
| 5162 return recordType(expression, _dynamicType); | 5162 return recordType(expression, _dynamicType); |
| 5163 } | 5163 } |
| 5164 /** | 5164 /** |
| 5165 * Record that the static type of the given node is the return type of the met
hod or function | 5165 * Record that the static type of the given node is the return type of the met
hod or function |
| 5166 * represented by the given element. | 5166 * represented by the given element. |
| 5167 * @param expression the node whose type is to be recorded | 5167 * @param expression the node whose type is to be recorded |
| 5168 * @param element the element representing the method or function invoked by t
he given node | 5168 * @param element the element representing the method or function invoked by t
he given node |
| 5169 */ | 5169 */ |
| 5170 Object recordReturnType(Expression expression, Element element) { | 5170 Object recordReturnType(Expression expression, Element element) { |
| 5171 if (element is PropertyAccessorElement) { | 5171 if (element is PropertyAccessorElement) { |
| 5172 FunctionType propertyType = ((element as PropertyAccessorElement)).type; | 5172 FunctionType propertyType = ((element as PropertyAccessorElement)).type; |
| 5173 if (propertyType != null) { | 5173 if (propertyType != null) { |
| 5174 Type2 returnType11 = propertyType.returnType; | 5174 Type2 returnType2 = propertyType.returnType; |
| 5175 if (returnType11 is FunctionType) { | 5175 if (returnType2 is FunctionType) { |
| 5176 Type2 innerReturnType = ((returnType11 as FunctionType)).returnType; | 5176 Type2 innerReturnType = ((returnType2 as FunctionType)).returnType; |
| 5177 if (innerReturnType != null) { | 5177 if (innerReturnType != null) { |
| 5178 return recordType(expression, innerReturnType); | 5178 return recordType(expression, innerReturnType); |
| 5179 } | 5179 } |
| 5180 } else if (returnType11.isDartCoreFunction()) { | 5180 } else if (returnType2.isDartCoreFunction()) { |
| 5181 return recordType(expression, _dynamicType); | 5181 return recordType(expression, _dynamicType); |
| 5182 } | 5182 } |
| 5183 if (returnType11 != null) { | 5183 if (returnType2 != null) { |
| 5184 return recordType(expression, returnType11); | 5184 return recordType(expression, returnType2); |
| 5185 } | 5185 } |
| 5186 } | 5186 } |
| 5187 } else if (element is ExecutableElement) { | 5187 } else if (element is ExecutableElement) { |
| 5188 FunctionType type21 = ((element as ExecutableElement)).type; | 5188 FunctionType type2 = ((element as ExecutableElement)).type; |
| 5189 if (type21 != null) { | 5189 if (type2 != null) { |
| 5190 return recordType(expression, type21.returnType); | 5190 return recordType(expression, type2.returnType); |
| 5191 } | 5191 } |
| 5192 } else if (element is VariableElement) { | 5192 } else if (element is VariableElement) { |
| 5193 Type2 variableType = ((element as VariableElement)).type; | 5193 Type2 variableType = ((element as VariableElement)).type; |
| 5194 if (variableType is FunctionType) { | 5194 if (variableType is FunctionType) { |
| 5195 return recordType(expression, ((variableType as FunctionType)).returnTyp
e); | 5195 return recordType(expression, ((variableType as FunctionType)).returnTyp
e); |
| 5196 } | 5196 } |
| 5197 } | 5197 } |
| 5198 return recordType(expression, _dynamicType); | 5198 return recordType(expression, _dynamicType); |
| 5199 } | 5199 } |
| 5200 /** | 5200 /** |
| 5201 * Record that the static type of the given node is the given type. | 5201 * Record that the static type of the given node is the given type. |
| 5202 * @param expression the node whose type is to be recorded | 5202 * @param expression the node whose type is to be recorded |
| 5203 * @param type the static type of the node | 5203 * @param type the static type of the node |
| 5204 */ | 5204 */ |
| 5205 Object recordType(Expression expression, Type2 type) { | 5205 Object recordType(Expression expression, Type2 type) { |
| 5206 if (type == null) { | 5206 if (type == null) { |
| 5207 expression.staticType = _dynamicType; | 5207 expression.staticType = _dynamicType; |
| 5208 } else { | 5208 } else { |
| 5209 expression.staticType = type; | 5209 expression.staticType = type; |
| 5210 } | 5210 } |
| 5211 return null; | 5211 return null; |
| 5212 } | 5212 } |
| 5213 /** | 5213 /** |
| 5214 * Set the return type and parameter type information for the given function t
ype based on the | 5214 * Set the return type and parameter type information for the given function t
ype based on the |
| 5215 * given return type and parameter elements. | 5215 * given return type and parameter elements. |
| 5216 * @param functionType the function type to be filled in | 5216 * @param functionType the function type to be filled in |
| 5217 * @param returnType the return type of the function, or {@code null} if no ty
pe was declared | 5217 * @param returnType the return type of the function, or {@code null} if no ty
pe was declared |
| 5218 * @param parameters the elements representing the parameters to the function | 5218 * @param parameters the elements representing the parameters to the function |
| 5219 */ | 5219 */ |
| 5220 void setTypeInformation(FunctionTypeImpl functionType, Type2 returnType14, For
malParameterList parameterList) { | 5220 void setTypeInformation(FunctionTypeImpl functionType, Type2 returnType2, Form
alParameterList parameterList) { |
| 5221 List<Type2> normalParameterTypes = new List<Type2>(); | 5221 List<Type2> normalParameterTypes = new List<Type2>(); |
| 5222 List<Type2> optionalParameterTypes = new List<Type2>(); | 5222 List<Type2> optionalParameterTypes = new List<Type2>(); |
| 5223 LinkedHashMap<String, Type2> namedParameterTypes = new LinkedHashMap<String,
Type2>(); | 5223 LinkedHashMap<String, Type2> namedParameterTypes = new LinkedHashMap<String,
Type2>(); |
| 5224 if (parameterList != null) { | 5224 if (parameterList != null) { |
| 5225 for (ParameterElement parameter in parameterList.elements) { | 5225 for (ParameterElement parameter in parameterList.elements) { |
| 5226 while (true) { | 5226 while (true) { |
| 5227 if (parameter.parameterKind == ParameterKind.REQUIRED) { | 5227 if (parameter.parameterKind == ParameterKind.REQUIRED) { |
| 5228 normalParameterTypes.add(parameter.type); | 5228 normalParameterTypes.add(parameter.type); |
| 5229 } else if (parameter.parameterKind == ParameterKind.POSITIONAL) { | 5229 } else if (parameter.parameterKind == ParameterKind.POSITIONAL) { |
| 5230 optionalParameterTypes.add(parameter.type); | 5230 optionalParameterTypes.add(parameter.type); |
| 5231 } else if (parameter.parameterKind == ParameterKind.NAMED) { | 5231 } else if (parameter.parameterKind == ParameterKind.NAMED) { |
| 5232 namedParameterTypes[parameter.name] = parameter.type; | 5232 namedParameterTypes[parameter.name] = parameter.type; |
| 5233 } | 5233 } |
| 5234 break; | 5234 break; |
| 5235 } | 5235 } |
| 5236 } | 5236 } |
| 5237 } | 5237 } |
| 5238 functionType.normalParameterTypes = new List.from(normalParameterTypes); | 5238 functionType.normalParameterTypes = new List.from(normalParameterTypes); |
| 5239 functionType.optionalParameterTypes = new List.from(optionalParameterTypes); | 5239 functionType.optionalParameterTypes = new List.from(optionalParameterTypes); |
| 5240 functionType.namedParameterTypes = namedParameterTypes; | 5240 functionType.namedParameterTypes = namedParameterTypes; |
| 5241 functionType.returnType = returnType14; | 5241 functionType.returnType = returnType2; |
| 5242 } | 5242 } |
| 5243 get thisType_J2DAccessor => _thisType; | 5243 get thisType_J2DAccessor => _thisType; |
| 5244 set thisType_J2DAccessor(__v) => _thisType = __v; | 5244 set thisType_J2DAccessor(__v) => _thisType = __v; |
| 5245 } | 5245 } |
| 5246 /** | 5246 /** |
| 5247 * Instances of the class {@code TypeOverrideManager} manage the ability to over
ride the type of an | 5247 * Instances of the class {@code TypeOverrideManager} manage the ability to over
ride the type of an |
| 5248 * element within a given context. | 5248 * element within a given context. |
| 5249 */ | 5249 */ |
| 5250 class TypeOverrideManager { | 5250 class TypeOverrideManager { |
| 5251 /** | 5251 /** |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5573 SimpleIdentifier exception = node.exceptionParameter; | 5573 SimpleIdentifier exception = node.exceptionParameter; |
| 5574 if (exception != null) { | 5574 if (exception != null) { |
| 5575 TypeName exceptionTypeName = node.exceptionType; | 5575 TypeName exceptionTypeName = node.exceptionType; |
| 5576 Type2 exceptionType; | 5576 Type2 exceptionType; |
| 5577 if (exceptionTypeName == null) { | 5577 if (exceptionTypeName == null) { |
| 5578 exceptionType = typeProvider.objectType; | 5578 exceptionType = typeProvider.objectType; |
| 5579 } else { | 5579 } else { |
| 5580 exceptionType = getType5(exceptionTypeName); | 5580 exceptionType = getType5(exceptionTypeName); |
| 5581 } | 5581 } |
| 5582 recordType(exception, exceptionType); | 5582 recordType(exception, exceptionType); |
| 5583 Element element39 = exception.element; | 5583 Element element2 = exception.element; |
| 5584 if (element39 is VariableElementImpl) { | 5584 if (element2 is VariableElementImpl) { |
| 5585 ((element39 as VariableElementImpl)).type = exceptionType; | 5585 ((element2 as VariableElementImpl)).type = exceptionType; |
| 5586 } else { | 5586 } else { |
| 5587 } | 5587 } |
| 5588 } | 5588 } |
| 5589 SimpleIdentifier stackTrace = node.stackTraceParameter; | 5589 SimpleIdentifier stackTrace = node.stackTraceParameter; |
| 5590 if (stackTrace != null) { | 5590 if (stackTrace != null) { |
| 5591 recordType(stackTrace, typeProvider.stackTraceType); | 5591 recordType(stackTrace, typeProvider.stackTraceType); |
| 5592 } | 5592 } |
| 5593 return null; | 5593 return null; |
| 5594 } | 5594 } |
| 5595 Object visitClassDeclaration(ClassDeclaration node) { | 5595 Object visitClassDeclaration(ClassDeclaration node) { |
| 5596 super.visitClassDeclaration(node); | 5596 super.visitClassDeclaration(node); |
| 5597 ClassElementImpl classElement = getClassElement(node.name); | 5597 ClassElementImpl classElement = getClassElement(node.name); |
| 5598 InterfaceType superclassType = null; | 5598 InterfaceType superclassType = null; |
| 5599 ExtendsClause extendsClause4 = node.extendsClause; | 5599 ExtendsClause extendsClause2 = node.extendsClause; |
| 5600 if (extendsClause4 != null) { | 5600 if (extendsClause2 != null) { |
| 5601 superclassType = resolveType(extendsClause4.superclass, CompileTimeErrorCo
de.EXTENDS_NON_CLASS); | 5601 superclassType = resolveType(extendsClause2.superclass, CompileTimeErrorCo
de.EXTENDS_NON_CLASS); |
| 5602 if (superclassType != typeProvider.objectType) { | 5602 if (superclassType != typeProvider.objectType) { |
| 5603 classElement.validMixin = false; | 5603 classElement.validMixin = false; |
| 5604 } | 5604 } |
| 5605 } | 5605 } |
| 5606 if (classElement != null) { | 5606 if (classElement != null) { |
| 5607 if (superclassType == null) { | 5607 if (superclassType == null) { |
| 5608 InterfaceType objectType2 = typeProvider.objectType; | 5608 InterfaceType objectType2 = typeProvider.objectType; |
| 5609 if (classElement.type != objectType2) { | 5609 if (classElement.type != objectType2) { |
| 5610 superclassType = objectType2; | 5610 superclassType = objectType2; |
| 5611 } | 5611 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 5623 superclassType = typeProvider.objectType; | 5623 superclassType = typeProvider.objectType; |
| 5624 } | 5624 } |
| 5625 if (classElement != null && superclassType != null) { | 5625 if (classElement != null && superclassType != null) { |
| 5626 classElement.supertype = superclassType; | 5626 classElement.supertype = superclassType; |
| 5627 } | 5627 } |
| 5628 resolve(classElement, node.withClause, node.implementsClause); | 5628 resolve(classElement, node.withClause, node.implementsClause); |
| 5629 return null; | 5629 return null; |
| 5630 } | 5630 } |
| 5631 Object visitConstructorDeclaration(ConstructorDeclaration node) { | 5631 Object visitConstructorDeclaration(ConstructorDeclaration node) { |
| 5632 super.visitConstructorDeclaration(node); | 5632 super.visitConstructorDeclaration(node); |
| 5633 ExecutableElementImpl element40 = node.element as ExecutableElementImpl; | 5633 ExecutableElementImpl element2 = node.element as ExecutableElementImpl; |
| 5634 FunctionTypeImpl type = new FunctionTypeImpl.con1(element40); | 5634 FunctionTypeImpl type = new FunctionTypeImpl.con1(element2); |
| 5635 setTypeInformation(type, null, element40.parameters); | 5635 setTypeInformation(type, null, element2.parameters); |
| 5636 type.returnType = ((element40.enclosingElement as ClassElement)).type; | 5636 type.returnType = ((element2.enclosingElement as ClassElement)).type; |
| 5637 element40.type = type; | 5637 element2.type = type; |
| 5638 return null; | 5638 return null; |
| 5639 } | 5639 } |
| 5640 Object visitDeclaredIdentifier(DeclaredIdentifier node) { | 5640 Object visitDeclaredIdentifier(DeclaredIdentifier node) { |
| 5641 super.visitDeclaredIdentifier(node); | 5641 super.visitDeclaredIdentifier(node); |
| 5642 Type2 declaredType; | 5642 Type2 declaredType; |
| 5643 TypeName typeName = node.type; | 5643 TypeName typeName = node.type; |
| 5644 if (typeName == null) { | 5644 if (typeName == null) { |
| 5645 declaredType = _dynamicType; | 5645 declaredType = _dynamicType; |
| 5646 } else { | 5646 } else { |
| 5647 declaredType = getType5(typeName); | 5647 declaredType = getType5(typeName); |
| 5648 } | 5648 } |
| 5649 LocalVariableElementImpl element41 = node.element as LocalVariableElementImp
l; | 5649 LocalVariableElementImpl element2 = node.element as LocalVariableElementImpl
; |
| 5650 element41.type = declaredType; | 5650 element2.type = declaredType; |
| 5651 return null; | 5651 return null; |
| 5652 } | 5652 } |
| 5653 Object visitDefaultFormalParameter(DefaultFormalParameter node) { | 5653 Object visitDefaultFormalParameter(DefaultFormalParameter node) { |
| 5654 super.visitDefaultFormalParameter(node); | 5654 super.visitDefaultFormalParameter(node); |
| 5655 return null; | 5655 return null; |
| 5656 } | 5656 } |
| 5657 Object visitFieldFormalParameter(FieldFormalParameter node) { | 5657 Object visitFieldFormalParameter(FieldFormalParameter node) { |
| 5658 super.visitFieldFormalParameter(node); | 5658 super.visitFieldFormalParameter(node); |
| 5659 Element element42 = node.identifier.element; | 5659 Element element2 = node.identifier.element; |
| 5660 if (element42 is ParameterElementImpl) { | 5660 if (element2 is ParameterElementImpl) { |
| 5661 ParameterElementImpl parameter = element42 as ParameterElementImpl; | 5661 ParameterElementImpl parameter = element2 as ParameterElementImpl; |
| 5662 Type2 type; | 5662 Type2 type; |
| 5663 TypeName typeName = node.type; | 5663 TypeName typeName = node.type; |
| 5664 if (typeName == null) { | 5664 if (typeName == null) { |
| 5665 type = _dynamicType; | 5665 type = _dynamicType; |
| 5666 } else { | 5666 } else { |
| 5667 type = getType5(typeName); | 5667 type = getType5(typeName); |
| 5668 } | 5668 } |
| 5669 parameter.type = type; | 5669 parameter.type = type; |
| 5670 } else { | 5670 } else { |
| 5671 } | 5671 } |
| 5672 return null; | 5672 return null; |
| 5673 } | 5673 } |
| 5674 Object visitFunctionDeclaration(FunctionDeclaration node) { | 5674 Object visitFunctionDeclaration(FunctionDeclaration node) { |
| 5675 super.visitFunctionDeclaration(node); | 5675 super.visitFunctionDeclaration(node); |
| 5676 ExecutableElementImpl element43 = node.element as ExecutableElementImpl; | 5676 ExecutableElementImpl element2 = node.element as ExecutableElementImpl; |
| 5677 FunctionTypeImpl type = new FunctionTypeImpl.con1(element43); | 5677 FunctionTypeImpl type = new FunctionTypeImpl.con1(element2); |
| 5678 setTypeInformation(type, node.returnType, element43.parameters); | 5678 setTypeInformation(type, node.returnType, element2.parameters); |
| 5679 element43.type = type; | 5679 element2.type = type; |
| 5680 return null; | 5680 return null; |
| 5681 } | 5681 } |
| 5682 Object visitFunctionTypeAlias(FunctionTypeAlias node) { | 5682 Object visitFunctionTypeAlias(FunctionTypeAlias node) { |
| 5683 super.visitFunctionTypeAlias(node); | 5683 super.visitFunctionTypeAlias(node); |
| 5684 FunctionTypeAliasElementImpl element44 = node.element as FunctionTypeAliasEl
ementImpl; | 5684 FunctionTypeAliasElementImpl element2 = node.element as FunctionTypeAliasEle
mentImpl; |
| 5685 FunctionTypeImpl type22 = element44.type as FunctionTypeImpl; | 5685 FunctionTypeImpl type2 = element2.type as FunctionTypeImpl; |
| 5686 setTypeInformation(type22, node.returnType, element44.parameters); | 5686 setTypeInformation(type2, node.returnType, element2.parameters); |
| 5687 return null; | 5687 return null; |
| 5688 } | 5688 } |
| 5689 Object visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) { | 5689 Object visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) { |
| 5690 super.visitFunctionTypedFormalParameter(node); | 5690 super.visitFunctionTypedFormalParameter(node); |
| 5691 ParameterElementImpl element45 = node.identifier.element as ParameterElement
Impl; | 5691 ParameterElementImpl element2 = node.identifier.element as ParameterElementI
mpl; |
| 5692 FunctionTypeImpl type = new FunctionTypeImpl.con1((null as ExecutableElement
)); | 5692 FunctionTypeImpl type = new FunctionTypeImpl.con1((null as ExecutableElement
)); |
| 5693 setTypeInformation(type, node.returnType, getElements(node.parameters)); | 5693 setTypeInformation(type, node.returnType, getElements(node.parameters)); |
| 5694 element45.type = type; | 5694 element2.type = type; |
| 5695 return null; | 5695 return null; |
| 5696 } | 5696 } |
| 5697 Object visitMethodDeclaration(MethodDeclaration node) { | 5697 Object visitMethodDeclaration(MethodDeclaration node) { |
| 5698 super.visitMethodDeclaration(node); | 5698 super.visitMethodDeclaration(node); |
| 5699 ExecutableElementImpl element46 = node.element as ExecutableElementImpl; | 5699 ExecutableElementImpl element2 = node.element as ExecutableElementImpl; |
| 5700 FunctionTypeImpl type = new FunctionTypeImpl.con1(element46); | 5700 FunctionTypeImpl type = new FunctionTypeImpl.con1(element2); |
| 5701 setTypeInformation(type, node.returnType, element46.parameters); | 5701 setTypeInformation(type, node.returnType, element2.parameters); |
| 5702 element46.type = type; | 5702 element2.type = type; |
| 5703 if (element46 is PropertyAccessorElement) { | 5703 if (element2 is PropertyAccessorElement) { |
| 5704 PropertyAccessorElement accessor = element46 as PropertyAccessorElement; | 5704 PropertyAccessorElement accessor = element2 as PropertyAccessorElement; |
| 5705 PropertyInducingElementImpl variable6 = accessor.variable as PropertyInduc
ingElementImpl; | 5705 PropertyInducingElementImpl variable2 = accessor.variable as PropertyInduc
ingElementImpl; |
| 5706 if (accessor.isGetter()) { | 5706 if (accessor.isGetter()) { |
| 5707 variable6.type = type.returnType; | 5707 variable2.type = type.returnType; |
| 5708 } else if (variable6.type == null) { | 5708 } else if (variable2.type == null) { |
| 5709 List<Type2> parameterTypes = type.normalParameterTypes; | 5709 List<Type2> parameterTypes = type.normalParameterTypes; |
| 5710 if (parameterTypes != null && parameterTypes.length > 0) { | 5710 if (parameterTypes != null && parameterTypes.length > 0) { |
| 5711 variable6.type = parameterTypes[0]; | 5711 variable2.type = parameterTypes[0]; |
| 5712 } | 5712 } |
| 5713 } | 5713 } |
| 5714 } | 5714 } |
| 5715 return null; | 5715 return null; |
| 5716 } | 5716 } |
| 5717 Object visitSimpleFormalParameter(SimpleFormalParameter node) { | 5717 Object visitSimpleFormalParameter(SimpleFormalParameter node) { |
| 5718 super.visitSimpleFormalParameter(node); | 5718 super.visitSimpleFormalParameter(node); |
| 5719 Type2 declaredType; | 5719 Type2 declaredType; |
| 5720 TypeName typeName = node.type; | 5720 TypeName typeName = node.type; |
| 5721 if (typeName == null) { | 5721 if (typeName == null) { |
| 5722 declaredType = _dynamicType; | 5722 declaredType = _dynamicType; |
| 5723 } else { | 5723 } else { |
| 5724 declaredType = getType5(typeName); | 5724 declaredType = getType5(typeName); |
| 5725 } | 5725 } |
| 5726 Element element47 = node.identifier.element; | 5726 Element element2 = node.identifier.element; |
| 5727 if (element47 is ParameterElement) { | 5727 if (element2 is ParameterElement) { |
| 5728 ((element47 as ParameterElementImpl)).type = declaredType; | 5728 ((element2 as ParameterElementImpl)).type = declaredType; |
| 5729 } else { | 5729 } else { |
| 5730 } | 5730 } |
| 5731 return null; | 5731 return null; |
| 5732 } | 5732 } |
| 5733 Object visitTypeName(TypeName node) { | 5733 Object visitTypeName(TypeName node) { |
| 5734 super.visitTypeName(node); | 5734 super.visitTypeName(node); |
| 5735 Identifier typeName = node.name; | 5735 Identifier typeName = node.name; |
| 5736 TypeArgumentList argumentList = node.typeArguments; | 5736 TypeArgumentList argumentList = node.typeArguments; |
| 5737 Element element = nameScope.lookup(typeName, definingLibrary); | 5737 Element element = nameScope.lookup(typeName, definingLibrary); |
| 5738 if (element == null) { | 5738 if (element == null) { |
| 5739 if (typeName.name == _dynamicType.name) { | 5739 if (typeName.name == _dynamicType.name) { |
| 5740 setElement(typeName, _dynamicType.element); | 5740 setElement(typeName, _dynamicType.element); |
| 5741 if (argumentList != null) { | 5741 if (argumentList != null) { |
| 5742 } | 5742 } |
| 5743 typeName.staticType = _dynamicType; | 5743 typeName.staticType = _dynamicType; |
| 5744 node.type = _dynamicType; | 5744 node.type = _dynamicType; |
| 5745 return null; | 5745 return null; |
| 5746 } | 5746 } |
| 5747 VoidTypeImpl voidType = VoidTypeImpl.instance; | 5747 VoidTypeImpl voidType = VoidTypeImpl.instance; |
| 5748 if (typeName.name == voidType.name) { | 5748 if (typeName.name == voidType.name) { |
| 5749 if (argumentList != null) { | 5749 if (argumentList != null) { |
| 5750 } | 5750 } |
| 5751 typeName.staticType = voidType; | 5751 typeName.staticType = voidType; |
| 5752 node.type = voidType; | 5752 node.type = voidType; |
| 5753 return null; | 5753 return null; |
| 5754 } | 5754 } |
| 5755 ASTNode parent17 = node.parent; | 5755 ASTNode parent2 = node.parent; |
| 5756 if (typeName is PrefixedIdentifier && parent17 is ConstructorName && argum
entList == null) { | 5756 if (typeName is PrefixedIdentifier && parent2 is ConstructorName && argume
ntList == null) { |
| 5757 ConstructorName name = parent17 as ConstructorName; | 5757 ConstructorName name = parent2 as ConstructorName; |
| 5758 if (name.name == null) { | 5758 if (name.name == null) { |
| 5759 SimpleIdentifier prefix7 = ((typeName as PrefixedIdentifier)).prefix; | 5759 SimpleIdentifier prefix2 = ((typeName as PrefixedIdentifier)).prefix; |
| 5760 element = nameScope.lookup(prefix7, definingLibrary); | 5760 element = nameScope.lookup(prefix2, definingLibrary); |
| 5761 if (element is PrefixElement) { | 5761 if (element is PrefixElement) { |
| 5762 return null; | 5762 return null; |
| 5763 } else if (element != null) { | 5763 } else if (element != null) { |
| 5764 name.name = ((typeName as PrefixedIdentifier)).identifier; | 5764 name.name = ((typeName as PrefixedIdentifier)).identifier; |
| 5765 name.period = ((typeName as PrefixedIdentifier)).period; | 5765 name.period = ((typeName as PrefixedIdentifier)).period; |
| 5766 node.name = prefix7; | 5766 node.name = prefix2; |
| 5767 typeName = prefix7; | 5767 typeName = prefix2; |
| 5768 } | 5768 } |
| 5769 } | 5769 } |
| 5770 } | 5770 } |
| 5771 } | 5771 } |
| 5772 if (element == null) { | 5772 if (element == null) { |
| 5773 Identifier simpleIdentifier; | 5773 Identifier simpleIdentifier; |
| 5774 if (typeName is SimpleIdentifier) { | 5774 if (typeName is SimpleIdentifier) { |
| 5775 simpleIdentifier = typeName; | 5775 simpleIdentifier = typeName; |
| 5776 } else { | 5776 } else { |
| 5777 simpleIdentifier = ((typeName as PrefixedIdentifier)).prefix; | 5777 simpleIdentifier = ((typeName as PrefixedIdentifier)).prefix; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 5800 if (type != null) { | 5800 if (type != null) { |
| 5801 node.type = type; | 5801 node.type = type; |
| 5802 } | 5802 } |
| 5803 } else { | 5803 } else { |
| 5804 setElement(typeName, _dynamicType.element); | 5804 setElement(typeName, _dynamicType.element); |
| 5805 typeName.staticType = _dynamicType; | 5805 typeName.staticType = _dynamicType; |
| 5806 node.type = _dynamicType; | 5806 node.type = _dynamicType; |
| 5807 return null; | 5807 return null; |
| 5808 } | 5808 } |
| 5809 if (argumentList != null) { | 5809 if (argumentList != null) { |
| 5810 NodeList<TypeName> arguments7 = argumentList.arguments; | 5810 NodeList<TypeName> arguments2 = argumentList.arguments; |
| 5811 int argumentCount = arguments7.length; | 5811 int argumentCount = arguments2.length; |
| 5812 List<Type2> parameters = getTypeArguments(type); | 5812 List<Type2> parameters = getTypeArguments(type); |
| 5813 int parameterCount = parameters.length; | 5813 int parameterCount = parameters.length; |
| 5814 int count = Math.min(argumentCount, parameterCount); | 5814 int count = Math.min(argumentCount, parameterCount); |
| 5815 List<Type2> typeArguments = new List<Type2>(); | 5815 List<Type2> typeArguments = new List<Type2>(); |
| 5816 for (int i = 0; i < count; i++) { | 5816 for (int i = 0; i < count; i++) { |
| 5817 Type2 argumentType = getType5(arguments7[i]); | 5817 Type2 argumentType = getType5(arguments2[i]); |
| 5818 if (argumentType != null) { | 5818 if (argumentType != null) { |
| 5819 typeArguments.add(argumentType); | 5819 typeArguments.add(argumentType); |
| 5820 } | 5820 } |
| 5821 } | 5821 } |
| 5822 if (argumentCount != parameterCount) { | 5822 if (argumentCount != parameterCount) { |
| 5823 reportError(getInvalidTypeParametersErrorCode(node), node, [typeName.nam
e, parameterCount, argumentCount]); | 5823 reportError(getInvalidTypeParametersErrorCode(node), node, [typeName.nam
e, parameterCount, argumentCount]); |
| 5824 } | 5824 } |
| 5825 argumentCount = typeArguments.length; | 5825 argumentCount = typeArguments.length; |
| 5826 if (argumentCount < parameterCount) { | 5826 if (argumentCount < parameterCount) { |
| 5827 for (int i = argumentCount; i < parameterCount; i++) { | 5827 for (int i = argumentCount; i < parameterCount; i++) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 5854 } | 5854 } |
| 5855 Object visitVariableDeclaration(VariableDeclaration node) { | 5855 Object visitVariableDeclaration(VariableDeclaration node) { |
| 5856 super.visitVariableDeclaration(node); | 5856 super.visitVariableDeclaration(node); |
| 5857 Type2 declaredType; | 5857 Type2 declaredType; |
| 5858 TypeName typeName = ((node.parent as VariableDeclarationList)).type; | 5858 TypeName typeName = ((node.parent as VariableDeclarationList)).type; |
| 5859 if (typeName == null) { | 5859 if (typeName == null) { |
| 5860 declaredType = _dynamicType; | 5860 declaredType = _dynamicType; |
| 5861 } else { | 5861 } else { |
| 5862 declaredType = getType5(typeName); | 5862 declaredType = getType5(typeName); |
| 5863 } | 5863 } |
| 5864 Element element48 = node.name.element; | 5864 Element element2 = node.name.element; |
| 5865 if (element48 is VariableElement) { | 5865 if (element2 is VariableElement) { |
| 5866 ((element48 as VariableElementImpl)).type = declaredType; | 5866 ((element2 as VariableElementImpl)).type = declaredType; |
| 5867 if (element48 is PropertyInducingElement) { | 5867 if (element2 is PropertyInducingElement) { |
| 5868 PropertyInducingElement variableElement = element48 as PropertyInducingE
lement; | 5868 PropertyInducingElement variableElement = element2 as PropertyInducingEl
ement; |
| 5869 PropertyAccessorElementImpl getter5 = variableElement.getter as Property
AccessorElementImpl; | 5869 PropertyAccessorElementImpl getter2 = variableElement.getter as Property
AccessorElementImpl; |
| 5870 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter5); | 5870 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter2); |
| 5871 getterType.returnType = declaredType; | 5871 getterType.returnType = declaredType; |
| 5872 getter5.type = getterType; | 5872 getter2.type = getterType; |
| 5873 PropertyAccessorElementImpl setter4 = variableElement.setter as Property
AccessorElementImpl; | 5873 PropertyAccessorElementImpl setter2 = variableElement.setter as Property
AccessorElementImpl; |
| 5874 if (setter4 != null) { | 5874 if (setter2 != null) { |
| 5875 FunctionTypeImpl setterType = new FunctionTypeImpl.con1(setter4); | 5875 FunctionTypeImpl setterType = new FunctionTypeImpl.con1(setter2); |
| 5876 setterType.returnType = VoidTypeImpl.instance; | 5876 setterType.returnType = VoidTypeImpl.instance; |
| 5877 setterType.normalParameterTypes = <Type2> [declaredType]; | 5877 setterType.normalParameterTypes = <Type2> [declaredType]; |
| 5878 setter4.type = setterType; | 5878 setter2.type = setterType; |
| 5879 } | 5879 } |
| 5880 } | 5880 } |
| 5881 } else { | 5881 } else { |
| 5882 } | 5882 } |
| 5883 return null; | 5883 return null; |
| 5884 } | 5884 } |
| 5885 /** | 5885 /** |
| 5886 * Return the class element that represents the class whose name was provided. | 5886 * Return the class element that represents the class whose name was provided. |
| 5887 * @param identifier the name from the declaration of a class | 5887 * @param identifier the name from the declaration of a class |
| 5888 * @return the class element that represents the class | 5888 * @return the class element that represents the class |
| 5889 */ | 5889 */ |
| 5890 ClassElementImpl getClassElement(SimpleIdentifier identifier) { | 5890 ClassElementImpl getClassElement(SimpleIdentifier identifier) { |
| 5891 if (identifier == null) { | 5891 if (identifier == null) { |
| 5892 return null; | 5892 return null; |
| 5893 } | 5893 } |
| 5894 Element element49 = identifier.element; | 5894 Element element2 = identifier.element; |
| 5895 if (element49 is! ClassElementImpl) { | 5895 if (element2 is! ClassElementImpl) { |
| 5896 return null; | 5896 return null; |
| 5897 } | 5897 } |
| 5898 return element49 as ClassElementImpl; | 5898 return element2 as ClassElementImpl; |
| 5899 } | 5899 } |
| 5900 /** | 5900 /** |
| 5901 * Return an array containing all of the elements associated with the paramete
rs in the given | 5901 * Return an array containing all of the elements associated with the paramete
rs in the given |
| 5902 * list. | 5902 * list. |
| 5903 * @param parameterList the list of parameters whose elements are to be return
ed | 5903 * @param parameterList the list of parameters whose elements are to be return
ed |
| 5904 * @return the elements associated with the parameters | 5904 * @return the elements associated with the parameters |
| 5905 */ | 5905 */ |
| 5906 List<ParameterElement> getElements(FormalParameterList parameterList) { | 5906 List<ParameterElement> getElements(FormalParameterList parameterList) { |
| 5907 List<ParameterElement> elements = new List<ParameterElement>(); | 5907 List<ParameterElement> elements = new List<ParameterElement>(); |
| 5908 for (FormalParameter parameter in parameterList.parameters) { | 5908 for (FormalParameter parameter in parameterList.parameters) { |
| 5909 ParameterElement element50 = parameter.identifier.element as ParameterElem
ent; | 5909 ParameterElement element2 = parameter.identifier.element as ParameterEleme
nt; |
| 5910 if (element50 != null) { | 5910 if (element2 != null) { |
| 5911 elements.add(element50); | 5911 elements.add(element2); |
| 5912 } | 5912 } |
| 5913 } | 5913 } |
| 5914 return new List.from(elements); | 5914 return new List.from(elements); |
| 5915 } | 5915 } |
| 5916 /** | 5916 /** |
| 5917 * The number of type arguments in the given type name does not match the numb
er of parameters in | 5917 * The number of type arguments in the given type name does not match the numb
er of parameters in |
| 5918 * the corresponding class element. Return the error code that should be used
to report this | 5918 * the corresponding class element. Return the error code that should be used
to report this |
| 5919 * error. | 5919 * error. |
| 5920 * @param node the type name with the wrong number of type arguments | 5920 * @param node the type name with the wrong number of type arguments |
| 5921 * @return the error code that should be used to report that the wrong number
of type arguments | 5921 * @return the error code that should be used to report that the wrong number
of type arguments |
| 5922 * were provided | 5922 * were provided |
| 5923 */ | 5923 */ |
| 5924 ErrorCode getInvalidTypeParametersErrorCode(TypeName node) { | 5924 ErrorCode getInvalidTypeParametersErrorCode(TypeName node) { |
| 5925 ASTNode parent18 = node.parent; | 5925 ASTNode parent2 = node.parent; |
| 5926 if (parent18 is ConstructorName) { | 5926 if (parent2 is ConstructorName) { |
| 5927 parent18 = parent18.parent; | 5927 parent2 = parent2.parent; |
| 5928 if (parent18 is InstanceCreationExpression) { | 5928 if (parent2 is InstanceCreationExpression) { |
| 5929 if (((parent18 as InstanceCreationExpression)).isConst()) { | 5929 if (((parent2 as InstanceCreationExpression)).isConst()) { |
| 5930 return CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS; | 5930 return CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS; |
| 5931 } else { | 5931 } else { |
| 5932 return CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS; | 5932 return CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS; |
| 5933 } | 5933 } |
| 5934 } | 5934 } |
| 5935 } | 5935 } |
| 5936 return StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS; | 5936 return StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS; |
| 5937 } | 5937 } |
| 5938 /** | 5938 /** |
| 5939 * Given the multiple elements to which a single name could potentially be res
olved, return the | 5939 * Given the multiple elements to which a single name could potentially be res
olved, return the |
| (...skipping 12 matching lines...) Expand all Loading... |
| 5952 } | 5952 } |
| 5953 } | 5953 } |
| 5954 return type; | 5954 return type; |
| 5955 } | 5955 } |
| 5956 /** | 5956 /** |
| 5957 * Return the type represented by the given type name. | 5957 * Return the type represented by the given type name. |
| 5958 * @param typeName the type name representing the type to be returned | 5958 * @param typeName the type name representing the type to be returned |
| 5959 * @return the type represented by the type name | 5959 * @return the type represented by the type name |
| 5960 */ | 5960 */ |
| 5961 Type2 getType5(TypeName typeName) { | 5961 Type2 getType5(TypeName typeName) { |
| 5962 Type2 type23 = typeName.type; | 5962 Type2 type2 = typeName.type; |
| 5963 if (type23 == null) { | 5963 if (type2 == null) { |
| 5964 return _dynamicType; | 5964 return _dynamicType; |
| 5965 } | 5965 } |
| 5966 return type23; | 5966 return type2; |
| 5967 } | 5967 } |
| 5968 /** | 5968 /** |
| 5969 * Return the type arguments associated with the given type. | 5969 * Return the type arguments associated with the given type. |
| 5970 * @param type the type whole type arguments are to be returned | 5970 * @param type the type whole type arguments are to be returned |
| 5971 * @return the type arguments associated with the given type | 5971 * @return the type arguments associated with the given type |
| 5972 */ | 5972 */ |
| 5973 List<Type2> getTypeArguments(Type2 type) { | 5973 List<Type2> getTypeArguments(Type2 type) { |
| 5974 if (type is InterfaceType) { | 5974 if (type is InterfaceType) { |
| 5975 return ((type as InterfaceType)).typeArguments; | 5975 return ((type as InterfaceType)).typeArguments; |
| 5976 } else if (type is FunctionType) { | 5976 } else if (type is FunctionType) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 6000 * @param implementsClause the implements clause to be resolved | 6000 * @param implementsClause the implements clause to be resolved |
| 6001 */ | 6001 */ |
| 6002 void resolve(ClassElementImpl classElement, WithClause withClause, ImplementsC
lause implementsClause) { | 6002 void resolve(ClassElementImpl classElement, WithClause withClause, ImplementsC
lause implementsClause) { |
| 6003 if (withClause != null) { | 6003 if (withClause != null) { |
| 6004 List<InterfaceType> mixinTypes2 = resolveTypes(withClause.mixinTypes, Comp
ileTimeErrorCode.MIXIN_OF_NON_CLASS); | 6004 List<InterfaceType> mixinTypes2 = resolveTypes(withClause.mixinTypes, Comp
ileTimeErrorCode.MIXIN_OF_NON_CLASS); |
| 6005 if (classElement != null) { | 6005 if (classElement != null) { |
| 6006 classElement.mixins = mixinTypes2; | 6006 classElement.mixins = mixinTypes2; |
| 6007 } | 6007 } |
| 6008 } | 6008 } |
| 6009 if (implementsClause != null) { | 6009 if (implementsClause != null) { |
| 6010 NodeList<TypeName> interfaces3 = implementsClause.interfaces; | 6010 NodeList<TypeName> interfaces2 = implementsClause.interfaces; |
| 6011 List<InterfaceType> interfaceTypes = resolveTypes(interfaces3, CompileTime
ErrorCode.IMPLEMENTS_NON_CLASS); | 6011 List<InterfaceType> interfaceTypes = resolveTypes(interfaces2, CompileTime
ErrorCode.IMPLEMENTS_NON_CLASS); |
| 6012 List<TypeName> typeNames = new List.from(interfaces3); | 6012 List<TypeName> typeNames = new List.from(interfaces2); |
| 6013 String dynamicKeyword = sc.Keyword.DYNAMIC.syntax; | 6013 String dynamicKeyword = sc.Keyword.DYNAMIC.syntax; |
| 6014 List<bool> detectedRepeatOnIndex = new List<bool>.filled(typeNames.length,
false); | 6014 List<bool> detectedRepeatOnIndex = new List<bool>.filled(typeNames.length,
false); |
| 6015 for (int i = 0; i < detectedRepeatOnIndex.length; i++) { | 6015 for (int i = 0; i < detectedRepeatOnIndex.length; i++) { |
| 6016 detectedRepeatOnIndex[i] = false; | 6016 detectedRepeatOnIndex[i] = false; |
| 6017 } | 6017 } |
| 6018 for (int i = 0; i < typeNames.length; i++) { | 6018 for (int i = 0; i < typeNames.length; i++) { |
| 6019 TypeName typeName = typeNames[i]; | 6019 TypeName typeName = typeNames[i]; |
| 6020 String name19 = typeName.name.name; | 6020 String name3 = typeName.name.name; |
| 6021 if (name19 == dynamicKeyword) { | 6021 if (name3 == dynamicKeyword) { |
| 6022 reportError(CompileTimeErrorCode.IMPLEMENTS_DYNAMIC, typeName, []); | 6022 reportError(CompileTimeErrorCode.IMPLEMENTS_DYNAMIC, typeName, []); |
| 6023 } else { | 6023 } else { |
| 6024 Element element51 = typeName.name.element; | 6024 Element element3 = typeName.name.element; |
| 6025 if (element51 != null && element51 == classElement) { | 6025 if (element3 != null && element3 == classElement) { |
| 6026 reportError(CompileTimeErrorCode.IMPLEMENTS_SELF, typeName, [name19]
); | 6026 reportError(CompileTimeErrorCode.IMPLEMENTS_SELF, typeName, [name3])
; |
| 6027 } | 6027 } |
| 6028 } | 6028 } |
| 6029 if (!detectedRepeatOnIndex[i]) { | 6029 if (!detectedRepeatOnIndex[i]) { |
| 6030 for (int j = i + 1; j < typeNames.length; j++) { | 6030 for (int j = i + 1; j < typeNames.length; j++) { |
| 6031 Element element52 = typeName.name.element; | 6031 Element element4 = typeName.name.element; |
| 6032 TypeName typeName2 = typeNames[j]; | 6032 TypeName typeName2 = typeNames[j]; |
| 6033 Identifier identifier2 = typeName2.name; | 6033 Identifier identifier2 = typeName2.name; |
| 6034 String name2 = identifier2.name; | 6034 String name2 = identifier2.name; |
| 6035 Element element2 = identifier2.element; | 6035 Element element2 = identifier2.element; |
| 6036 if (element52 != null && element52 == element2) { | 6036 if (element4 != null && element4 == element2) { |
| 6037 detectedRepeatOnIndex[j] = true; | 6037 detectedRepeatOnIndex[j] = true; |
| 6038 reportError(CompileTimeErrorCode.IMPLEMENTS_REPEATED, typeName2, [
name2]); | 6038 reportError(CompileTimeErrorCode.IMPLEMENTS_REPEATED, typeName2, [
name2]); |
| 6039 } | 6039 } |
| 6040 } | 6040 } |
| 6041 } | 6041 } |
| 6042 } | 6042 } |
| 6043 if (classElement != null) { | 6043 if (classElement != null) { |
| 6044 classElement.interfaces = interfaceTypes; | 6044 classElement.interfaces = interfaceTypes; |
| 6045 } | 6045 } |
| 6046 } | 6046 } |
| 6047 } | 6047 } |
| 6048 /** | 6048 /** |
| 6049 * Return the type specified by the given name. | 6049 * Return the type specified by the given name. |
| 6050 * @param typeName the type name specifying the type to be returned | 6050 * @param typeName the type name specifying the type to be returned |
| 6051 * @param nonTypeError the error to produce if the type name is defined to be
something other than | 6051 * @param nonTypeError the error to produce if the type name is defined to be
something other than |
| 6052 * a type | 6052 * a type |
| 6053 * @return the type specified by the type name | 6053 * @return the type specified by the type name |
| 6054 */ | 6054 */ |
| 6055 InterfaceType resolveType(TypeName typeName, ErrorCode nonTypeError) { | 6055 InterfaceType resolveType(TypeName typeName, ErrorCode nonTypeError) { |
| 6056 Type2 type24 = typeName.type; | 6056 Type2 type2 = typeName.type; |
| 6057 if (type24 is InterfaceType) { | 6057 if (type2 is InterfaceType) { |
| 6058 return type24 as InterfaceType; | 6058 return type2 as InterfaceType; |
| 6059 } | 6059 } |
| 6060 Identifier name20 = typeName.name; | 6060 Identifier name2 = typeName.name; |
| 6061 if (name20.name != sc.Keyword.DYNAMIC.syntax) { | 6061 if (name2.name != sc.Keyword.DYNAMIC.syntax) { |
| 6062 reportError(nonTypeError, name20, [name20.name]); | 6062 reportError(nonTypeError, name2, [name2.name]); |
| 6063 } | 6063 } |
| 6064 return null; | 6064 return null; |
| 6065 } | 6065 } |
| 6066 /** | 6066 /** |
| 6067 * Resolve the types in the given list of type names. | 6067 * Resolve the types in the given list of type names. |
| 6068 * @param typeNames the type names to be resolved | 6068 * @param typeNames the type names to be resolved |
| 6069 * @param nonTypeError the error to produce if the type name is defined to be
something other than | 6069 * @param nonTypeError the error to produce if the type name is defined to be
something other than |
| 6070 * a type | 6070 * a type |
| 6071 * @return an array containing all of the types that were resolved. | 6071 * @return an array containing all of the types that were resolved. |
| 6072 */ | 6072 */ |
| 6073 List<InterfaceType> resolveTypes(NodeList<TypeName> typeNames, ErrorCode nonTy
peError) { | 6073 List<InterfaceType> resolveTypes(NodeList<TypeName> typeNames, ErrorCode nonTy
peError) { |
| 6074 List<InterfaceType> types = new List<InterfaceType>(); | 6074 List<InterfaceType> types = new List<InterfaceType>(); |
| 6075 for (TypeName typeName in typeNames) { | 6075 for (TypeName typeName in typeNames) { |
| 6076 InterfaceType type = resolveType(typeName, nonTypeError); | 6076 InterfaceType type = resolveType(typeName, nonTypeError); |
| 6077 if (type != null) { | 6077 if (type != null) { |
| 6078 types.add(type); | 6078 types.add(type); |
| 6079 } | 6079 } |
| 6080 } | 6080 } |
| 6081 return new List.from(types); | 6081 return new List.from(types); |
| 6082 } | 6082 } |
| 6083 void setElement(Identifier typeName, Element element69) { | 6083 void setElement(Identifier typeName, Element element2) { |
| 6084 if (element69 != null) { | 6084 if (element2 != null) { |
| 6085 if (typeName is SimpleIdentifier) { | 6085 if (typeName is SimpleIdentifier) { |
| 6086 ((typeName as SimpleIdentifier)).element = element69; | 6086 ((typeName as SimpleIdentifier)).element = element2; |
| 6087 } else if (typeName is PrefixedIdentifier) { | 6087 } else if (typeName is PrefixedIdentifier) { |
| 6088 PrefixedIdentifier identifier = typeName as PrefixedIdentifier; | 6088 PrefixedIdentifier identifier = typeName as PrefixedIdentifier; |
| 6089 identifier.identifier.element = element69; | 6089 identifier.identifier.element = element2; |
| 6090 SimpleIdentifier prefix8 = identifier.prefix; | 6090 SimpleIdentifier prefix2 = identifier.prefix; |
| 6091 Element prefixElement = nameScope.lookup(prefix8, definingLibrary); | 6091 Element prefixElement = nameScope.lookup(prefix2, definingLibrary); |
| 6092 if (prefixElement != null) { | 6092 if (prefixElement != null) { |
| 6093 prefix8.element = prefixElement; | 6093 prefix2.element = prefixElement; |
| 6094 } | 6094 } |
| 6095 } | 6095 } |
| 6096 } | 6096 } |
| 6097 } | 6097 } |
| 6098 /** | 6098 /** |
| 6099 * Set the return type and parameter type information for the given function t
ype based on the | 6099 * Set the return type and parameter type information for the given function t
ype based on the |
| 6100 * given return type and parameter elements. | 6100 * given return type and parameter elements. |
| 6101 * @param functionType the function type to be filled in | 6101 * @param functionType the function type to be filled in |
| 6102 * @param returnType the return type of the function, or {@code null} if no ty
pe was declared | 6102 * @param returnType the return type of the function, or {@code null} if no ty
pe was declared |
| 6103 * @param parameters the elements representing the parameters to the function | 6103 * @param parameters the elements representing the parameters to the function |
| 6104 */ | 6104 */ |
| 6105 void setTypeInformation(FunctionTypeImpl functionType, TypeName returnType15,
List<ParameterElement> parameters) { | 6105 void setTypeInformation(FunctionTypeImpl functionType, TypeName returnType2, L
ist<ParameterElement> parameters) { |
| 6106 List<Type2> normalParameterTypes = new List<Type2>(); | 6106 List<Type2> normalParameterTypes = new List<Type2>(); |
| 6107 List<Type2> optionalParameterTypes = new List<Type2>(); | 6107 List<Type2> optionalParameterTypes = new List<Type2>(); |
| 6108 LinkedHashMap<String, Type2> namedParameterTypes = new LinkedHashMap<String,
Type2>(); | 6108 LinkedHashMap<String, Type2> namedParameterTypes = new LinkedHashMap<String,
Type2>(); |
| 6109 for (ParameterElement parameter in parameters) { | 6109 for (ParameterElement parameter in parameters) { |
| 6110 while (true) { | 6110 while (true) { |
| 6111 if (parameter.parameterKind == ParameterKind.REQUIRED) { | 6111 if (parameter.parameterKind == ParameterKind.REQUIRED) { |
| 6112 normalParameterTypes.add(parameter.type); | 6112 normalParameterTypes.add(parameter.type); |
| 6113 } else if (parameter.parameterKind == ParameterKind.POSITIONAL) { | 6113 } else if (parameter.parameterKind == ParameterKind.POSITIONAL) { |
| 6114 optionalParameterTypes.add(parameter.type); | 6114 optionalParameterTypes.add(parameter.type); |
| 6115 } else if (parameter.parameterKind == ParameterKind.NAMED) { | 6115 } else if (parameter.parameterKind == ParameterKind.NAMED) { |
| 6116 namedParameterTypes[parameter.name] = parameter.type; | 6116 namedParameterTypes[parameter.name] = parameter.type; |
| 6117 } | 6117 } |
| 6118 break; | 6118 break; |
| 6119 } | 6119 } |
| 6120 } | 6120 } |
| 6121 if (!normalParameterTypes.isEmpty) { | 6121 if (!normalParameterTypes.isEmpty) { |
| 6122 functionType.normalParameterTypes = new List.from(normalParameterTypes); | 6122 functionType.normalParameterTypes = new List.from(normalParameterTypes); |
| 6123 } | 6123 } |
| 6124 if (!optionalParameterTypes.isEmpty) { | 6124 if (!optionalParameterTypes.isEmpty) { |
| 6125 functionType.optionalParameterTypes = new List.from(optionalParameterTypes
); | 6125 functionType.optionalParameterTypes = new List.from(optionalParameterTypes
); |
| 6126 } | 6126 } |
| 6127 if (!namedParameterTypes.isEmpty) { | 6127 if (!namedParameterTypes.isEmpty) { |
| 6128 functionType.namedParameterTypes = namedParameterTypes; | 6128 functionType.namedParameterTypes = namedParameterTypes; |
| 6129 } | 6129 } |
| 6130 if (returnType15 == null) { | 6130 if (returnType2 == null) { |
| 6131 functionType.returnType = _dynamicType; | 6131 functionType.returnType = _dynamicType; |
| 6132 } else { | 6132 } else { |
| 6133 functionType.returnType = returnType15.type; | 6133 functionType.returnType = returnType2.type; |
| 6134 } | 6134 } |
| 6135 } | 6135 } |
| 6136 } | 6136 } |
| 6137 /** | 6137 /** |
| 6138 * Instances of the class {@code ClassScope} implement the scope defined by a cl
ass. | 6138 * Instances of the class {@code ClassScope} implement the scope defined by a cl
ass. |
| 6139 * @coverage dart.engine.resolver | 6139 * @coverage dart.engine.resolver |
| 6140 */ | 6140 */ |
| 6141 class ClassScope extends EnclosedScope { | 6141 class ClassScope extends EnclosedScope { |
| 6142 /** | 6142 /** |
| 6143 * Initialize a newly created scope enclosed within another scope. | 6143 * Initialize a newly created scope enclosed within another scope. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6216 FunctionScope(Scope enclosingScope, ExecutableElement functionElement) : super
(new EnclosedScope(enclosingScope)) { | 6216 FunctionScope(Scope enclosingScope, ExecutableElement functionElement) : super
(new EnclosedScope(enclosingScope)) { |
| 6217 defineParameters(functionElement); | 6217 defineParameters(functionElement); |
| 6218 } | 6218 } |
| 6219 /** | 6219 /** |
| 6220 * Define the parameters for the given function in the scope that encloses thi
s function. | 6220 * Define the parameters for the given function in the scope that encloses thi
s function. |
| 6221 * @param functionElement the element representing the function represented by
this scope | 6221 * @param functionElement the element representing the function represented by
this scope |
| 6222 */ | 6222 */ |
| 6223 void defineParameters(ExecutableElement functionElement) { | 6223 void defineParameters(ExecutableElement functionElement) { |
| 6224 Scope parameterScope = enclosingScope; | 6224 Scope parameterScope = enclosingScope; |
| 6225 if (functionElement.enclosingElement is ExecutableElement) { | 6225 if (functionElement.enclosingElement is ExecutableElement) { |
| 6226 String name21 = functionElement.name; | 6226 String name2 = functionElement.name; |
| 6227 if (name21 != null && !name21.isEmpty) { | 6227 if (name2 != null && !name2.isEmpty) { |
| 6228 parameterScope.define(functionElement); | 6228 parameterScope.define(functionElement); |
| 6229 } | 6229 } |
| 6230 } | 6230 } |
| 6231 for (ParameterElement parameter in functionElement.parameters) { | 6231 for (ParameterElement parameter in functionElement.parameters) { |
| 6232 if (!parameter.isInitializingFormal()) { | 6232 if (!parameter.isInitializingFormal()) { |
| 6233 parameterScope.define(parameter); | 6233 parameterScope.define(parameter); |
| 6234 } | 6234 } |
| 6235 } | 6235 } |
| 6236 } | 6236 } |
| 6237 } | 6237 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6296 } | 6296 } |
| 6297 _jtd_constructor_279_impl(LabelScope outerScope, bool onSwitchStatement, bool
onSwitchMember) { | 6297 _jtd_constructor_279_impl(LabelScope outerScope, bool onSwitchStatement, bool
onSwitchMember) { |
| 6298 _jtd_constructor_280_impl(outerScope, EMPTY_LABEL, new LabelElementImpl(_EMP
TY_LABEL_IDENTIFIER, onSwitchStatement, onSwitchMember)); | 6298 _jtd_constructor_280_impl(outerScope, EMPTY_LABEL, new LabelElementImpl(_EMP
TY_LABEL_IDENTIFIER, onSwitchStatement, onSwitchMember)); |
| 6299 } | 6299 } |
| 6300 /** | 6300 /** |
| 6301 * Initialize a newly created scope to represent the given label. | 6301 * Initialize a newly created scope to represent the given label. |
| 6302 * @param outerScope the label scope enclosing the new label scope | 6302 * @param outerScope the label scope enclosing the new label scope |
| 6303 * @param label the label defined in this scope | 6303 * @param label the label defined in this scope |
| 6304 * @param element the element to which the label resolves | 6304 * @param element the element to which the label resolves |
| 6305 */ | 6305 */ |
| 6306 LabelScope.con2(LabelScope outerScope2, String label4, LabelElement element21)
{ | 6306 LabelScope.con2(LabelScope outerScope2, String label2, LabelElement element2)
{ |
| 6307 _jtd_constructor_280_impl(outerScope2, label4, element21); | 6307 _jtd_constructor_280_impl(outerScope2, label2, element2); |
| 6308 } | 6308 } |
| 6309 _jtd_constructor_280_impl(LabelScope outerScope2, String label4, LabelElement
element21) { | 6309 _jtd_constructor_280_impl(LabelScope outerScope2, String label2, LabelElement
element2) { |
| 6310 this._outerScope = outerScope2; | 6310 this._outerScope = outerScope2; |
| 6311 this._label = label4; | 6311 this._label = label2; |
| 6312 this._element = element21; | 6312 this._element = element2; |
| 6313 } | 6313 } |
| 6314 /** | 6314 /** |
| 6315 * Return the label element corresponding to the given label, or {@code null}
if the given label | 6315 * Return the label element corresponding to the given label, or {@code null}
if the given label |
| 6316 * is not defined in this scope. | 6316 * is not defined in this scope. |
| 6317 * @param targetLabel the label being looked up | 6317 * @param targetLabel the label being looked up |
| 6318 * @return the label element corresponding to the given label | 6318 * @return the label element corresponding to the given label |
| 6319 */ | 6319 */ |
| 6320 LabelElement lookup(SimpleIdentifier targetLabel) => lookup2(targetLabel.name)
; | 6320 LabelElement lookup(SimpleIdentifier targetLabel) => lookup2(targetLabel.name)
; |
| 6321 /** | 6321 /** |
| 6322 * Return the label element corresponding to the given label, or {@code null}
if the given label | 6322 * Return the label element corresponding to the given label, or {@code null}
if the given label |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6507 * @param library the library whose export namespace is to be created | 6507 * @param library the library whose export namespace is to be created |
| 6508 * @return the export namespace that was created | 6508 * @return the export namespace that was created |
| 6509 */ | 6509 */ |
| 6510 Namespace createExportNamespace(LibraryElement library) => new Namespace(creat
eExportMapping(library, new Set<LibraryElement>())); | 6510 Namespace createExportNamespace(LibraryElement library) => new Namespace(creat
eExportMapping(library, new Set<LibraryElement>())); |
| 6511 /** | 6511 /** |
| 6512 * Create a namespace representing the import namespace of the given library. | 6512 * Create a namespace representing the import namespace of the given library. |
| 6513 * @param library the library whose import namespace is to be created | 6513 * @param library the library whose import namespace is to be created |
| 6514 * @return the import namespace that was created | 6514 * @return the import namespace that was created |
| 6515 */ | 6515 */ |
| 6516 Namespace createImportNamespace(ImportElement element) { | 6516 Namespace createImportNamespace(ImportElement element) { |
| 6517 LibraryElement importedLibrary4 = element.importedLibrary; | 6517 LibraryElement importedLibrary2 = element.importedLibrary; |
| 6518 if (importedLibrary4 == null) { | 6518 if (importedLibrary2 == null) { |
| 6519 return Namespace.EMPTY; | 6519 return Namespace.EMPTY; |
| 6520 } | 6520 } |
| 6521 Map<String, Element> definedNames = createExportMapping(importedLibrary4, ne
w Set<LibraryElement>()); | 6521 Map<String, Element> definedNames = createExportMapping(importedLibrary2, ne
w Set<LibraryElement>()); |
| 6522 definedNames = apply(definedNames, element.combinators); | 6522 definedNames = apply(definedNames, element.combinators); |
| 6523 definedNames = apply2(definedNames, element.prefix); | 6523 definedNames = apply2(definedNames, element.prefix); |
| 6524 return new Namespace(definedNames); | 6524 return new Namespace(definedNames); |
| 6525 } | 6525 } |
| 6526 /** | 6526 /** |
| 6527 * Create a namespace representing the public namespace of the given library. | 6527 * Create a namespace representing the public namespace of the given library. |
| 6528 * @param library the library whose public namespace is to be created | 6528 * @param library the library whose public namespace is to be created |
| 6529 * @return the public namespace that was created | 6529 * @return the public namespace that was created |
| 6530 */ | 6530 */ |
| 6531 Namespace createPublicNamespace(LibraryElement library) { | 6531 Namespace createPublicNamespace(LibraryElement library) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 6555 if (namespace != null) { | 6555 if (namespace != null) { |
| 6556 addAll(definedNames2, namespace.definedNames); | 6556 addAll(definedNames2, namespace.definedNames); |
| 6557 } | 6557 } |
| 6558 } | 6558 } |
| 6559 /** | 6559 /** |
| 6560 * Add the given element to the given mapping table if it has a publicly visib
le name. | 6560 * Add the given element to the given mapping table if it has a publicly visib
le name. |
| 6561 * @param definedNames the mapping table to which the public name is to be add
ed | 6561 * @param definedNames the mapping table to which the public name is to be add
ed |
| 6562 * @param element the element to be added | 6562 * @param element the element to be added |
| 6563 */ | 6563 */ |
| 6564 void addIfPublic(Map<String, Element> definedNames, Element element) { | 6564 void addIfPublic(Map<String, Element> definedNames, Element element) { |
| 6565 String name22 = element.name; | 6565 String name2 = element.name; |
| 6566 if (name22 != null && !Scope.isPrivateName(name22)) { | 6566 if (name2 != null && !Scope.isPrivateName(name2)) { |
| 6567 definedNames[name22] = element; | 6567 definedNames[name2] = element; |
| 6568 } | 6568 } |
| 6569 } | 6569 } |
| 6570 /** | 6570 /** |
| 6571 * Add to the given mapping table all of the public top-level names that are d
efined in the given | 6571 * Add to the given mapping table all of the public top-level names that are d
efined in the given |
| 6572 * compilation unit. | 6572 * compilation unit. |
| 6573 * @param definedNames the mapping table to which the public names are to be a
dded | 6573 * @param definedNames the mapping table to which the public names are to be a
dded |
| 6574 * @param compilationUnit the compilation unit defining the top-level names to
be added to this | 6574 * @param compilationUnit the compilation unit defining the top-level names to
be added to this |
| 6575 * namespace | 6575 * namespace |
| 6576 */ | 6576 */ |
| 6577 void addPublicNames(Map<String, Element> definedNames, CompilationUnitElement
compilationUnit) { | 6577 void addPublicNames(Map<String, Element> definedNames, CompilationUnitElement
compilationUnit) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6631 * @param visitedElements a set of libraries that do not need to be visited wh
en processing the | 6631 * @param visitedElements a set of libraries that do not need to be visited wh
en processing the |
| 6632 * export directives of the given library because all of the names defined by
them will | 6632 * export directives of the given library because all of the names defined by
them will |
| 6633 * be added by another library | 6633 * be added by another library |
| 6634 * @return the mapping table that was created | 6634 * @return the mapping table that was created |
| 6635 */ | 6635 */ |
| 6636 Map<String, Element> createExportMapping(LibraryElement library, Set<LibraryEl
ement> visitedElements) { | 6636 Map<String, Element> createExportMapping(LibraryElement library, Set<LibraryEl
ement> visitedElements) { |
| 6637 javaSetAdd(visitedElements, library); | 6637 javaSetAdd(visitedElements, library); |
| 6638 try { | 6638 try { |
| 6639 Map<String, Element> definedNames = new Map<String, Element>(); | 6639 Map<String, Element> definedNames = new Map<String, Element>(); |
| 6640 for (ExportElement element in library.exports) { | 6640 for (ExportElement element in library.exports) { |
| 6641 LibraryElement exportedLibrary3 = element.exportedLibrary; | 6641 LibraryElement exportedLibrary2 = element.exportedLibrary; |
| 6642 if (exportedLibrary3 != null && !visitedElements.contains(exportedLibrar
y3)) { | 6642 if (exportedLibrary2 != null && !visitedElements.contains(exportedLibrar
y2)) { |
| 6643 Map<String, Element> exportedNames = createExportMapping(exportedLibra
ry3, visitedElements); | 6643 Map<String, Element> exportedNames = createExportMapping(exportedLibra
ry2, visitedElements); |
| 6644 exportedNames = apply(exportedNames, element.combinators); | 6644 exportedNames = apply(exportedNames, element.combinators); |
| 6645 addAll(definedNames, exportedNames); | 6645 addAll(definedNames, exportedNames); |
| 6646 } | 6646 } |
| 6647 } | 6647 } |
| 6648 addAll2(definedNames, ((library.context as InternalAnalysisContext)).getPu
blicNamespace(library)); | 6648 addAll2(definedNames, ((library.context as InternalAnalysisContext)).getPu
blicNamespace(library)); |
| 6649 return definedNames; | 6649 return definedNames; |
| 6650 } finally { | 6650 } finally { |
| 6651 visitedElements.remove(library); | 6651 visitedElements.remove(library); |
| 6652 } | 6652 } |
| 6653 } | 6653 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6753 */ | 6753 */ |
| 6754 LibraryElement get definingLibrary; | 6754 LibraryElement get definingLibrary; |
| 6755 /** | 6755 /** |
| 6756 * Return the error code to be used when reporting that a name being defined l
ocally conflicts | 6756 * Return the error code to be used when reporting that a name being defined l
ocally conflicts |
| 6757 * with another element of the same name in the local scope. | 6757 * with another element of the same name in the local scope. |
| 6758 * @param existing the first element to be declared with the conflicting name | 6758 * @param existing the first element to be declared with the conflicting name |
| 6759 * @param duplicate another element declared with the conflicting name | 6759 * @param duplicate another element declared with the conflicting name |
| 6760 * @return the error code used to report duplicate names within a scope | 6760 * @return the error code used to report duplicate names within a scope |
| 6761 */ | 6761 */ |
| 6762 AnalysisError getErrorForDuplicate(Element existing, Element duplicate) { | 6762 AnalysisError getErrorForDuplicate(Element existing, Element duplicate) { |
| 6763 Source source15 = duplicate.source; | 6763 Source source2 = duplicate.source; |
| 6764 if (source15 == null) { | 6764 if (source2 == null) { |
| 6765 source15 = source; | 6765 source2 = source; |
| 6766 } | 6766 } |
| 6767 return new AnalysisError.con2(source15, duplicate.nameOffset, duplicate.name
.length, CompileTimeErrorCode.DUPLICATE_DEFINITION, [existing.name]); | 6767 return new AnalysisError.con2(source2, duplicate.nameOffset, duplicate.name.
length, CompileTimeErrorCode.DUPLICATE_DEFINITION, [existing.name]); |
| 6768 } | 6768 } |
| 6769 /** | 6769 /** |
| 6770 * Return the listener that is to be informed when an error is encountered. | 6770 * Return the listener that is to be informed when an error is encountered. |
| 6771 * @return the listener that is to be informed when an error is encountered | 6771 * @return the listener that is to be informed when an error is encountered |
| 6772 */ | 6772 */ |
| 6773 AnalysisErrorListener get errorListener; | 6773 AnalysisErrorListener get errorListener; |
| 6774 /** | 6774 /** |
| 6775 * Return the source object representing the compilation unit with which error
s related to this | 6775 * Return the source object representing the compilation unit with which error
s related to this |
| 6776 * scope should be associated. | 6776 * scope should be associated. |
| 6777 * @return the source object with which errors should be associated | 6777 * @return the source object with which errors should be associated |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6846 validate(element, CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT); | 6846 validate(element, CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT); |
| 6847 } | 6847 } |
| 6848 } | 6848 } |
| 6849 return null; | 6849 return null; |
| 6850 } | 6850 } |
| 6851 Object visitMapLiteral(MapLiteral node) { | 6851 Object visitMapLiteral(MapLiteral node) { |
| 6852 super.visitMapLiteral(node); | 6852 super.visitMapLiteral(node); |
| 6853 bool isConst = node.modifier != null; | 6853 bool isConst = node.modifier != null; |
| 6854 Set<String> keys = new Set<String>(); | 6854 Set<String> keys = new Set<String>(); |
| 6855 for (MapLiteralEntry entry in node.entries) { | 6855 for (MapLiteralEntry entry in node.entries) { |
| 6856 StringLiteral key4 = entry.key; | 6856 StringLiteral key2 = entry.key; |
| 6857 EvaluationResultImpl result = validate(key4, CompileTimeErrorCode.NON_CONS
TANT_MAP_KEY); | 6857 EvaluationResultImpl result = validate(key2, CompileTimeErrorCode.NON_CONS
TANT_MAP_KEY); |
| 6858 if (result is ValidResult && ((result as ValidResult)).value is String) { | 6858 if (result is ValidResult && ((result as ValidResult)).value is String) { |
| 6859 String value11 = ((result as ValidResult)).value as String; | 6859 String value2 = ((result as ValidResult)).value as String; |
| 6860 if (keys.contains(value11)) { | 6860 if (keys.contains(value2)) { |
| 6861 _errorReporter.reportError(StaticWarningCode.EQUAL_KEYS_IN_MAP, key4,
[]); | 6861 _errorReporter.reportError(StaticWarningCode.EQUAL_KEYS_IN_MAP, key2,
[]); |
| 6862 } else { | 6862 } else { |
| 6863 javaSetAdd(keys, value11); | 6863 javaSetAdd(keys, value2); |
| 6864 } | 6864 } |
| 6865 } | 6865 } |
| 6866 if (isConst) { | 6866 if (isConst) { |
| 6867 validate(entry.value, CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE); | 6867 validate(entry.value, CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE); |
| 6868 } | 6868 } |
| 6869 } | 6869 } |
| 6870 return null; | 6870 return null; |
| 6871 } | 6871 } |
| 6872 Object visitMethodDeclaration(MethodDeclaration node) { | 6872 Object visitMethodDeclaration(MethodDeclaration node) { |
| 6873 super.visitMethodDeclaration(node); | 6873 super.visitMethodDeclaration(node); |
| 6874 validateDefaultValues(node.parameters); | 6874 validateDefaultValues(node.parameters); |
| 6875 return null; | 6875 return null; |
| 6876 } | 6876 } |
| 6877 Object visitSwitchCase(SwitchCase node) { | 6877 Object visitSwitchCase(SwitchCase node) { |
| 6878 super.visitSwitchCase(node); | 6878 super.visitSwitchCase(node); |
| 6879 validate(node.expression, CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION)
; | 6879 validate(node.expression, CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION)
; |
| 6880 return null; | 6880 return null; |
| 6881 } | 6881 } |
| 6882 Object visitVariableDeclaration(VariableDeclaration node) { | 6882 Object visitVariableDeclaration(VariableDeclaration node) { |
| 6883 super.visitVariableDeclaration(node); | 6883 super.visitVariableDeclaration(node); |
| 6884 Expression initializer7 = node.initializer; | 6884 Expression initializer2 = node.initializer; |
| 6885 if (initializer7 != null && node.isConst()) { | 6885 if (initializer2 != null && node.isConst()) { |
| 6886 VariableElementImpl element58 = node.element as VariableElementImpl; | 6886 VariableElementImpl element2 = node.element as VariableElementImpl; |
| 6887 EvaluationResultImpl result = element58.evaluationResult; | 6887 EvaluationResultImpl result = element2.evaluationResult; |
| 6888 if (result == null) { | 6888 if (result == null) { |
| 6889 result = validate(initializer7, CompileTimeErrorCode.CONST_INITIALIZED_W
ITH_NON_CONSTANT_VALUE); | 6889 result = validate(initializer2, CompileTimeErrorCode.CONST_INITIALIZED_W
ITH_NON_CONSTANT_VALUE); |
| 6890 element58.evaluationResult = result; | 6890 element2.evaluationResult = result; |
| 6891 } else if (result is ErrorResult) { | 6891 } else if (result is ErrorResult) { |
| 6892 reportErrors(result, CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CON
STANT_VALUE); | 6892 reportErrors(result, CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CON
STANT_VALUE); |
| 6893 } | 6893 } |
| 6894 } | 6894 } |
| 6895 return null; | 6895 return null; |
| 6896 } | 6896 } |
| 6897 /** | 6897 /** |
| 6898 * If the given result represents one or more errors, report those errors. Exc
ept for special | 6898 * If the given result represents one or more errors, report those errors. Exc
ept for special |
| 6899 * cases, use the given error code rather than the one reported in the error. | 6899 * cases, use the given error code rather than the one reported in the error. |
| 6900 * @param result the result containing any errors that need to be reported | 6900 * @param result the result containing any errors that need to be reported |
| (...skipping 16 matching lines...) Expand all Loading... |
| 6917 EvaluationResultImpl validate(Expression expression, ErrorCode errorCode) { | 6917 EvaluationResultImpl validate(Expression expression, ErrorCode errorCode) { |
| 6918 EvaluationResultImpl result = expression.accept(new ConstantVisitor()); | 6918 EvaluationResultImpl result = expression.accept(new ConstantVisitor()); |
| 6919 reportErrors(result, errorCode); | 6919 reportErrors(result, errorCode); |
| 6920 return result; | 6920 return result; |
| 6921 } | 6921 } |
| 6922 /** | 6922 /** |
| 6923 * Validate that the default value associated with each of the parameters in t
he given list is a | 6923 * Validate that the default value associated with each of the parameters in t
he given list is a |
| 6924 * compile time constant. | 6924 * compile time constant. |
| 6925 * @param parameters the list of parameters to be validated | 6925 * @param parameters the list of parameters to be validated |
| 6926 */ | 6926 */ |
| 6927 void validateDefaultValues(FormalParameterList parameters17) { | 6927 void validateDefaultValues(FormalParameterList parameters2) { |
| 6928 if (parameters17 == null) { | 6928 if (parameters2 == null) { |
| 6929 return; | 6929 return; |
| 6930 } | 6930 } |
| 6931 for (FormalParameter parameter in parameters17.parameters) { | 6931 for (FormalParameter parameter in parameters2.parameters) { |
| 6932 if (parameter is DefaultFormalParameter) { | 6932 if (parameter is DefaultFormalParameter) { |
| 6933 DefaultFormalParameter defaultParameter = parameter as DefaultFormalPara
meter; | 6933 DefaultFormalParameter defaultParameter = parameter as DefaultFormalPara
meter; |
| 6934 Expression defaultValue3 = defaultParameter.defaultValue; | 6934 Expression defaultValue2 = defaultParameter.defaultValue; |
| 6935 if (defaultValue3 != null) { | 6935 if (defaultValue2 != null) { |
| 6936 EvaluationResultImpl result = validate(defaultValue3, CompileTimeError
Code.NON_CONSTANT_DEFAULT_VALUE); | 6936 EvaluationResultImpl result = validate(defaultValue2, CompileTimeError
Code.NON_CONSTANT_DEFAULT_VALUE); |
| 6937 if (defaultParameter.isConst()) { | 6937 if (defaultParameter.isConst()) { |
| 6938 VariableElementImpl element59 = parameter.element as VariableElement
Impl; | 6938 VariableElementImpl element2 = parameter.element as VariableElementI
mpl; |
| 6939 element59.evaluationResult = result; | 6939 element2.evaluationResult = result; |
| 6940 } | 6940 } |
| 6941 } | 6941 } |
| 6942 } | 6942 } |
| 6943 } | 6943 } |
| 6944 } | 6944 } |
| 6945 } | 6945 } |
| 6946 /** | 6946 /** |
| 6947 * Instances of the class {@code ErrorVerifier} traverse an AST structure lookin
g for additional | 6947 * Instances of the class {@code ErrorVerifier} traverse an AST structure lookin
g for additional |
| 6948 * errors and warnings not covered by the parser and resolver. | 6948 * errors and warnings not covered by the parser and resolver. |
| 6949 * @coverage dart.engine.resolver | 6949 * @coverage dart.engine.resolver |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7110 } | 7110 } |
| 7111 Object visitIfStatement(IfStatement node) { | 7111 Object visitIfStatement(IfStatement node) { |
| 7112 checkForNonBoolCondition(node.condition); | 7112 checkForNonBoolCondition(node.condition); |
| 7113 return super.visitIfStatement(node); | 7113 return super.visitIfStatement(node); |
| 7114 } | 7114 } |
| 7115 Object visitImplementsClause(ImplementsClause node) { | 7115 Object visitImplementsClause(ImplementsClause node) { |
| 7116 checkForImplementsDisallowedClass(node); | 7116 checkForImplementsDisallowedClass(node); |
| 7117 return super.visitImplementsClause(node); | 7117 return super.visitImplementsClause(node); |
| 7118 } | 7118 } |
| 7119 Object visitInstanceCreationExpression(InstanceCreationExpression node) { | 7119 Object visitInstanceCreationExpression(InstanceCreationExpression node) { |
| 7120 ConstructorName constructorName4 = node.constructorName; | 7120 ConstructorName constructorName2 = node.constructorName; |
| 7121 TypeName typeName = constructorName4.type; | 7121 TypeName typeName = constructorName2.type; |
| 7122 Type2 type25 = typeName.type; | 7122 Type2 type2 = typeName.type; |
| 7123 if (type25 is InterfaceType) { | 7123 if (type2 is InterfaceType) { |
| 7124 InterfaceType interfaceType = type25 as InterfaceType; | 7124 InterfaceType interfaceType = type2 as InterfaceType; |
| 7125 checkForConstWithNonConst(node); | 7125 checkForConstWithNonConst(node); |
| 7126 checkForConstOrNewWithAbstractClass(node, typeName, interfaceType); | 7126 checkForConstOrNewWithAbstractClass(node, typeName, interfaceType); |
| 7127 checkForTypeArgumentNotMatchingBounds(node, constructorName4.element, type
Name); | 7127 checkForTypeArgumentNotMatchingBounds(node, constructorName2.element, type
Name); |
| 7128 } | 7128 } |
| 7129 return super.visitInstanceCreationExpression(node); | 7129 return super.visitInstanceCreationExpression(node); |
| 7130 } | 7130 } |
| 7131 Object visitMethodDeclaration(MethodDeclaration node) { | 7131 Object visitMethodDeclaration(MethodDeclaration node) { |
| 7132 ExecutableElement previousFunction = _enclosingFunction; | 7132 ExecutableElement previousFunction = _enclosingFunction; |
| 7133 try { | 7133 try { |
| 7134 _enclosingFunction = node.element; | 7134 _enclosingFunction = node.element; |
| 7135 return super.visitMethodDeclaration(node); | 7135 return super.visitMethodDeclaration(node); |
| 7136 } finally { | 7136 } finally { |
| 7137 _enclosingFunction = previousFunction; | 7137 _enclosingFunction = previousFunction; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7218 _errorReporter.reportError(CompileTimeErrorCode.FINAL_INITIALIZED_MU
LTIPLE_TIMES, formalParameter.identifier, [fieldElement.name]); | 7218 _errorReporter.reportError(CompileTimeErrorCode.FINAL_INITIALIZED_MU
LTIPLE_TIMES, formalParameter.identifier, [fieldElement.name]); |
| 7219 foundError = true; | 7219 foundError = true; |
| 7220 } | 7220 } |
| 7221 } | 7221 } |
| 7222 } | 7222 } |
| 7223 } | 7223 } |
| 7224 NodeList<ConstructorInitializer> initializers2 = node.initializers; | 7224 NodeList<ConstructorInitializer> initializers2 = node.initializers; |
| 7225 for (ConstructorInitializer constructorInitializer in initializers2) { | 7225 for (ConstructorInitializer constructorInitializer in initializers2) { |
| 7226 if (constructorInitializer is ConstructorFieldInitializer) { | 7226 if (constructorInitializer is ConstructorFieldInitializer) { |
| 7227 ConstructorFieldInitializer constructorFieldInitializer = constructorIni
tializer as ConstructorFieldInitializer; | 7227 ConstructorFieldInitializer constructorFieldInitializer = constructorIni
tializer as ConstructorFieldInitializer; |
| 7228 SimpleIdentifier fieldName3 = constructorFieldInitializer.fieldName; | 7228 SimpleIdentifier fieldName2 = constructorFieldInitializer.fieldName; |
| 7229 Element element60 = fieldName3.element; | 7229 Element element2 = fieldName2.element; |
| 7230 if (element60 is FieldElement) { | 7230 if (element2 is FieldElement) { |
| 7231 FieldElement fieldElement = element60 as FieldElement; | 7231 FieldElement fieldElement = element2 as FieldElement; |
| 7232 INIT_STATE state = fieldElementsMap[fieldElement]; | 7232 INIT_STATE state = fieldElementsMap[fieldElement]; |
| 7233 if (identical(state, INIT_STATE.NOT_INIT)) { | 7233 if (identical(state, INIT_STATE.NOT_INIT)) { |
| 7234 fieldElementsMap[fieldElement] = INIT_STATE.INIT_IN_INITIALIZERS; | 7234 fieldElementsMap[fieldElement] = INIT_STATE.INIT_IN_INITIALIZERS; |
| 7235 } else if (identical(state, INIT_STATE.INIT_IN_DECLARATION)) { | 7235 } else if (identical(state, INIT_STATE.INIT_IN_DECLARATION)) { |
| 7236 if (fieldElement.isFinal() || fieldElement.isConst()) { | 7236 if (fieldElement.isFinal() || fieldElement.isConst()) { |
| 7237 _errorReporter.reportError(CompileTimeErrorCode.FIELD_INITIALIZED_
IN_INITIALIZER_AND_DECLARATION, fieldName3, []); | 7237 _errorReporter.reportError(CompileTimeErrorCode.FIELD_INITIALIZED_
IN_INITIALIZER_AND_DECLARATION, fieldName2, []); |
| 7238 foundError = true; | 7238 foundError = true; |
| 7239 } | 7239 } |
| 7240 } else if (identical(state, INIT_STATE.INIT_IN_FIELD_FORMAL)) { | 7240 } else if (identical(state, INIT_STATE.INIT_IN_FIELD_FORMAL)) { |
| 7241 _errorReporter.reportError(CompileTimeErrorCode.FIELD_INITIALIZED_IN
_PARAMETER_AND_INITIALIZER, fieldName3, []); | 7241 _errorReporter.reportError(CompileTimeErrorCode.FIELD_INITIALIZED_IN
_PARAMETER_AND_INITIALIZER, fieldName2, []); |
| 7242 foundError = true; | 7242 foundError = true; |
| 7243 } else if (identical(state, INIT_STATE.INIT_IN_INITIALIZERS)) { | 7243 } else if (identical(state, INIT_STATE.INIT_IN_INITIALIZERS)) { |
| 7244 _errorReporter.reportError(CompileTimeErrorCode.FIELD_INITIALIZED_BY
_MULTIPLE_INITIALIZERS, fieldName3, [fieldElement.name]); | 7244 _errorReporter.reportError(CompileTimeErrorCode.FIELD_INITIALIZED_BY
_MULTIPLE_INITIALIZERS, fieldName2, [fieldElement.name]); |
| 7245 foundError = true; | 7245 foundError = true; |
| 7246 } | 7246 } |
| 7247 } | 7247 } |
| 7248 } | 7248 } |
| 7249 } | 7249 } |
| 7250 return foundError; | 7250 return foundError; |
| 7251 } | 7251 } |
| 7252 /** | 7252 /** |
| 7253 * This verifies that the passed argument definition test identifier is a para
meter. | 7253 * This verifies that the passed argument definition test identifier is a para
meter. |
| 7254 * @param node the {@link ArgumentDefinitionTest} to evaluate | 7254 * @param node the {@link ArgumentDefinitionTest} to evaluate |
| 7255 * @return return {@code true} if and only if an error code is generated on th
e passed node | 7255 * @return return {@code true} if and only if an error code is generated on th
e passed node |
| 7256 * @see CompileTimeErrorCode#ARGUMENT_DEFINITION_TEST_NON_PARAMETER | 7256 * @see CompileTimeErrorCode#ARGUMENT_DEFINITION_TEST_NON_PARAMETER |
| 7257 */ | 7257 */ |
| 7258 bool checkForArgumentDefinitionTestNonParameter(ArgumentDefinitionTest node) { | 7258 bool checkForArgumentDefinitionTestNonParameter(ArgumentDefinitionTest node) { |
| 7259 SimpleIdentifier identifier15 = node.identifier; | 7259 SimpleIdentifier identifier2 = node.identifier; |
| 7260 Element element61 = identifier15.element; | 7260 Element element2 = identifier2.element; |
| 7261 if (element61 != null && element61 is! ParameterElement) { | 7261 if (element2 != null && element2 is! ParameterElement) { |
| 7262 _errorReporter.reportError(CompileTimeErrorCode.ARGUMENT_DEFINITION_TEST_N
ON_PARAMETER, identifier15, [identifier15.name]); | 7262 _errorReporter.reportError(CompileTimeErrorCode.ARGUMENT_DEFINITION_TEST_N
ON_PARAMETER, identifier2, [identifier2.name]); |
| 7263 return true; | 7263 return true; |
| 7264 } | 7264 } |
| 7265 return false; | 7265 return false; |
| 7266 } | 7266 } |
| 7267 /** | 7267 /** |
| 7268 * This verifies that the passed identifier is not a keyword, and generates th
e passed error code | 7268 * This verifies that the passed identifier is not a keyword, and generates th
e passed error code |
| 7269 * on the identifier if it is a keyword. | 7269 * on the identifier if it is a keyword. |
| 7270 * @param identifier the identifier to check to ensure that it is not a keywor
d | 7270 * @param identifier the identifier to check to ensure that it is not a keywor
d |
| 7271 * @param errorCode if the passed identifier is a keyword then this error code
is created on the | 7271 * @param errorCode if the passed identifier is a keyword then this error code
is created on the |
| 7272 * identifier, the error code will be one of{@link CompileTimeErrorCode#BUILT_
IN_IDENTIFIER_AS_TYPE_NAME},{@link CompileTimeErrorCode#BUILT_IN_IDENTIFIER_AS_T
YPE_VARIABLE_NAME} or{@link CompileTimeErrorCode#BUILT_IN_IDENTIFIER_AS_TYPEDEF_
NAME} | 7272 * identifier, the error code will be one of{@link CompileTimeErrorCode#BUILT_
IN_IDENTIFIER_AS_TYPE_NAME},{@link CompileTimeErrorCode#BUILT_IN_IDENTIFIER_AS_T
YPE_VARIABLE_NAME} or{@link CompileTimeErrorCode#BUILT_IN_IDENTIFIER_AS_TYPEDEF_
NAME} |
| 7273 * @return return {@code true} if and only if an error code is generated on th
e passed node | 7273 * @return return {@code true} if and only if an error code is generated on th
e passed node |
| 7274 * @see CompileTimeErrorCode#BUILT_IN_IDENTIFIER_AS_TYPE_NAME | 7274 * @see CompileTimeErrorCode#BUILT_IN_IDENTIFIER_AS_TYPE_NAME |
| 7275 * @see CompileTimeErrorCode#BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME | 7275 * @see CompileTimeErrorCode#BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME |
| 7276 * @see CompileTimeErrorCode#BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME | 7276 * @see CompileTimeErrorCode#BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME |
| 7277 */ | 7277 */ |
| 7278 bool checkForBuiltInIdentifierAsName(SimpleIdentifier identifier, ErrorCode er
rorCode) { | 7278 bool checkForBuiltInIdentifierAsName(SimpleIdentifier identifier, ErrorCode er
rorCode) { |
| 7279 sc.Token token18 = identifier.token; | 7279 sc.Token token2 = identifier.token; |
| 7280 if (identical(token18.type, sc.TokenType.KEYWORD)) { | 7280 if (identical(token2.type, sc.TokenType.KEYWORD)) { |
| 7281 _errorReporter.reportError(errorCode, identifier, [identifier.name]); | 7281 _errorReporter.reportError(errorCode, identifier, [identifier.name]); |
| 7282 return true; | 7282 return true; |
| 7283 } | 7283 } |
| 7284 return false; | 7284 return false; |
| 7285 } | 7285 } |
| 7286 /** | 7286 /** |
| 7287 * This verifies that the passed variable declaration list does not have a bui
lt-in identifier. | 7287 * This verifies that the passed variable declaration list does not have a bui
lt-in identifier. |
| 7288 * @param node the variable declaration list to check | 7288 * @param node the variable declaration list to check |
| 7289 * @return return {@code true} if and only if an error code is generated on th
e passed node | 7289 * @return return {@code true} if and only if an error code is generated on th
e passed node |
| 7290 * @see CompileTimeErrorCode#BUILT_IN_IDENTIFIER_AS_TYPE | 7290 * @see CompileTimeErrorCode#BUILT_IN_IDENTIFIER_AS_TYPE |
| 7291 */ | 7291 */ |
| 7292 bool checkForBuiltInIdentifierAsName2(VariableDeclarationList node) { | 7292 bool checkForBuiltInIdentifierAsName2(VariableDeclarationList node) { |
| 7293 TypeName typeName = node.type; | 7293 TypeName typeName = node.type; |
| 7294 if (typeName != null) { | 7294 if (typeName != null) { |
| 7295 Identifier identifier = typeName.name; | 7295 Identifier identifier = typeName.name; |
| 7296 if (identifier is SimpleIdentifier) { | 7296 if (identifier is SimpleIdentifier) { |
| 7297 SimpleIdentifier simpleIdentifier = identifier as SimpleIdentifier; | 7297 SimpleIdentifier simpleIdentifier = identifier as SimpleIdentifier; |
| 7298 sc.Token token19 = simpleIdentifier.token; | 7298 sc.Token token2 = simpleIdentifier.token; |
| 7299 if (identical(token19.type, sc.TokenType.KEYWORD)) { | 7299 if (identical(token2.type, sc.TokenType.KEYWORD)) { |
| 7300 if (((token19 as sc.KeywordToken)).keyword != sc.Keyword.DYNAMIC) { | 7300 if (((token2 as sc.KeywordToken)).keyword != sc.Keyword.DYNAMIC) { |
| 7301 _errorReporter.reportError(CompileTimeErrorCode.BUILT_IN_IDENTIFIER_
AS_TYPE, identifier, [identifier.name]); | 7301 _errorReporter.reportError(CompileTimeErrorCode.BUILT_IN_IDENTIFIER_
AS_TYPE, identifier, [identifier.name]); |
| 7302 return true; | 7302 return true; |
| 7303 } | 7303 } |
| 7304 } | 7304 } |
| 7305 } | 7305 } |
| 7306 } | 7306 } |
| 7307 return false; | 7307 return false; |
| 7308 } | 7308 } |
| 7309 /** | 7309 /** |
| 7310 * This verifies that the passed switch statement does not have a case express
ion with the | 7310 * This verifies that the passed switch statement does not have a case express
ion with the |
| 7311 * operator '==' overridden. | 7311 * operator '==' overridden. |
| 7312 * @param node the switch statement to evaluate | 7312 * @param node the switch statement to evaluate |
| 7313 * @return return {@code true} if and only if an error code is generated on th
e passed node | 7313 * @return return {@code true} if and only if an error code is generated on th
e passed node |
| 7314 * @see CompileTimeErrorCode#CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS | 7314 * @see CompileTimeErrorCode#CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS |
| 7315 */ | 7315 */ |
| 7316 bool checkForCaseExpressionTypeImplementsEquals(SwitchStatement node) { | 7316 bool checkForCaseExpressionTypeImplementsEquals(SwitchStatement node) { |
| 7317 Expression expression16 = node.expression; | 7317 Expression expression2 = node.expression; |
| 7318 Type2 type = expression16.staticType; | 7318 Type2 type = expression2.staticType; |
| 7319 if (type != null && type != _typeProvider.intType && type != _typeProvider.s
tringType) { | 7319 if (type != null && type != _typeProvider.intType && type != _typeProvider.s
tringType) { |
| 7320 Element element62 = type.element; | 7320 Element element2 = type.element; |
| 7321 if (element62 is ClassElement) { | 7321 if (element2 is ClassElement) { |
| 7322 ClassElement classElement = element62 as ClassElement; | 7322 ClassElement classElement = element2 as ClassElement; |
| 7323 MethodElement method = classElement.lookUpMethod("==", _currentLibrary); | 7323 MethodElement method = classElement.lookUpMethod("==", _currentLibrary); |
| 7324 if (method != null && method.enclosingElement.type != _typeProvider.obje
ctType) { | 7324 if (method != null && method.enclosingElement.type != _typeProvider.obje
ctType) { |
| 7325 _errorReporter.reportError(CompileTimeErrorCode.CASE_EXPRESSION_TYPE_I
MPLEMENTS_EQUALS, expression16, [element62.name]); | 7325 _errorReporter.reportError(CompileTimeErrorCode.CASE_EXPRESSION_TYPE_I
MPLEMENTS_EQUALS, expression2, [element2.name]); |
| 7326 return true; | 7326 return true; |
| 7327 } | 7327 } |
| 7328 } | 7328 } |
| 7329 } | 7329 } |
| 7330 return false; | 7330 return false; |
| 7331 } | 7331 } |
| 7332 bool checkForConflictingConstructorNameAndMember(ConstructorDeclaration node)
{ | 7332 bool checkForConflictingConstructorNameAndMember(ConstructorDeclaration node)
{ |
| 7333 ConstructorElement constructorElement = node.element; | 7333 ConstructorElement constructorElement = node.element; |
| 7334 SimpleIdentifier constructorName = node.name; | 7334 SimpleIdentifier constructorName = node.name; |
| 7335 if (constructorName != null && constructorElement != null && !constructorNam
e.isSynthetic()) { | 7335 if (constructorName != null && constructorElement != null && !constructorNam
e.isSynthetic()) { |
| 7336 String name24 = constructorName.name; | 7336 String name2 = constructorName.name; |
| 7337 ClassElement classElement = constructorElement.enclosingElement; | 7337 ClassElement classElement = constructorElement.enclosingElement; |
| 7338 List<FieldElement> fields3 = classElement.fields; | 7338 List<FieldElement> fields2 = classElement.fields; |
| 7339 for (FieldElement field in fields3) { | 7339 for (FieldElement field in fields2) { |
| 7340 if (field.name == name24) { | 7340 if (field.name == name2) { |
| 7341 _errorReporter.reportError(CompileTimeErrorCode.CONFLICTING_CONSTRUCTO
R_NAME_AND_FIELD, node, [name24]); | 7341 _errorReporter.reportError(CompileTimeErrorCode.CONFLICTING_CONSTRUCTO
R_NAME_AND_FIELD, node, [name2]); |
| 7342 return true; | 7342 return true; |
| 7343 } | 7343 } |
| 7344 } | 7344 } |
| 7345 List<MethodElement> methods3 = classElement.methods; | 7345 List<MethodElement> methods2 = classElement.methods; |
| 7346 for (MethodElement method in methods3) { | 7346 for (MethodElement method in methods2) { |
| 7347 if (method.name == name24) { | 7347 if (method.name == name2) { |
| 7348 _errorReporter.reportError(CompileTimeErrorCode.CONFLICTING_CONSTRUCTO
R_NAME_AND_METHOD, node, [name24]); | 7348 _errorReporter.reportError(CompileTimeErrorCode.CONFLICTING_CONSTRUCTO
R_NAME_AND_METHOD, node, [name2]); |
| 7349 return true; | 7349 return true; |
| 7350 } | 7350 } |
| 7351 } | 7351 } |
| 7352 } | 7352 } |
| 7353 return false; | 7353 return false; |
| 7354 } | 7354 } |
| 7355 /** | 7355 /** |
| 7356 * This verifies that the passed constructor declaration is not 'const' if it
has a non-final | 7356 * This verifies that the passed constructor declaration is not 'const' if it
has a non-final |
| 7357 * instance variable. | 7357 * instance variable. |
| 7358 * @param node the instance creation expression to evaluate | 7358 * @param node the instance creation expression to evaluate |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7408 * class. | 7408 * class. |
| 7409 * @param node the instance creation expression to evaluate | 7409 * @param node the instance creation expression to evaluate |
| 7410 * @param typeName the {@link TypeName} of the {@link ConstructorName} from th
e{@link InstanceCreationExpression}, this is the AST node that the error is atta
ched to | 7410 * @param typeName the {@link TypeName} of the {@link ConstructorName} from th
e{@link InstanceCreationExpression}, this is the AST node that the error is atta
ched to |
| 7411 * @param type the type being constructed with this {@link InstanceCreationExp
ression} | 7411 * @param type the type being constructed with this {@link InstanceCreationExp
ression} |
| 7412 * @return return {@code true} if and only if an error code is generated on th
e passed node | 7412 * @return return {@code true} if and only if an error code is generated on th
e passed node |
| 7413 * @see StaticWarningCode#CONST_WITH_ABSTRACT_CLASS | 7413 * @see StaticWarningCode#CONST_WITH_ABSTRACT_CLASS |
| 7414 * @see StaticWarningCode#NEW_WITH_ABSTRACT_CLASS | 7414 * @see StaticWarningCode#NEW_WITH_ABSTRACT_CLASS |
| 7415 */ | 7415 */ |
| 7416 bool checkForConstOrNewWithAbstractClass(InstanceCreationExpression node, Type
Name typeName, InterfaceType type) { | 7416 bool checkForConstOrNewWithAbstractClass(InstanceCreationExpression node, Type
Name typeName, InterfaceType type) { |
| 7417 if (type.element.isAbstract()) { | 7417 if (type.element.isAbstract()) { |
| 7418 ConstructorElement element63 = node.element; | 7418 ConstructorElement element2 = node.element; |
| 7419 if (element63 != null && !element63.isFactory()) { | 7419 if (element2 != null && !element2.isFactory()) { |
| 7420 if (identical(((node.keyword as sc.KeywordToken)).keyword, sc.Keyword.CO
NST)) { | 7420 if (identical(((node.keyword as sc.KeywordToken)).keyword, sc.Keyword.CO
NST)) { |
| 7421 _errorReporter.reportError(StaticWarningCode.CONST_WITH_ABSTRACT_CLASS
, typeName, []); | 7421 _errorReporter.reportError(StaticWarningCode.CONST_WITH_ABSTRACT_CLASS
, typeName, []); |
| 7422 } else { | 7422 } else { |
| 7423 _errorReporter.reportError(StaticWarningCode.NEW_WITH_ABSTRACT_CLASS,
typeName, []); | 7423 _errorReporter.reportError(StaticWarningCode.NEW_WITH_ABSTRACT_CLASS,
typeName, []); |
| 7424 } | 7424 } |
| 7425 return true; | 7425 return true; |
| 7426 } | 7426 } |
| 7427 } | 7427 } |
| 7428 return false; | 7428 return false; |
| 7429 } | 7429 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 7444 } | 7444 } |
| 7445 /** | 7445 /** |
| 7446 * This verifies that there are no default parameters in the passed function t
ype alias. | 7446 * This verifies that there are no default parameters in the passed function t
ype alias. |
| 7447 * @param node the function type alias to evaluate | 7447 * @param node the function type alias to evaluate |
| 7448 * @return return {@code true} if and only if an error code is generated on th
e passed node | 7448 * @return return {@code true} if and only if an error code is generated on th
e passed node |
| 7449 * @see CompileTimeErrorCode#DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS | 7449 * @see CompileTimeErrorCode#DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS |
| 7450 */ | 7450 */ |
| 7451 bool checkForDefaultValueInFunctionTypeAlias(FunctionTypeAlias node) { | 7451 bool checkForDefaultValueInFunctionTypeAlias(FunctionTypeAlias node) { |
| 7452 bool result = false; | 7452 bool result = false; |
| 7453 FormalParameterList formalParameterList = node.parameters; | 7453 FormalParameterList formalParameterList = node.parameters; |
| 7454 NodeList<FormalParameter> parameters15 = formalParameterList.parameters; | 7454 NodeList<FormalParameter> parameters2 = formalParameterList.parameters; |
| 7455 for (FormalParameter formalParameter in parameters15) { | 7455 for (FormalParameter formalParameter in parameters2) { |
| 7456 if (formalParameter is DefaultFormalParameter) { | 7456 if (formalParameter is DefaultFormalParameter) { |
| 7457 DefaultFormalParameter defaultFormalParameter = formalParameter as Defau
ltFormalParameter; | 7457 DefaultFormalParameter defaultFormalParameter = formalParameter as Defau
ltFormalParameter; |
| 7458 if (defaultFormalParameter.defaultValue != null) { | 7458 if (defaultFormalParameter.defaultValue != null) { |
| 7459 _errorReporter.reportError(CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCT
ION_TYPE_ALIAS, node, []); | 7459 _errorReporter.reportError(CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCT
ION_TYPE_ALIAS, node, []); |
| 7460 result = true; | 7460 result = true; |
| 7461 } | 7461 } |
| 7462 } | 7462 } |
| 7463 } | 7463 } |
| 7464 return result; | 7464 return result; |
| 7465 } | 7465 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7503 } | 7503 } |
| 7504 return false; | 7504 return false; |
| 7505 } | 7505 } |
| 7506 /** | 7506 /** |
| 7507 * This verifies that the passed field formal parameter is in a constructor de
claration. | 7507 * This verifies that the passed field formal parameter is in a constructor de
claration. |
| 7508 * @param node the field formal parameter to test | 7508 * @param node the field formal parameter to test |
| 7509 * @return return {@code true} if and only if an error code is generated on th
e passed node | 7509 * @return return {@code true} if and only if an error code is generated on th
e passed node |
| 7510 * @see CompileTimeErrorCode#FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR | 7510 * @see CompileTimeErrorCode#FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR |
| 7511 */ | 7511 */ |
| 7512 bool checkForFieldInitializerOutsideConstructor(FieldFormalParameter node) { | 7512 bool checkForFieldInitializerOutsideConstructor(FieldFormalParameter node) { |
| 7513 ASTNode parent19 = node.parent; | 7513 ASTNode parent2 = node.parent; |
| 7514 if (parent19 != null) { | 7514 if (parent2 != null) { |
| 7515 ASTNode grandparent = parent19.parent; | 7515 ASTNode grandparent = parent2.parent; |
| 7516 if (grandparent != null && grandparent is! ConstructorDeclaration && grand
parent.parent is! ConstructorDeclaration) { | 7516 if (grandparent != null && grandparent is! ConstructorDeclaration && grand
parent.parent is! ConstructorDeclaration) { |
| 7517 _errorReporter.reportError(CompileTimeErrorCode.FIELD_INITIALIZER_OUTSID
E_CONSTRUCTOR, node, []); | 7517 _errorReporter.reportError(CompileTimeErrorCode.FIELD_INITIALIZER_OUTSID
E_CONSTRUCTOR, node, []); |
| 7518 return true; | 7518 return true; |
| 7519 } | 7519 } |
| 7520 } | 7520 } |
| 7521 return false; | 7521 return false; |
| 7522 } | 7522 } |
| 7523 /** | 7523 /** |
| 7524 * This verifies that final fields that are declared, without any constructors
in the enclosing | 7524 * This verifies that final fields that are declared, without any constructors
in the enclosing |
| 7525 * class, are initialized. Cases in which there is at least one constructor ar
e handled at the end | 7525 * class, are initialized. Cases in which there is at least one constructor ar
e handled at the end |
| (...skipping 21 matching lines...) Expand all Loading... |
| 7547 /** | 7547 /** |
| 7548 * This verifies that the passed variable declaration list has only initialize
d variables if the | 7548 * This verifies that the passed variable declaration list has only initialize
d variables if the |
| 7549 * list is final or const. This method is called by{@link #checkForFinalNotIni
tialized(ClassDeclaration)},{@link #visitTopLevelVariableDeclaration(TopLevelVar
iableDeclaration)} and{@link #visitVariableDeclarationStatement(VariableDeclarat
ionStatement)}. | 7549 * list is final or const. This method is called by{@link #checkForFinalNotIni
tialized(ClassDeclaration)},{@link #visitTopLevelVariableDeclaration(TopLevelVar
iableDeclaration)} and{@link #visitVariableDeclarationStatement(VariableDeclarat
ionStatement)}. |
| 7550 * @param node the class declaration to test | 7550 * @param node the class declaration to test |
| 7551 * @return {@code true} if and only if an error code is generated on the passe
d node | 7551 * @return {@code true} if and only if an error code is generated on the passe
d node |
| 7552 * @see CompileTimeErrorCode#FINAL_NOT_INITIALIZED | 7552 * @see CompileTimeErrorCode#FINAL_NOT_INITIALIZED |
| 7553 */ | 7553 */ |
| 7554 bool checkForFinalNotInitialized2(VariableDeclarationList node) { | 7554 bool checkForFinalNotInitialized2(VariableDeclarationList node) { |
| 7555 bool foundError = false; | 7555 bool foundError = false; |
| 7556 if (!node.isSynthetic() && (node.isConst() || node.isFinal())) { | 7556 if (!node.isSynthetic() && (node.isConst() || node.isFinal())) { |
| 7557 NodeList<VariableDeclaration> variables3 = node.variables; | 7557 NodeList<VariableDeclaration> variables2 = node.variables; |
| 7558 for (VariableDeclaration variable in variables3) { | 7558 for (VariableDeclaration variable in variables2) { |
| 7559 if (variable.initializer == null) { | 7559 if (variable.initializer == null) { |
| 7560 _errorReporter.reportError(CompileTimeErrorCode.FINAL_NOT_INITIALIZED,
variable, [variable.name.name]); | 7560 _errorReporter.reportError(CompileTimeErrorCode.FINAL_NOT_INITIALIZED,
variable, [variable.name.name]); |
| 7561 foundError = true; | 7561 foundError = true; |
| 7562 } | 7562 } |
| 7563 } | 7563 } |
| 7564 } | 7564 } |
| 7565 return foundError; | 7565 return foundError; |
| 7566 } | 7566 } |
| 7567 /** | 7567 /** |
| 7568 * This verifies that the passed implements clause does not implement classes
such as 'num' or | 7568 * This verifies that the passed implements clause does not implement classes
such as 'num' or |
| (...skipping 15 matching lines...) Expand all Loading... |
| 7584 * @return return {@code true} if and only if an error code is generated on th
e passed node | 7584 * @return return {@code true} if and only if an error code is generated on th
e passed node |
| 7585 * @see CompileTimeErrorCode#INCONSISTENT_CASE_EXPRESSION_TYPES | 7585 * @see CompileTimeErrorCode#INCONSISTENT_CASE_EXPRESSION_TYPES |
| 7586 */ | 7586 */ |
| 7587 bool checkForInconsistentCaseExpressionTypes(SwitchStatement node) { | 7587 bool checkForInconsistentCaseExpressionTypes(SwitchStatement node) { |
| 7588 NodeList<SwitchMember> switchMembers = node.members; | 7588 NodeList<SwitchMember> switchMembers = node.members; |
| 7589 bool foundError = false; | 7589 bool foundError = false; |
| 7590 Type2 firstType = null; | 7590 Type2 firstType = null; |
| 7591 for (SwitchMember switchMember in switchMembers) { | 7591 for (SwitchMember switchMember in switchMembers) { |
| 7592 if (switchMember is SwitchCase) { | 7592 if (switchMember is SwitchCase) { |
| 7593 SwitchCase switchCase = switchMember as SwitchCase; | 7593 SwitchCase switchCase = switchMember as SwitchCase; |
| 7594 Expression expression17 = switchCase.expression; | 7594 Expression expression2 = switchCase.expression; |
| 7595 if (firstType == null) { | 7595 if (firstType == null) { |
| 7596 firstType = expression17.staticType; | 7596 firstType = expression2.staticType; |
| 7597 } else { | 7597 } else { |
| 7598 Type2 nType = expression17.staticType; | 7598 Type2 nType = expression2.staticType; |
| 7599 if (firstType != nType) { | 7599 if (firstType != nType) { |
| 7600 _errorReporter.reportError(CompileTimeErrorCode.INCONSISTENT_CASE_EX
PRESSION_TYPES, expression17, [expression17.toSource(), firstType.name]); | 7600 _errorReporter.reportError(CompileTimeErrorCode.INCONSISTENT_CASE_EX
PRESSION_TYPES, expression2, [expression2.toSource(), firstType.name]); |
| 7601 foundError = true; | 7601 foundError = true; |
| 7602 } | 7602 } |
| 7603 } | 7603 } |
| 7604 } | 7604 } |
| 7605 } | 7605 } |
| 7606 return foundError; | 7606 return foundError; |
| 7607 } | 7607 } |
| 7608 /** | 7608 /** |
| 7609 * This verifies that the passed assignment expression represents a valid assi
gnment. | 7609 * This verifies that the passed assignment expression represents a valid assi
gnment. |
| 7610 * @param node the assignment expression to evaluate | 7610 * @param node the assignment expression to evaluate |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7746 return type == null ? _dynamicType : type; | 7746 return type == null ? _dynamicType : type; |
| 7747 } | 7747 } |
| 7748 /** | 7748 /** |
| 7749 * Return the variable element represented by the given expression, or {@code
null} if there is no | 7749 * Return the variable element represented by the given expression, or {@code
null} if there is no |
| 7750 * such element. | 7750 * such element. |
| 7751 * @param expression the expression whose element is to be returned | 7751 * @param expression the expression whose element is to be returned |
| 7752 * @return the variable element represented by the expression | 7752 * @return the variable element represented by the expression |
| 7753 */ | 7753 */ |
| 7754 VariableElement getVariableElement(Expression expression) { | 7754 VariableElement getVariableElement(Expression expression) { |
| 7755 if (expression is Identifier) { | 7755 if (expression is Identifier) { |
| 7756 Element element64 = ((expression as Identifier)).element; | 7756 Element element2 = ((expression as Identifier)).element; |
| 7757 if (element64 is VariableElement) { | 7757 if (element2 is VariableElement) { |
| 7758 return element64 as VariableElement; | 7758 return element2 as VariableElement; |
| 7759 } | 7759 } |
| 7760 } | 7760 } |
| 7761 return null; | 7761 return null; |
| 7762 } | 7762 } |
| 7763 } | 7763 } |
| 7764 /** | 7764 /** |
| 7765 * This enum holds one of four states of a field initialization state through a
constructor | 7765 * This enum holds one of four states of a field initialization state through a
constructor |
| 7766 * signature, not initialized, initialized in the field declaration, initialized
in the field | 7766 * signature, not initialized, initialized in the field declaration, initialized
in the field |
| 7767 * formal, and finally, initialized in the initializers list. | 7767 * formal, and finally, initialized in the initializers list. |
| 7768 */ | 7768 */ |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7813 this._type = type; | 7813 this._type = type; |
| 7814 this._message = message; | 7814 this._message = message; |
| 7815 } | 7815 } |
| 7816 ErrorSeverity get errorSeverity => _type.severity; | 7816 ErrorSeverity get errorSeverity => _type.severity; |
| 7817 String get message => _message; | 7817 String get message => _message; |
| 7818 ErrorType get type => _type; | 7818 ErrorType get type => _type; |
| 7819 bool needsRecompilation() => true; | 7819 bool needsRecompilation() => true; |
| 7820 int compareTo(ResolverErrorCode other) => __ordinal - other.__ordinal; | 7820 int compareTo(ResolverErrorCode other) => __ordinal - other.__ordinal; |
| 7821 String toString() => __name; | 7821 String toString() => __name; |
| 7822 } | 7822 } |
| OLD | NEW |