| 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 library engine.resolver; | 3 library engine.resolver; |
| 4 import 'dart:collection'; | 4 import 'dart:collection'; |
| 5 import 'java_core.dart'; | 5 import 'java_core.dart'; |
| 6 import 'java_engine.dart'; | 6 import 'java_engine.dart'; |
| 7 import 'instrumentation.dart'; | 7 import 'instrumentation.dart'; |
| 8 import 'source.dart'; | 8 import 'source.dart'; |
| 9 import 'error.dart'; | 9 import 'error.dart'; |
| 10 import 'scanner.dart' as sc; | 10 import 'scanner.dart' as sc; |
| (...skipping 2921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2932 } | 2932 } |
| 2933 return false; | 2933 return false; |
| 2934 } | 2934 } |
| 2935 | 2935 |
| 2936 /** | 2936 /** |
| 2937 * The resolver driving this participant. | 2937 * The resolver driving this participant. |
| 2938 */ | 2938 */ |
| 2939 ResolverVisitor _resolver; | 2939 ResolverVisitor _resolver; |
| 2940 | 2940 |
| 2941 /** | 2941 /** |
| 2942 * The element for the library containing the compilation unit being visited. |
| 2943 */ |
| 2944 LibraryElement _definingLibrary; |
| 2945 |
| 2946 /** |
| 2942 * A flag indicating whether we are running in strict mode. In strict mode, er
ror reporting is | 2947 * A flag indicating whether we are running in strict mode. In strict mode, er
ror reporting is |
| 2943 * based exclusively on the static type information. | 2948 * based exclusively on the static type information. |
| 2944 */ | 2949 */ |
| 2945 bool _strictMode = false; | 2950 bool _strictMode = false; |
| 2946 | 2951 |
| 2947 /** | 2952 /** |
| 2948 * A flag indicating whether we should generate hints. | 2953 * A flag indicating whether we should generate hints. |
| 2949 */ | 2954 */ |
| 2950 bool _enableHints = false; | 2955 bool _enableHints = false; |
| 2951 | 2956 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2981 */ | 2986 */ |
| 2982 static String NO_SUCH_METHOD_METHOD_NAME = "noSuchMethod"; | 2987 static String NO_SUCH_METHOD_METHOD_NAME = "noSuchMethod"; |
| 2983 | 2988 |
| 2984 /** | 2989 /** |
| 2985 * Initialize a newly created visitor to resolve the nodes in a compilation un
it. | 2990 * Initialize a newly created visitor to resolve the nodes in a compilation un
it. |
| 2986 * | 2991 * |
| 2987 * @param resolver the resolver driving this participant | 2992 * @param resolver the resolver driving this participant |
| 2988 */ | 2993 */ |
| 2989 ElementResolver(ResolverVisitor resolver) { | 2994 ElementResolver(ResolverVisitor resolver) { |
| 2990 this._resolver = resolver; | 2995 this._resolver = resolver; |
| 2991 AnalysisOptions options = resolver.definingLibrary.context.analysisOptions; | 2996 this._definingLibrary = resolver.definingLibrary; |
| 2997 AnalysisOptions options = _definingLibrary.context.analysisOptions; |
| 2992 _strictMode = options.strictMode; | 2998 _strictMode = options.strictMode; |
| 2993 _enableHints = options.hint; | 2999 _enableHints = options.hint; |
| 2994 _dynamicType = resolver.typeProvider.dynamicType; | 3000 _dynamicType = resolver.typeProvider.dynamicType; |
| 2995 _typeType = resolver.typeProvider.typeType; | 3001 _typeType = resolver.typeProvider.typeType; |
| 2996 _subtypeManager = new SubtypeManager(); | 3002 _subtypeManager = new SubtypeManager(); |
| 2997 _promoteManager = resolver.promoteManager; | 3003 _promoteManager = resolver.promoteManager; |
| 2998 } | 3004 } |
| 2999 Object visitAssignmentExpression(AssignmentExpression node) { | 3005 Object visitAssignmentExpression(AssignmentExpression node) { |
| 3000 sc.Token operator = node.operator; | 3006 sc.Token operator = node.operator; |
| 3001 sc.TokenType operatorType = operator.type; | 3007 sc.TokenType operatorType = operator.type; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3078 SimpleIdentifier simpleIdentifier = identifier as SimpleIdentifier; | 3084 SimpleIdentifier simpleIdentifier = identifier as SimpleIdentifier; |
| 3079 Element element = resolveSimpleIdentifier(simpleIdentifier); | 3085 Element element = resolveSimpleIdentifier(simpleIdentifier); |
| 3080 if (element == null) { | 3086 if (element == null) { |
| 3081 element = findImportWithoutPrefix(simpleIdentifier); | 3087 element = findImportWithoutPrefix(simpleIdentifier); |
| 3082 if (element is MultiplyDefinedElement) { | 3088 if (element is MultiplyDefinedElement) { |
| 3083 element = null; | 3089 element = null; |
| 3084 } | 3090 } |
| 3085 } | 3091 } |
| 3086 if (element == null) { | 3092 if (element == null) { |
| 3087 } else { | 3093 } else { |
| 3088 if (element.library == null || element.library != _resolver.definingLibr
ary) { | 3094 if (element.library == null || element.library != _definingLibrary) { |
| 3089 } | 3095 } |
| 3090 simpleIdentifier.staticElement = element; | 3096 simpleIdentifier.staticElement = element; |
| 3091 if (node.newKeyword != null) { | 3097 if (node.newKeyword != null) { |
| 3092 if (element is ClassElement) { | 3098 if (element is ClassElement) { |
| 3093 ConstructorElement constructor = ((element as ClassElement)).unnamed
Constructor; | 3099 ConstructorElement constructor = ((element as ClassElement)).unnamed
Constructor; |
| 3094 if (constructor == null) { | 3100 if (constructor == null) { |
| 3095 } else { | 3101 } else { |
| 3096 simpleIdentifier.staticElement = constructor; | 3102 simpleIdentifier.staticElement = constructor; |
| 3097 } | 3103 } |
| 3098 } else { | 3104 } else { |
| 3099 } | 3105 } |
| 3100 } | 3106 } |
| 3101 } | 3107 } |
| 3102 } else if (identifier is PrefixedIdentifier) { | 3108 } else if (identifier is PrefixedIdentifier) { |
| 3103 PrefixedIdentifier prefixedIdentifier = identifier as PrefixedIdentifier; | 3109 PrefixedIdentifier prefixedIdentifier = identifier as PrefixedIdentifier; |
| 3104 SimpleIdentifier prefix = prefixedIdentifier.prefix; | 3110 SimpleIdentifier prefix = prefixedIdentifier.prefix; |
| 3105 SimpleIdentifier name = prefixedIdentifier.identifier; | 3111 SimpleIdentifier name = prefixedIdentifier.identifier; |
| 3106 Element element = resolveSimpleIdentifier(prefix); | 3112 Element element = resolveSimpleIdentifier(prefix); |
| 3107 if (element == null) { | 3113 if (element == null) { |
| 3108 } else { | 3114 } else { |
| 3109 if (element is PrefixElement) { | 3115 if (element is PrefixElement) { |
| 3110 prefix.staticElement = element; | 3116 prefix.staticElement = element; |
| 3111 element = _resolver.nameScope.lookup(identifier, _resolver.definingLib
rary); | 3117 element = _resolver.nameScope.lookup(identifier, _definingLibrary); |
| 3112 name.staticElement = element; | 3118 name.staticElement = element; |
| 3113 return null; | 3119 return null; |
| 3114 } | 3120 } |
| 3115 LibraryElement library = element.library; | 3121 LibraryElement library = element.library; |
| 3116 if (library == null) { | 3122 if (library == null) { |
| 3117 AnalysisEngine.instance.logger.logError("Found element with null libra
ry: ${element.name}"); | 3123 AnalysisEngine.instance.logger.logError("Found element with null libra
ry: ${element.name}"); |
| 3118 } else if (library != _resolver.definingLibrary) { | 3124 } else if (library != _definingLibrary) { |
| 3119 } | 3125 } |
| 3120 name.staticElement = element; | 3126 name.staticElement = element; |
| 3121 if (node.newKeyword == null) { | 3127 if (node.newKeyword == null) { |
| 3122 if (element is ClassElement) { | 3128 if (element is ClassElement) { |
| 3123 Element memberElement = lookupGetterOrMethod(((element as ClassEleme
nt)).type, name.name); | 3129 Element memberElement = lookupGetterOrMethod(((element as ClassEleme
nt)).type, name.name); |
| 3124 if (memberElement == null) { | 3130 if (memberElement == null) { |
| 3125 memberElement = ((element as ClassElement)).getNamedConstructor(na
me.name); | 3131 memberElement = ((element as ClassElement)).getNamedConstructor(na
me.name); |
| 3126 if (memberElement == null) { | 3132 if (memberElement == null) { |
| 3127 memberElement = lookUpSetter(prefix, ((element as ClassElement))
.type, name.name); | 3133 memberElement = lookUpSetter(prefix, ((element as ClassElement))
.type, name.name); |
| 3128 } | 3134 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3189 if (((parent as InstanceCreationExpression)).isConst) { | 3195 if (((parent as InstanceCreationExpression)).isConst) { |
| 3190 } else { | 3196 } else { |
| 3191 } | 3197 } |
| 3192 } else { | 3198 } else { |
| 3193 } | 3199 } |
| 3194 return null; | 3200 return null; |
| 3195 } | 3201 } |
| 3196 ConstructorElement constructor; | 3202 ConstructorElement constructor; |
| 3197 SimpleIdentifier name = node.name; | 3203 SimpleIdentifier name = node.name; |
| 3198 InterfaceType interfaceType = type as InterfaceType; | 3204 InterfaceType interfaceType = type as InterfaceType; |
| 3199 LibraryElement definingLibrary = _resolver.definingLibrary; | |
| 3200 if (name == null) { | 3205 if (name == null) { |
| 3201 constructor = interfaceType.lookUpConstructor(null, definingLibrary); | 3206 constructor = interfaceType.lookUpConstructor(null, _definingLibrary); |
| 3202 } else { | 3207 } else { |
| 3203 constructor = interfaceType.lookUpConstructor(name.name, definingLibrary); | 3208 constructor = interfaceType.lookUpConstructor(name.name, _definingLibrary)
; |
| 3204 name.staticElement = constructor; | 3209 name.staticElement = constructor; |
| 3205 } | 3210 } |
| 3206 node.staticElement = constructor; | 3211 node.staticElement = constructor; |
| 3207 return null; | 3212 return null; |
| 3208 } | 3213 } |
| 3209 Object visitContinueStatement(ContinueStatement node) { | 3214 Object visitContinueStatement(ContinueStatement node) { |
| 3210 SimpleIdentifier labelNode = node.label; | 3215 SimpleIdentifier labelNode = node.label; |
| 3211 LabelElementImpl labelElement = lookupLabel(node, labelNode); | 3216 LabelElementImpl labelElement = lookupLabel(node, labelNode); |
| 3212 if (labelElement != null && labelElement.isOnSwitchStatement) { | 3217 if (labelElement != null && labelElement.isOnSwitchStatement) { |
| 3213 _resolver.reportError5(ResolverErrorCode.CONTINUE_LABEL_ON_SWITCH, labelNo
de, []); | 3218 _resolver.reportError5(ResolverErrorCode.CONTINUE_LABEL_ON_SWITCH, labelNo
de, []); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3267 } | 3272 } |
| 3268 Object visitFunctionExpressionInvocation(FunctionExpressionInvocation node) =>
null; | 3273 Object visitFunctionExpressionInvocation(FunctionExpressionInvocation node) =>
null; |
| 3269 Object visitFunctionTypeAlias(FunctionTypeAlias node) { | 3274 Object visitFunctionTypeAlias(FunctionTypeAlias node) { |
| 3270 setMetadata(node.element, node); | 3275 setMetadata(node.element, node); |
| 3271 return null; | 3276 return null; |
| 3272 } | 3277 } |
| 3273 Object visitImportDirective(ImportDirective node) { | 3278 Object visitImportDirective(ImportDirective node) { |
| 3274 SimpleIdentifier prefixNode = node.prefix; | 3279 SimpleIdentifier prefixNode = node.prefix; |
| 3275 if (prefixNode != null) { | 3280 if (prefixNode != null) { |
| 3276 String prefixName = prefixNode.name; | 3281 String prefixName = prefixNode.name; |
| 3277 for (PrefixElement prefixElement in _resolver.definingLibrary.prefixes) { | 3282 for (PrefixElement prefixElement in _definingLibrary.prefixes) { |
| 3278 if (prefixElement.displayName == prefixName) { | 3283 if (prefixElement.displayName == prefixName) { |
| 3279 prefixNode.staticElement = prefixElement; | 3284 prefixNode.staticElement = prefixElement; |
| 3280 break; | 3285 break; |
| 3281 } | 3286 } |
| 3282 } | 3287 } |
| 3283 } | 3288 } |
| 3284 ImportElement importElement = node.element; | 3289 ImportElement importElement = node.element; |
| 3285 if (importElement != null) { | 3290 if (importElement != null) { |
| 3286 LibraryElement library = importElement.importedLibrary; | 3291 LibraryElement library = importElement.importedLibrary; |
| 3287 if (library != null) { | 3292 if (library != null) { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3386 classElementContext = _resolver.enclosingClass; | 3391 classElementContext = _resolver.enclosingClass; |
| 3387 } else { | 3392 } else { |
| 3388 Type2 type = target.bestType; | 3393 Type2 type = target.bestType; |
| 3389 if (type != null) { | 3394 if (type != null) { |
| 3390 if (type.element is ClassElement) { | 3395 if (type.element is ClassElement) { |
| 3391 classElementContext = type.element as ClassElement; | 3396 classElementContext = type.element as ClassElement; |
| 3392 } | 3397 } |
| 3393 } | 3398 } |
| 3394 } | 3399 } |
| 3395 if (classElementContext != null) { | 3400 if (classElementContext != null) { |
| 3396 _subtypeManager.ensureLibraryVisited(_resolver.definingLibrary); | 3401 _subtypeManager.ensureLibraryVisited(_definingLibrary); |
| 3397 Set<ClassElement> subtypeElements = _subtypeManager.computeAllSubtypes
(classElementContext); | 3402 Set<ClassElement> subtypeElements = _subtypeManager.computeAllSubtypes
(classElementContext); |
| 3398 for (ClassElement subtypeElement in subtypeElements) { | 3403 for (ClassElement subtypeElement in subtypeElements) { |
| 3399 if (subtypeElement.getMethod(methodName.name) != null) { | 3404 if (subtypeElement.getMethod(methodName.name) != null) { |
| 3400 errorCode = null; | 3405 errorCode = null; |
| 3401 } | 3406 } |
| 3402 } | 3407 } |
| 3403 } | 3408 } |
| 3404 } | 3409 } |
| 3405 generatedWithTypePropagation = true; | 3410 generatedWithTypePropagation = true; |
| 3406 } | 3411 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3472 methodName, | 3477 methodName, |
| 3473 shouldReportMissingMember_static ? staticType.displayName : propagated
Type.displayName]); | 3478 shouldReportMissingMember_static ? staticType.displayName : propagated
Type.displayName]); |
| 3474 } | 3479 } |
| 3475 return null; | 3480 return null; |
| 3476 } | 3481 } |
| 3477 Object visitPrefixedIdentifier(PrefixedIdentifier node) { | 3482 Object visitPrefixedIdentifier(PrefixedIdentifier node) { |
| 3478 SimpleIdentifier prefix = node.prefix; | 3483 SimpleIdentifier prefix = node.prefix; |
| 3479 SimpleIdentifier identifier = node.identifier; | 3484 SimpleIdentifier identifier = node.identifier; |
| 3480 Element prefixElement = prefix.staticElement; | 3485 Element prefixElement = prefix.staticElement; |
| 3481 if (prefixElement is PrefixElement) { | 3486 if (prefixElement is PrefixElement) { |
| 3482 Element element = _resolver.nameScope.lookup(node, _resolver.definingLibra
ry); | 3487 Element element = _resolver.nameScope.lookup(node, _definingLibrary); |
| 3483 if (element == null && identifier.inSetterContext()) { | 3488 if (element == null && identifier.inSetterContext()) { |
| 3484 element = _resolver.nameScope.lookup(new ElementResolver_SyntheticIdenti
fier("${node.name}="), _resolver.definingLibrary); | 3489 element = _resolver.nameScope.lookup(new ElementResolver_SyntheticIdenti
fier("${node.name}="), _definingLibrary); |
| 3485 } | 3490 } |
| 3486 if (element == null) { | 3491 if (element == null) { |
| 3487 if (identifier.inSetterContext()) { | 3492 if (identifier.inSetterContext()) { |
| 3488 _resolver.reportError5(StaticWarningCode.UNDEFINED_SETTER, identifier,
[identifier.name, prefixElement.name]); | 3493 _resolver.reportError5(StaticWarningCode.UNDEFINED_SETTER, identifier,
[identifier.name, prefixElement.name]); |
| 3489 } else { | 3494 } else { |
| 3490 _resolver.reportError5(StaticWarningCode.UNDEFINED_GETTER, identifier,
[identifier.name, prefixElement.name]); | 3495 _resolver.reportError5(StaticWarningCode.UNDEFINED_GETTER, identifier,
[identifier.name, prefixElement.name]); |
| 3491 } | 3496 } |
| 3492 return null; | 3497 return null; |
| 3493 } | 3498 } |
| 3494 if (element is PropertyAccessorElement && identifier.inSetterContext()) { | 3499 if (element is PropertyAccessorElement && identifier.inSetterContext()) { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3617 ClassElement enclosingClass = _resolver.enclosingClass; | 3622 ClassElement enclosingClass = _resolver.enclosingClass; |
| 3618 if (enclosingClass == null) { | 3623 if (enclosingClass == null) { |
| 3619 return null; | 3624 return null; |
| 3620 } | 3625 } |
| 3621 InterfaceType superType = enclosingClass.supertype; | 3626 InterfaceType superType = enclosingClass.supertype; |
| 3622 if (superType == null) { | 3627 if (superType == null) { |
| 3623 return null; | 3628 return null; |
| 3624 } | 3629 } |
| 3625 SimpleIdentifier name = node.constructorName; | 3630 SimpleIdentifier name = node.constructorName; |
| 3626 String superName = name != null ? name.name : null; | 3631 String superName = name != null ? name.name : null; |
| 3627 ConstructorElement element = superType.lookUpConstructor(superName, _resolve
r.definingLibrary); | 3632 ConstructorElement element = superType.lookUpConstructor(superName, _definin
gLibrary); |
| 3628 if (element == null) { | 3633 if (element == null) { |
| 3629 if (name != null) { | 3634 if (name != null) { |
| 3630 _resolver.reportError5(CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INI
TIALIZER, node, [superType.displayName, name]); | 3635 _resolver.reportError5(CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INI
TIALIZER, node, [superType.displayName, name]); |
| 3631 } else { | 3636 } else { |
| 3632 _resolver.reportError5(CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INI
TIALIZER_DEFAULT, node, [superType.displayName]); | 3637 _resolver.reportError5(CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INI
TIALIZER_DEFAULT, node, [superType.displayName]); |
| 3633 } | 3638 } |
| 3634 return null; | 3639 return null; |
| 3635 } else { | 3640 } else { |
| 3636 if (element.isFactory) { | 3641 if (element.isFactory) { |
| 3637 _resolver.reportError5(CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR,
node, [element]); | 3642 _resolver.reportError5(CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR,
node, [element]); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3800 * @param argumentList the list of arguments being passed to the element | 3805 * @param argumentList the list of arguments being passed to the element |
| 3801 * @param executableElement the element that will be invoked with the argument
s | 3806 * @param executableElement the element that will be invoked with the argument
s |
| 3802 * @return the parameters that correspond to the arguments | 3807 * @return the parameters that correspond to the arguments |
| 3803 */ | 3808 */ |
| 3804 List<ParameterElement> computeCorrespondingParameters(ArgumentList argumentLis
t, Element element) { | 3809 List<ParameterElement> computeCorrespondingParameters(ArgumentList argumentLis
t, Element element) { |
| 3805 if (element is PropertyAccessorElement) { | 3810 if (element is PropertyAccessorElement) { |
| 3806 FunctionType getterType = ((element as PropertyAccessorElement)).type; | 3811 FunctionType getterType = ((element as PropertyAccessorElement)).type; |
| 3807 if (getterType != null) { | 3812 if (getterType != null) { |
| 3808 Type2 getterReturnType = getterType.returnType; | 3813 Type2 getterReturnType = getterType.returnType; |
| 3809 if (getterReturnType is InterfaceType) { | 3814 if (getterReturnType is InterfaceType) { |
| 3810 MethodElement callMethod = ((getterReturnType as InterfaceType)).lookU
pMethod(CALL_METHOD_NAME, _resolver.definingLibrary); | 3815 MethodElement callMethod = ((getterReturnType as InterfaceType)).lookU
pMethod(CALL_METHOD_NAME, _definingLibrary); |
| 3811 if (callMethod != null) { | 3816 if (callMethod != null) { |
| 3812 return resolveArgumentsToParameters(false, argumentList, callMethod)
; | 3817 return resolveArgumentsToParameters(false, argumentList, callMethod)
; |
| 3813 } | 3818 } |
| 3814 } else if (getterReturnType is FunctionType) { | 3819 } else if (getterReturnType is FunctionType) { |
| 3815 Element functionElement = ((getterReturnType as FunctionType)).element
; | 3820 Element functionElement = ((getterReturnType as FunctionType)).element
; |
| 3816 if (functionElement is ExecutableElement) { | 3821 if (functionElement is ExecutableElement) { |
| 3817 return resolveArgumentsToParameters(false, argumentList, functionEle
ment as ExecutableElement); | 3822 return resolveArgumentsToParameters(false, argumentList, functionEle
ment as ExecutableElement); |
| 3818 } | 3823 } |
| 3819 } | 3824 } |
| 3820 } | 3825 } |
| 3821 } else if (element is ExecutableElement) { | 3826 } else if (element is ExecutableElement) { |
| 3822 return resolveArgumentsToParameters(false, argumentList, element as Execut
ableElement); | 3827 return resolveArgumentsToParameters(false, argumentList, element as Execut
ableElement); |
| 3823 } else if (element is VariableElement) { | 3828 } else if (element is VariableElement) { |
| 3824 VariableElement variable = element as VariableElement; | 3829 VariableElement variable = element as VariableElement; |
| 3825 Type2 type = _promoteManager.getStaticType(variable); | 3830 Type2 type = _promoteManager.getStaticType(variable); |
| 3826 if (type is FunctionType) { | 3831 if (type is FunctionType) { |
| 3827 FunctionType functionType = type as FunctionType; | 3832 FunctionType functionType = type as FunctionType; |
| 3828 List<ParameterElement> parameters = functionType.parameters; | 3833 List<ParameterElement> parameters = functionType.parameters; |
| 3829 return resolveArgumentsToParameters2(false, argumentList, parameters); | 3834 return resolveArgumentsToParameters2(false, argumentList, parameters); |
| 3830 } else if (type is InterfaceType) { | 3835 } else if (type is InterfaceType) { |
| 3831 MethodElement callMethod = ((type as InterfaceType)).lookUpMethod(CALL_M
ETHOD_NAME, _resolver.definingLibrary); | 3836 MethodElement callMethod = ((type as InterfaceType)).lookUpMethod(CALL_M
ETHOD_NAME, _definingLibrary); |
| 3832 if (callMethod != null) { | 3837 if (callMethod != null) { |
| 3833 List<ParameterElement> parameters = callMethod.parameters; | 3838 List<ParameterElement> parameters = callMethod.parameters; |
| 3834 return resolveArgumentsToParameters2(false, argumentList, parameters); | 3839 return resolveArgumentsToParameters2(false, argumentList, parameters); |
| 3835 } | 3840 } |
| 3836 } | 3841 } |
| 3837 } | 3842 } |
| 3838 return null; | 3843 return null; |
| 3839 } | 3844 } |
| 3840 | 3845 |
| 3841 /** | 3846 /** |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3855 /** | 3860 /** |
| 3856 * Look for any declarations of the given identifier that are imported using a
prefix. Return the | 3861 * Look for any declarations of the given identifier that are imported using a
prefix. Return the |
| 3857 * element that was found, or `null` if the name is not imported using a prefi
x. | 3862 * element that was found, or `null` if the name is not imported using a prefi
x. |
| 3858 * | 3863 * |
| 3859 * @param identifier the identifier that might have been imported using a pref
ix | 3864 * @param identifier the identifier that might have been imported using a pref
ix |
| 3860 * @return the element that was found | 3865 * @return the element that was found |
| 3861 */ | 3866 */ |
| 3862 Element findImportWithoutPrefix(SimpleIdentifier identifier) { | 3867 Element findImportWithoutPrefix(SimpleIdentifier identifier) { |
| 3863 Element element = null; | 3868 Element element = null; |
| 3864 Scope nameScope = _resolver.nameScope; | 3869 Scope nameScope = _resolver.nameScope; |
| 3865 LibraryElement definingLibrary = _resolver.definingLibrary; | 3870 for (ImportElement importElement in _definingLibrary.imports) { |
| 3866 for (ImportElement importElement in definingLibrary.imports) { | |
| 3867 PrefixElement prefixElement = importElement.prefix; | 3871 PrefixElement prefixElement = importElement.prefix; |
| 3868 if (prefixElement != null) { | 3872 if (prefixElement != null) { |
| 3869 Identifier prefixedIdentifier = new ElementResolver_SyntheticIdentifier(
"${prefixElement.name}.${identifier.name}"); | 3873 Identifier prefixedIdentifier = new ElementResolver_SyntheticIdentifier(
"${prefixElement.name}.${identifier.name}"); |
| 3870 Element importedElement = nameScope.lookup(prefixedIdentifier, definingL
ibrary); | 3874 Element importedElement = nameScope.lookup(prefixedIdentifier, _defining
Library); |
| 3871 if (importedElement != null) { | 3875 if (importedElement != null) { |
| 3872 if (element == null) { | 3876 if (element == null) { |
| 3873 element = importedElement; | 3877 element = importedElement; |
| 3874 } else { | 3878 } else { |
| 3875 element = MultiplyDefinedElementImpl.fromElements(definingLibrary.co
ntext, element, importedElement); | 3879 element = MultiplyDefinedElementImpl.fromElements(_definingLibrary.c
ontext, element, importedElement); |
| 3876 } | 3880 } |
| 3877 } | 3881 } |
| 3878 } | 3882 } |
| 3879 } | 3883 } |
| 3880 return element; | 3884 return element; |
| 3881 } | 3885 } |
| 3882 | 3886 |
| 3883 /** | 3887 /** |
| 3884 * Return the name of the method invoked by the given postfix expression. | 3888 * Return the name of the method invoked by the given postfix expression. |
| 3885 * | 3889 * |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3944 * operator '()'. | 3948 * operator '()'. |
| 3945 * | 3949 * |
| 3946 * @param type the type being tested | 3950 * @param type the type being tested |
| 3947 * @return `true` if the given type represents an object that could be invoked | 3951 * @return `true` if the given type represents an object that could be invoked |
| 3948 */ | 3952 */ |
| 3949 bool isExecutableType(Type2 type) { | 3953 bool isExecutableType(Type2 type) { |
| 3950 if (type.isDynamic || (type is FunctionType) || type.isDartCoreFunction || t
ype.isObject) { | 3954 if (type.isDynamic || (type is FunctionType) || type.isDartCoreFunction || t
ype.isObject) { |
| 3951 return true; | 3955 return true; |
| 3952 } else if (type is InterfaceType) { | 3956 } else if (type is InterfaceType) { |
| 3953 ClassElement classElement = ((type as InterfaceType)).element; | 3957 ClassElement classElement = ((type as InterfaceType)).element; |
| 3954 MethodElement methodElement = classElement.lookUpMethod(CALL_METHOD_NAME,
_resolver.definingLibrary); | 3958 MethodElement methodElement = classElement.lookUpMethod(CALL_METHOD_NAME,
_definingLibrary); |
| 3955 return methodElement != null; | 3959 return methodElement != null; |
| 3956 } | 3960 } |
| 3957 return false; | 3961 return false; |
| 3958 } | 3962 } |
| 3959 | 3963 |
| 3960 /** | 3964 /** |
| 3961 * @return `true` iff current enclosing function is constant constructor decla
ration. | 3965 * @return `true` iff current enclosing function is constant constructor decla
ration. |
| 3962 */ | 3966 */ |
| 3963 bool get isInConstConstructor { | 3967 bool get isInConstConstructor { |
| 3964 ExecutableElement function = _resolver.enclosingFunction; | 3968 ExecutableElement function = _resolver.enclosingFunction; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4013 * @param type the type in which the getter is defined | 4017 * @param type the type in which the getter is defined |
| 4014 * @param getterName the name of the getter being looked up | 4018 * @param getterName the name of the getter being looked up |
| 4015 * @return the element representing the getter that was found | 4019 * @return the element representing the getter that was found |
| 4016 */ | 4020 */ |
| 4017 PropertyAccessorElement lookUpGetter(Expression target, Type2 type, String get
terName) { | 4021 PropertyAccessorElement lookUpGetter(Expression target, Type2 type, String get
terName) { |
| 4018 type = resolveTypeParameter(type); | 4022 type = resolveTypeParameter(type); |
| 4019 if (type is InterfaceType) { | 4023 if (type is InterfaceType) { |
| 4020 InterfaceType interfaceType = type as InterfaceType; | 4024 InterfaceType interfaceType = type as InterfaceType; |
| 4021 PropertyAccessorElement accessor; | 4025 PropertyAccessorElement accessor; |
| 4022 if (target is SuperExpression) { | 4026 if (target is SuperExpression) { |
| 4023 accessor = interfaceType.lookUpGetterInSuperclass(getterName, _resolver.
definingLibrary); | 4027 accessor = interfaceType.lookUpGetterInSuperclass(getterName, _definingL
ibrary); |
| 4024 } else { | 4028 } else { |
| 4025 accessor = interfaceType.lookUpGetter(getterName, _resolver.definingLibr
ary); | 4029 accessor = interfaceType.lookUpGetter(getterName, _definingLibrary); |
| 4026 } | 4030 } |
| 4027 if (accessor != null) { | 4031 if (accessor != null) { |
| 4028 return accessor; | 4032 return accessor; |
| 4029 } | 4033 } |
| 4030 return lookUpGetterInInterfaces(interfaceType, false, getterName, new Set<
ClassElement>()); | 4034 return lookUpGetterInInterfaces(interfaceType, false, getterName, new Set<
ClassElement>()); |
| 4031 } | 4035 } |
| 4032 return null; | 4036 return null; |
| 4033 } | 4037 } |
| 4034 | 4038 |
| 4035 /** | 4039 /** |
| 4036 * Look up the getter with the given name in the interfaces implemented by the
given type, either | 4040 * Look up the getter with the given name in the interfaces implemented by the
given type, either |
| 4037 * directly or indirectly. Return the element representing the getter that was
found, or | 4041 * directly or indirectly. Return the element representing the getter that was
found, or |
| 4038 * `null` if there is no getter with the given name. | 4042 * `null` if there is no getter with the given name. |
| 4039 * | 4043 * |
| 4040 * @param targetType the type in which the getter might be defined | 4044 * @param targetType the type in which the getter might be defined |
| 4041 * @param includeTargetType `true` if the search should include the target typ
e | 4045 * @param includeTargetType `true` if the search should include the target typ
e |
| 4042 * @param getterName the name of the getter being looked up | 4046 * @param getterName the name of the getter being looked up |
| 4043 * @param visitedInterfaces a set containing all of the interfaces that have b
een examined, used | 4047 * @param visitedInterfaces a set containing all of the interfaces that have b
een examined, used |
| 4044 * to prevent infinite recursion and to optimize the search | 4048 * to prevent infinite recursion and to optimize the search |
| 4045 * @return the element representing the getter that was found | 4049 * @return the element representing the getter that was found |
| 4046 */ | 4050 */ |
| 4047 PropertyAccessorElement lookUpGetterInInterfaces(InterfaceType targetType, boo
l includeTargetType, String getterName, Set<ClassElement> visitedInterfaces) { | 4051 PropertyAccessorElement lookUpGetterInInterfaces(InterfaceType targetType, boo
l includeTargetType, String getterName, Set<ClassElement> visitedInterfaces) { |
| 4048 ClassElement targetClass = targetType.element; | 4052 ClassElement targetClass = targetType.element; |
| 4049 if (visitedInterfaces.contains(targetClass)) { | 4053 if (visitedInterfaces.contains(targetClass)) { |
| 4050 return null; | 4054 return null; |
| 4051 } | 4055 } |
| 4052 javaSetAdd(visitedInterfaces, targetClass); | 4056 javaSetAdd(visitedInterfaces, targetClass); |
| 4053 if (includeTargetType) { | 4057 if (includeTargetType) { |
| 4054 PropertyAccessorElement getter = targetType.getGetter(getterName); | 4058 PropertyAccessorElement getter = targetType.getGetter(getterName); |
| 4055 if (getter != null && getter.isAccessibleIn(_resolver.definingLibrary)) { | 4059 if (getter != null && getter.isAccessibleIn(_definingLibrary)) { |
| 4056 return getter; | 4060 return getter; |
| 4057 } | 4061 } |
| 4058 } | 4062 } |
| 4059 for (InterfaceType interfaceType in targetType.interfaces) { | 4063 for (InterfaceType interfaceType in targetType.interfaces) { |
| 4060 PropertyAccessorElement getter = lookUpGetterInInterfaces(interfaceType, t
rue, getterName, visitedInterfaces); | 4064 PropertyAccessorElement getter = lookUpGetterInInterfaces(interfaceType, t
rue, getterName, visitedInterfaces); |
| 4061 if (getter != null) { | 4065 if (getter != null) { |
| 4062 return getter; | 4066 return getter; |
| 4063 } | 4067 } |
| 4064 } | 4068 } |
| 4065 for (InterfaceType mixinType in targetType.mixins) { | 4069 for (InterfaceType mixinType in targetType.mixins) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 4081 * getter with the given name. | 4085 * getter with the given name. |
| 4082 * | 4086 * |
| 4083 * @param type the type in which the method or getter is defined | 4087 * @param type the type in which the method or getter is defined |
| 4084 * @param memberName the name of the method or getter being looked up | 4088 * @param memberName the name of the method or getter being looked up |
| 4085 * @return the element representing the method or getter that was found | 4089 * @return the element representing the method or getter that was found |
| 4086 */ | 4090 */ |
| 4087 ExecutableElement lookupGetterOrMethod(Type2 type, String memberName) { | 4091 ExecutableElement lookupGetterOrMethod(Type2 type, String memberName) { |
| 4088 type = resolveTypeParameter(type); | 4092 type = resolveTypeParameter(type); |
| 4089 if (type is InterfaceType) { | 4093 if (type is InterfaceType) { |
| 4090 InterfaceType interfaceType = type as InterfaceType; | 4094 InterfaceType interfaceType = type as InterfaceType; |
| 4091 ExecutableElement member = interfaceType.lookUpMethod(memberName, _resolve
r.definingLibrary); | 4095 ExecutableElement member = interfaceType.lookUpMethod(memberName, _definin
gLibrary); |
| 4092 if (member != null) { | 4096 if (member != null) { |
| 4093 return member; | 4097 return member; |
| 4094 } | 4098 } |
| 4095 member = interfaceType.lookUpGetter(memberName, _resolver.definingLibrary)
; | 4099 member = interfaceType.lookUpGetter(memberName, _definingLibrary); |
| 4096 if (member != null) { | 4100 if (member != null) { |
| 4097 return member; | 4101 return member; |
| 4098 } | 4102 } |
| 4099 return lookUpGetterOrMethodInInterfaces(interfaceType, false, memberName,
new Set<ClassElement>()); | 4103 return lookUpGetterOrMethodInInterfaces(interfaceType, false, memberName,
new Set<ClassElement>()); |
| 4100 } | 4104 } |
| 4101 return null; | 4105 return null; |
| 4102 } | 4106 } |
| 4103 | 4107 |
| 4104 /** | 4108 /** |
| 4105 * Look up the method or getter with the given name in the interfaces implemen
ted by the given | 4109 * Look up the method or getter with the given name in the interfaces implemen
ted by the given |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4196 * @param type the type in which the method is defined | 4200 * @param type the type in which the method is defined |
| 4197 * @param methodName the name of the method being looked up | 4201 * @param methodName the name of the method being looked up |
| 4198 * @return the element representing the method that was found | 4202 * @return the element representing the method that was found |
| 4199 */ | 4203 */ |
| 4200 MethodElement lookUpMethod(Expression target, Type2 type, String methodName) { | 4204 MethodElement lookUpMethod(Expression target, Type2 type, String methodName) { |
| 4201 type = resolveTypeParameter(type); | 4205 type = resolveTypeParameter(type); |
| 4202 if (type is InterfaceType) { | 4206 if (type is InterfaceType) { |
| 4203 InterfaceType interfaceType = type as InterfaceType; | 4207 InterfaceType interfaceType = type as InterfaceType; |
| 4204 MethodElement method; | 4208 MethodElement method; |
| 4205 if (target is SuperExpression) { | 4209 if (target is SuperExpression) { |
| 4206 method = interfaceType.lookUpMethodInSuperclass(methodName, _resolver.de
finingLibrary); | 4210 method = interfaceType.lookUpMethodInSuperclass(methodName, _definingLib
rary); |
| 4207 } else { | 4211 } else { |
| 4208 method = interfaceType.lookUpMethod(methodName, _resolver.definingLibrar
y); | 4212 method = interfaceType.lookUpMethod(methodName, _definingLibrary); |
| 4209 } | 4213 } |
| 4210 if (method != null) { | 4214 if (method != null) { |
| 4211 return method; | 4215 return method; |
| 4212 } | 4216 } |
| 4213 return lookUpMethodInInterfaces(interfaceType, false, methodName, new Set<
ClassElement>()); | 4217 return lookUpMethodInInterfaces(interfaceType, false, methodName, new Set<
ClassElement>()); |
| 4214 } | 4218 } |
| 4215 return null; | 4219 return null; |
| 4216 } | 4220 } |
| 4217 | 4221 |
| 4218 /** | 4222 /** |
| 4219 * Look up the method with the given name in the interfaces implemented by the
given type, either | 4223 * Look up the method with the given name in the interfaces implemented by the
given type, either |
| 4220 * directly or indirectly. Return the element representing the method that was
found, or | 4224 * directly or indirectly. Return the element representing the method that was
found, or |
| 4221 * `null` if there is no method with the given name. | 4225 * `null` if there is no method with the given name. |
| 4222 * | 4226 * |
| 4223 * @param targetType the type in which the member might be defined | 4227 * @param targetType the type in which the member might be defined |
| 4224 * @param includeTargetType `true` if the search should include the target typ
e | 4228 * @param includeTargetType `true` if the search should include the target typ
e |
| 4225 * @param methodName the name of the method being looked up | 4229 * @param methodName the name of the method being looked up |
| 4226 * @param visitedInterfaces a set containing all of the interfaces that have b
een examined, used | 4230 * @param visitedInterfaces a set containing all of the interfaces that have b
een examined, used |
| 4227 * to prevent infinite recursion and to optimize the search | 4231 * to prevent infinite recursion and to optimize the search |
| 4228 * @return the element representing the method that was found | 4232 * @return the element representing the method that was found |
| 4229 */ | 4233 */ |
| 4230 MethodElement lookUpMethodInInterfaces(InterfaceType targetType, bool includeT
argetType, String methodName, Set<ClassElement> visitedInterfaces) { | 4234 MethodElement lookUpMethodInInterfaces(InterfaceType targetType, bool includeT
argetType, String methodName, Set<ClassElement> visitedInterfaces) { |
| 4231 ClassElement targetClass = targetType.element; | 4235 ClassElement targetClass = targetType.element; |
| 4232 if (visitedInterfaces.contains(targetClass)) { | 4236 if (visitedInterfaces.contains(targetClass)) { |
| 4233 return null; | 4237 return null; |
| 4234 } | 4238 } |
| 4235 javaSetAdd(visitedInterfaces, targetClass); | 4239 javaSetAdd(visitedInterfaces, targetClass); |
| 4236 if (includeTargetType) { | 4240 if (includeTargetType) { |
| 4237 MethodElement method = targetType.getMethod(methodName); | 4241 MethodElement method = targetType.getMethod(methodName); |
| 4238 if (method != null && method.isAccessibleIn(_resolver.definingLibrary)) { | 4242 if (method != null && method.isAccessibleIn(_definingLibrary)) { |
| 4239 return method; | 4243 return method; |
| 4240 } | 4244 } |
| 4241 } | 4245 } |
| 4242 for (InterfaceType interfaceType in targetType.interfaces) { | 4246 for (InterfaceType interfaceType in targetType.interfaces) { |
| 4243 MethodElement method = lookUpMethodInInterfaces(interfaceType, true, metho
dName, visitedInterfaces); | 4247 MethodElement method = lookUpMethodInInterfaces(interfaceType, true, metho
dName, visitedInterfaces); |
| 4244 if (method != null) { | 4248 if (method != null) { |
| 4245 return method; | 4249 return method; |
| 4246 } | 4250 } |
| 4247 } | 4251 } |
| 4248 for (InterfaceType mixinType in targetType.mixins) { | 4252 for (InterfaceType mixinType in targetType.mixins) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 4266 * @param type the type in which the setter is defined | 4270 * @param type the type in which the setter is defined |
| 4267 * @param setterName the name of the setter being looked up | 4271 * @param setterName the name of the setter being looked up |
| 4268 * @return the element representing the setter that was found | 4272 * @return the element representing the setter that was found |
| 4269 */ | 4273 */ |
| 4270 PropertyAccessorElement lookUpSetter(Expression target, Type2 type, String set
terName) { | 4274 PropertyAccessorElement lookUpSetter(Expression target, Type2 type, String set
terName) { |
| 4271 type = resolveTypeParameter(type); | 4275 type = resolveTypeParameter(type); |
| 4272 if (type is InterfaceType) { | 4276 if (type is InterfaceType) { |
| 4273 InterfaceType interfaceType = type as InterfaceType; | 4277 InterfaceType interfaceType = type as InterfaceType; |
| 4274 PropertyAccessorElement accessor; | 4278 PropertyAccessorElement accessor; |
| 4275 if (target is SuperExpression) { | 4279 if (target is SuperExpression) { |
| 4276 accessor = interfaceType.lookUpSetterInSuperclass(setterName, _resolver.
definingLibrary); | 4280 accessor = interfaceType.lookUpSetterInSuperclass(setterName, _definingL
ibrary); |
| 4277 } else { | 4281 } else { |
| 4278 accessor = interfaceType.lookUpSetter(setterName, _resolver.definingLibr
ary); | 4282 accessor = interfaceType.lookUpSetter(setterName, _definingLibrary); |
| 4279 } | 4283 } |
| 4280 if (accessor != null) { | 4284 if (accessor != null) { |
| 4281 return accessor; | 4285 return accessor; |
| 4282 } | 4286 } |
| 4283 return lookUpSetterInInterfaces(interfaceType, false, setterName, new Set<
ClassElement>()); | 4287 return lookUpSetterInInterfaces(interfaceType, false, setterName, new Set<
ClassElement>()); |
| 4284 } | 4288 } |
| 4285 return null; | 4289 return null; |
| 4286 } | 4290 } |
| 4287 | 4291 |
| 4288 /** | 4292 /** |
| 4289 * Look up the setter with the given name in the interfaces implemented by the
given type, either | 4293 * Look up the setter with the given name in the interfaces implemented by the
given type, either |
| 4290 * directly or indirectly. Return the element representing the setter that was
found, or | 4294 * directly or indirectly. Return the element representing the setter that was
found, or |
| 4291 * `null` if there is no setter with the given name. | 4295 * `null` if there is no setter with the given name. |
| 4292 * | 4296 * |
| 4293 * @param targetType the type in which the setter might be defined | 4297 * @param targetType the type in which the setter might be defined |
| 4294 * @param includeTargetType `true` if the search should include the target typ
e | 4298 * @param includeTargetType `true` if the search should include the target typ
e |
| 4295 * @param setterName the name of the setter being looked up | 4299 * @param setterName the name of the setter being looked up |
| 4296 * @param visitedInterfaces a set containing all of the interfaces that have b
een examined, used | 4300 * @param visitedInterfaces a set containing all of the interfaces that have b
een examined, used |
| 4297 * to prevent infinite recursion and to optimize the search | 4301 * to prevent infinite recursion and to optimize the search |
| 4298 * @return the element representing the setter that was found | 4302 * @return the element representing the setter that was found |
| 4299 */ | 4303 */ |
| 4300 PropertyAccessorElement lookUpSetterInInterfaces(InterfaceType targetType, boo
l includeTargetType, String setterName, Set<ClassElement> visitedInterfaces) { | 4304 PropertyAccessorElement lookUpSetterInInterfaces(InterfaceType targetType, boo
l includeTargetType, String setterName, Set<ClassElement> visitedInterfaces) { |
| 4301 ClassElement targetClass = targetType.element; | 4305 ClassElement targetClass = targetType.element; |
| 4302 if (visitedInterfaces.contains(targetClass)) { | 4306 if (visitedInterfaces.contains(targetClass)) { |
| 4303 return null; | 4307 return null; |
| 4304 } | 4308 } |
| 4305 javaSetAdd(visitedInterfaces, targetClass); | 4309 javaSetAdd(visitedInterfaces, targetClass); |
| 4306 if (includeTargetType) { | 4310 if (includeTargetType) { |
| 4307 PropertyAccessorElement setter = targetType.getSetter(setterName); | 4311 PropertyAccessorElement setter = targetType.getSetter(setterName); |
| 4308 if (setter != null && setter.isAccessibleIn(_resolver.definingLibrary)) { | 4312 if (setter != null && setter.isAccessibleIn(_definingLibrary)) { |
| 4309 return setter; | 4313 return setter; |
| 4310 } | 4314 } |
| 4311 } | 4315 } |
| 4312 for (InterfaceType interfaceType in targetType.interfaces) { | 4316 for (InterfaceType interfaceType in targetType.interfaces) { |
| 4313 PropertyAccessorElement setter = lookUpSetterInInterfaces(interfaceType, t
rue, setterName, visitedInterfaces); | 4317 PropertyAccessorElement setter = lookUpSetterInInterfaces(interfaceType, t
rue, setterName, visitedInterfaces); |
| 4314 if (setter != null) { | 4318 if (setter != null) { |
| 4315 return setter; | 4319 return setter; |
| 4316 } | 4320 } |
| 4317 } | 4321 } |
| 4318 for (InterfaceType mixinType in targetType.mixins) { | 4322 for (InterfaceType mixinType in targetType.mixins) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 4336 * @param element the class element to search the subtypes of, if a non-ClassE
lement element is | 4340 * @param element the class element to search the subtypes of, if a non-ClassE
lement element is |
| 4337 * passed, then `false` is returned | 4341 * passed, then `false` is returned |
| 4338 * @param memberName the member name to search for | 4342 * @param memberName the member name to search for |
| 4339 * @param asMethod `true` if the methods should be searched for in the subtype
s | 4343 * @param asMethod `true` if the methods should be searched for in the subtype
s |
| 4340 * @param asAccessor `true` if the accessors (getters and setters) should be s
earched for in | 4344 * @param asAccessor `true` if the accessors (getters and setters) should be s
earched for in |
| 4341 * the subtypes | 4345 * the subtypes |
| 4342 * @return `true` if and only if the passed memberName was found in a subtype | 4346 * @return `true` if and only if the passed memberName was found in a subtype |
| 4343 */ | 4347 */ |
| 4344 bool memberFoundInSubclass(Element element, String memberName, bool asMethod,
bool asAccessor) { | 4348 bool memberFoundInSubclass(Element element, String memberName, bool asMethod,
bool asAccessor) { |
| 4345 if (element is ClassElement) { | 4349 if (element is ClassElement) { |
| 4346 _subtypeManager.ensureLibraryVisited(_resolver.definingLibrary); | 4350 _subtypeManager.ensureLibraryVisited(_definingLibrary); |
| 4347 Set<ClassElement> subtypeElements = _subtypeManager.computeAllSubtypes(ele
ment as ClassElement); | 4351 Set<ClassElement> subtypeElements = _subtypeManager.computeAllSubtypes(ele
ment as ClassElement); |
| 4348 for (ClassElement subtypeElement in subtypeElements) { | 4352 for (ClassElement subtypeElement in subtypeElements) { |
| 4349 if (asMethod && subtypeElement.getMethod(memberName) != null) { | 4353 if (asMethod && subtypeElement.getMethod(memberName) != null) { |
| 4350 return true; | 4354 return true; |
| 4351 } else if (asAccessor && (subtypeElement.getGetter(memberName) != null |
| subtypeElement.getSetter(memberName) != null)) { | 4355 } else if (asAccessor && (subtypeElement.getGetter(memberName) != null |
| subtypeElement.getSetter(memberName) != null)) { |
| 4352 return true; | 4356 return true; |
| 4353 } | 4357 } |
| 4354 } | 4358 } |
| 4355 } | 4359 } |
| 4356 return false; | 4360 return false; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4426 return; | 4430 return; |
| 4427 } | 4431 } |
| 4428 if (element is ClassElement) { | 4432 if (element is ClassElement) { |
| 4429 if (nameNode == null) { | 4433 if (nameNode == null) { |
| 4430 nameNode = annotation.constructorName; | 4434 nameNode = annotation.constructorName; |
| 4431 } | 4435 } |
| 4432 String name = nameNode != null ? nameNode.name : null; | 4436 String name = nameNode != null ? nameNode.name : null; |
| 4433 ConstructorElement constructor; | 4437 ConstructorElement constructor; |
| 4434 { | 4438 { |
| 4435 InterfaceType interfaceType = new InterfaceTypeImpl.con1(element as Clas
sElement); | 4439 InterfaceType interfaceType = new InterfaceTypeImpl.con1(element as Clas
sElement); |
| 4436 LibraryElement definingLibrary = _resolver.definingLibrary; | 4440 constructor = interfaceType.lookUpConstructor(name, _definingLibrary); |
| 4437 constructor = interfaceType.lookUpConstructor(name, definingLibrary); | |
| 4438 } | 4441 } |
| 4439 if (constructor == null) { | 4442 if (constructor == null) { |
| 4440 _resolver.reportError5(CompileTimeErrorCode.INVALID_ANNOTATION, annotati
on, []); | 4443 _resolver.reportError5(CompileTimeErrorCode.INVALID_ANNOTATION, annotati
on, []); |
| 4441 return; | 4444 return; |
| 4442 } | 4445 } |
| 4443 annotation.element = constructor; | 4446 annotation.element = constructor; |
| 4444 if (nameNode != null) { | 4447 if (nameNode != null) { |
| 4445 nameNode.staticElement = constructor; | 4448 nameNode.staticElement = constructor; |
| 4446 } | 4449 } |
| 4447 resolveAnnotationConstructorInvocationArguments(annotation, constructor); | 4450 resolveAnnotationConstructorInvocationArguments(annotation, constructor); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4582 Element element = lookUpMethod(target, classType, methodName.name); | 4585 Element element = lookUpMethod(target, classType, methodName.name); |
| 4583 if (element == null) { | 4586 if (element == null) { |
| 4584 element = lookUpGetter(target, classType, methodName.name); | 4587 element = lookUpGetter(target, classType, methodName.name); |
| 4585 } | 4588 } |
| 4586 return element; | 4589 return element; |
| 4587 } else if (target is SimpleIdentifier) { | 4590 } else if (target is SimpleIdentifier) { |
| 4588 Element targetElement = ((target as SimpleIdentifier)).staticElement; | 4591 Element targetElement = ((target as SimpleIdentifier)).staticElement; |
| 4589 if (targetElement is PrefixElement) { | 4592 if (targetElement is PrefixElement) { |
| 4590 String name = "${((target as SimpleIdentifier)).name}.${methodName}"; | 4593 String name = "${((target as SimpleIdentifier)).name}.${methodName}"; |
| 4591 Identifier functionName = new ElementResolver_SyntheticIdentifier(name); | 4594 Identifier functionName = new ElementResolver_SyntheticIdentifier(name); |
| 4592 Element element = _resolver.nameScope.lookup(functionName, _resolver.def
iningLibrary); | 4595 Element element = _resolver.nameScope.lookup(functionName, _definingLibr
ary); |
| 4593 if (element != null) { | 4596 if (element != null) { |
| 4594 return element; | 4597 return element; |
| 4595 } | 4598 } |
| 4596 } | 4599 } |
| 4597 } | 4600 } |
| 4598 return null; | 4601 return null; |
| 4599 } | 4602 } |
| 4600 | 4603 |
| 4601 /** | 4604 /** |
| 4602 * Given an invocation of the form 'm(a1, ..., an)', resolve 'm' to the elemen
t being invoked. If | 4605 * Given an invocation of the form 'm(a1, ..., an)', resolve 'm' to the elemen
t being invoked. If |
| 4603 * the returned element is a method, then the method will be invoked. If the r
eturned element is a | 4606 * the returned element is a method, then the method will be invoked. If the r
eturned element is a |
| 4604 * getter, the getter will be invoked without arguments and the result of that
invocation will | 4607 * getter, the getter will be invoked without arguments and the result of that
invocation will |
| 4605 * then be invoked with the arguments. | 4608 * then be invoked with the arguments. |
| 4606 * | 4609 * |
| 4607 * @param methodName the name of the method being invoked ('m') | 4610 * @param methodName the name of the method being invoked ('m') |
| 4608 * @return the element being invoked | 4611 * @return the element being invoked |
| 4609 */ | 4612 */ |
| 4610 Element resolveInvokedElement2(SimpleIdentifier methodName) { | 4613 Element resolveInvokedElement2(SimpleIdentifier methodName) { |
| 4611 Element element = _resolver.nameScope.lookup(methodName, _resolver.definingL
ibrary); | 4614 Element element = _resolver.nameScope.lookup(methodName, _definingLibrary); |
| 4612 if (element == null) { | 4615 if (element == null) { |
| 4613 ClassElement enclosingClass = _resolver.enclosingClass; | 4616 ClassElement enclosingClass = _resolver.enclosingClass; |
| 4614 if (enclosingClass != null) { | 4617 if (enclosingClass != null) { |
| 4615 InterfaceType enclosingType = enclosingClass.type; | 4618 InterfaceType enclosingType = enclosingClass.type; |
| 4616 element = lookUpMethod(null, enclosingType, methodName.name); | 4619 element = lookUpMethod(null, enclosingType, methodName.name); |
| 4617 if (element == null) { | 4620 if (element == null) { |
| 4618 element = lookUpGetter(null, enclosingType, methodName.name); | 4621 element = lookUpGetter(null, enclosingType, methodName.name); |
| 4619 } | 4622 } |
| 4620 } | 4623 } |
| 4621 } | 4624 } |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4699 | 4702 |
| 4700 /** | 4703 /** |
| 4701 * Resolve the given simple identifier if possible. Return the element to whic
h it could be | 4704 * Resolve the given simple identifier if possible. Return the element to whic
h it could be |
| 4702 * resolved, or `null` if it could not be resolved. This does not record the r
esults of the | 4705 * resolved, or `null` if it could not be resolved. This does not record the r
esults of the |
| 4703 * resolution. | 4706 * resolution. |
| 4704 * | 4707 * |
| 4705 * @param node the identifier to be resolved | 4708 * @param node the identifier to be resolved |
| 4706 * @return the element to which the identifier could be resolved | 4709 * @return the element to which the identifier could be resolved |
| 4707 */ | 4710 */ |
| 4708 Element resolveSimpleIdentifier(SimpleIdentifier node) { | 4711 Element resolveSimpleIdentifier(SimpleIdentifier node) { |
| 4709 Element element = _resolver.nameScope.lookup(node, _resolver.definingLibrary
); | 4712 Element element = _resolver.nameScope.lookup(node, _definingLibrary); |
| 4710 if (element is PropertyAccessorElement && node.inSetterContext()) { | 4713 if (element is PropertyAccessorElement && node.inSetterContext()) { |
| 4711 PropertyInducingElement variable = ((element as PropertyAccessorElement)).
variable; | 4714 PropertyInducingElement variable = ((element as PropertyAccessorElement)).
variable; |
| 4712 if (variable != null) { | 4715 if (variable != null) { |
| 4713 PropertyAccessorElement setter = variable.setter; | 4716 PropertyAccessorElement setter = variable.setter; |
| 4714 if (setter == null) { | 4717 if (setter == null) { |
| 4715 ClassElement enclosingClass = _resolver.enclosingClass; | 4718 ClassElement enclosingClass = _resolver.enclosingClass; |
| 4716 if (enclosingClass != null) { | 4719 if (enclosingClass != null) { |
| 4717 setter = lookUpSetter(null, enclosingClass.type, node.name); | 4720 setter = lookUpSetter(null, enclosingClass.type, node.name); |
| 4718 } | 4721 } |
| 4719 } | 4722 } |
| 4720 if (setter != null) { | 4723 if (setter != null) { |
| 4721 element = setter; | 4724 element = setter; |
| 4722 } | 4725 } |
| 4723 } | 4726 } |
| 4724 } else if (element == null && node.inSetterContext()) { | 4727 } else if (element == null && node.inSetterContext()) { |
| 4725 element = _resolver.nameScope.lookup(new ElementResolver_SyntheticIdentifi
er("${node.name}="), _resolver.definingLibrary); | 4728 element = _resolver.nameScope.lookup(new ElementResolver_SyntheticIdentifi
er("${node.name}="), _definingLibrary); |
| 4726 } | 4729 } |
| 4727 ClassElement enclosingClass = _resolver.enclosingClass; | 4730 ClassElement enclosingClass = _resolver.enclosingClass; |
| 4728 if (element == null && enclosingClass != null) { | 4731 if (element == null && enclosingClass != null) { |
| 4729 InterfaceType enclosingType = enclosingClass.type; | 4732 InterfaceType enclosingType = enclosingClass.type; |
| 4730 if (element == null && node.inSetterContext()) { | 4733 if (element == null && node.inSetterContext()) { |
| 4731 element = lookUpSetter(null, enclosingType, node.name); | 4734 element = lookUpSetter(null, enclosingType, node.name); |
| 4732 } | 4735 } |
| 4733 if (element == null && node.inGetterContext()) { | 4736 if (element == null && node.inGetterContext()) { |
| 4734 element = lookUpGetter(null, enclosingType, node.name); | 4737 element = lookUpGetter(null, enclosingType, node.name); |
| 4735 } | 4738 } |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5334 | 5337 |
| 5335 /** | 5338 /** |
| 5336 * Loop through all of the members in some [MemberMap], performing type parame
ter | 5339 * Loop through all of the members in some [MemberMap], performing type parame
ter |
| 5337 * substitutions using a passed supertype. | 5340 * substitutions using a passed supertype. |
| 5338 * | 5341 * |
| 5339 * @param superType the supertype to substitute into the members of the [Membe
rMap] | 5342 * @param superType the supertype to substitute into the members of the [Membe
rMap] |
| 5340 * @param map the MemberMap to perform the substitutions on | 5343 * @param map the MemberMap to perform the substitutions on |
| 5341 */ | 5344 */ |
| 5342 void substituteTypeParametersDownHierarchy(InterfaceType superType, MemberMap
map) { | 5345 void substituteTypeParametersDownHierarchy(InterfaceType superType, MemberMap
map) { |
| 5343 for (int i = 0; i < map.size; i++) { | 5346 for (int i = 0; i < map.size; i++) { |
| 5344 String key = map.getKey(i); | |
| 5345 ExecutableElement executableElement = map.getValue(i); | 5347 ExecutableElement executableElement = map.getValue(i); |
| 5346 if (executableElement is MethodMember) { | 5348 if (executableElement is MethodMember) { |
| 5347 executableElement = MethodMember.from(executableElement as MethodMember,
superType); | 5349 executableElement = MethodMember.from(executableElement as MethodMember,
superType); |
| 5348 map.put(key, executableElement); | 5350 map.setValue(i, executableElement); |
| 5349 } else if (executableElement is PropertyAccessorMember) { | 5351 } else if (executableElement is PropertyAccessorMember) { |
| 5350 executableElement = PropertyAccessorMember.from(executableElement as Pro
pertyAccessorMember, superType); | 5352 executableElement = PropertyAccessorMember.from(executableElement as Pro
pertyAccessorMember, superType); |
| 5351 map.put(key, executableElement); | 5353 map.setValue(i, executableElement); |
| 5352 } | 5354 } |
| 5353 } | 5355 } |
| 5354 } | 5356 } |
| 5355 } | 5357 } |
| 5356 /** | 5358 /** |
| 5357 * Instances of the class `Library` represent the data about a single library du
ring the | 5359 * Instances of the class `Library` represent the data about a single library du
ring the |
| 5358 * resolution of some (possibly different) library. They are not intended to be
used except during | 5360 * resolution of some (possibly different) library. They are not intended to be
used except during |
| 5359 * the resolution process. | 5361 * the resolution process. |
| 5360 * | 5362 * |
| 5361 * @coverage dart.engine.resolver | 5363 * @coverage dart.engine.resolver |
| (...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6601 for (int i = 0; i < size; i++) { | 6603 for (int i = 0; i < size; i++) { |
| 6602 if (_keys[i] == key) { | 6604 if (_keys[i] == key) { |
| 6603 _keys[i] = null; | 6605 _keys[i] = null; |
| 6604 _values[i] = null; | 6606 _values[i] = null; |
| 6605 return; | 6607 return; |
| 6606 } | 6608 } |
| 6607 } | 6609 } |
| 6608 } | 6610 } |
| 6609 | 6611 |
| 6610 /** | 6612 /** |
| 6613 * Sets the ExecutableElement at the specified location. |
| 6614 * |
| 6615 * @param i some non-zero value less than size |
| 6616 * @param value the ExecutableElement value to store in the map |
| 6617 */ |
| 6618 void setValue(int i, ExecutableElement value) { |
| 6619 _values[i] = value; |
| 6620 } |
| 6621 |
| 6622 /** |
| 6611 * Initializes [keys] and [values]. | 6623 * Initializes [keys] and [values]. |
| 6612 */ | 6624 */ |
| 6613 void initArrays(int initialCapacity) { | 6625 void initArrays(int initialCapacity) { |
| 6614 _keys = new List<String>(initialCapacity); | 6626 _keys = new List<String>(initialCapacity); |
| 6615 _values = new List<ExecutableElement>(initialCapacity); | 6627 _values = new List<ExecutableElement>(initialCapacity); |
| 6616 } | 6628 } |
| 6617 } | 6629 } |
| 6618 /** | 6630 /** |
| 6619 * This class is a wrapper for an [AnalysisError] which can also be queried afte
r resolution | 6631 * This class is a wrapper for an [AnalysisError] which can also be queried afte
r resolution |
| 6620 * to find out if the error should actually be reported. In this case, these err
ors are conditional | 6632 * to find out if the error should actually be reported. In this case, these err
ors are conditional |
| (...skipping 4195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10816 elementValid = false; | 10828 elementValid = false; |
| 10817 } else { | 10829 } else { |
| 10818 if (element != null) { | 10830 if (element != null) { |
| 10819 reportError5(StaticWarningCode.NEW_WITH_NON_TYPE, typeNameSimple, [typ
eName]); | 10831 reportError5(StaticWarningCode.NEW_WITH_NON_TYPE, typeNameSimple, [typ
eName]); |
| 10820 elementValid = false; | 10832 elementValid = false; |
| 10821 } | 10833 } |
| 10822 } | 10834 } |
| 10823 } | 10835 } |
| 10824 if (elementValid && element == null) { | 10836 if (elementValid && element == null) { |
| 10825 SimpleIdentifier typeNameSimple = getTypeSimpleIdentifier(typeName); | 10837 SimpleIdentifier typeNameSimple = getTypeSimpleIdentifier(typeName); |
| 10838 RedirectingConstructorKind redirectingConstructorKind; |
| 10826 if (isBuiltInIdentifier(node) && isTypeAnnotation(node)) { | 10839 if (isBuiltInIdentifier(node) && isTypeAnnotation(node)) { |
| 10827 reportError5(CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE, typeName,
[typeName.name]); | 10840 reportError5(CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE, typeName,
[typeName.name]); |
| 10828 } else if (typeNameSimple.name == "boolean") { | 10841 } else if (typeNameSimple.name == "boolean") { |
| 10829 reportError5(StaticWarningCode.UNDEFINED_CLASS_BOOLEAN, typeNameSimple,
[]); | 10842 reportError5(StaticWarningCode.UNDEFINED_CLASS_BOOLEAN, typeNameSimple,
[]); |
| 10830 } else if (isTypeNameInCatchClause(node)) { | 10843 } else if (isTypeNameInCatchClause(node)) { |
| 10831 reportError5(StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE, typeName, [type
Name.name]); | 10844 reportError5(StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE, typeName, [type
Name.name]); |
| 10832 } else if (isTypeNameInAsExpression(node)) { | 10845 } else if (isTypeNameInAsExpression(node)) { |
| 10833 reportError5(StaticWarningCode.CAST_TO_NON_TYPE, typeName, [typeName.nam
e]); | 10846 reportError5(StaticWarningCode.CAST_TO_NON_TYPE, typeName, [typeName.nam
e]); |
| 10834 } else if (isTypeNameInIsExpression(node)) { | 10847 } else if (isTypeNameInIsExpression(node)) { |
| 10835 reportError5(StaticWarningCode.TYPE_TEST_NON_TYPE, typeName, [typeName.n
ame]); | 10848 reportError5(StaticWarningCode.TYPE_TEST_NON_TYPE, typeName, [typeName.n
ame]); |
| 10836 } else if (isTypeNameTargetInRedirectedConstructor(node)) { | 10849 } else if ((redirectingConstructorKind = getRedirectingConstructorKind(nod
e)) != null) { |
| 10837 reportError5(StaticWarningCode.REDIRECT_TO_NON_CLASS, typeName, [typeNam
e.name]); | 10850 ErrorCode errorCode = (identical(redirectingConstructorKind, Redirecting
ConstructorKind.CONST) ? CompileTimeErrorCode.REDIRECT_TO_NON_CLASS : StaticWarn
ingCode.REDIRECT_TO_NON_CLASS) as ErrorCode; |
| 10851 reportError5(errorCode, typeName, [typeName.name]); |
| 10838 } else if (isTypeNameInTypeArgumentList(node)) { | 10852 } else if (isTypeNameInTypeArgumentList(node)) { |
| 10839 reportError5(StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT, typeName,
[typeName.name]); | 10853 reportError5(StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT, typeName,
[typeName.name]); |
| 10840 } else { | 10854 } else { |
| 10841 reportError5(StaticWarningCode.UNDEFINED_CLASS, typeName, [typeName.name
]); | 10855 reportError5(StaticWarningCode.UNDEFINED_CLASS, typeName, [typeName.name
]); |
| 10842 } | 10856 } |
| 10843 elementValid = false; | 10857 elementValid = false; |
| 10844 } | 10858 } |
| 10845 if (!elementValid) { | 10859 if (!elementValid) { |
| 10846 if (element is MultiplyDefinedElement) { | 10860 if (element is MultiplyDefinedElement) { |
| 10847 setElement(typeName, element); | 10861 setElement(typeName, element); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 10864 type = ((element as TypeParameterElement)).type; | 10878 type = ((element as TypeParameterElement)).type; |
| 10865 if (argumentList != null) { | 10879 if (argumentList != null) { |
| 10866 } | 10880 } |
| 10867 } else if (element is MultiplyDefinedElement) { | 10881 } else if (element is MultiplyDefinedElement) { |
| 10868 List<Element> elements = ((element as MultiplyDefinedElement)).conflicting
Elements; | 10882 List<Element> elements = ((element as MultiplyDefinedElement)).conflicting
Elements; |
| 10869 type = getType(elements); | 10883 type = getType(elements); |
| 10870 if (type != null) { | 10884 if (type != null) { |
| 10871 node.type = type; | 10885 node.type = type; |
| 10872 } | 10886 } |
| 10873 } else { | 10887 } else { |
| 10888 RedirectingConstructorKind redirectingConstructorKind; |
| 10874 if (isTypeNameInCatchClause(node)) { | 10889 if (isTypeNameInCatchClause(node)) { |
| 10875 reportError5(StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE, typeName, [type
Name.name]); | 10890 reportError5(StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE, typeName, [type
Name.name]); |
| 10876 } else if (isTypeNameInAsExpression(node)) { | 10891 } else if (isTypeNameInAsExpression(node)) { |
| 10877 reportError5(StaticWarningCode.CAST_TO_NON_TYPE, typeName, [typeName.nam
e]); | 10892 reportError5(StaticWarningCode.CAST_TO_NON_TYPE, typeName, [typeName.nam
e]); |
| 10878 } else if (isTypeNameInIsExpression(node)) { | 10893 } else if (isTypeNameInIsExpression(node)) { |
| 10879 reportError5(StaticWarningCode.TYPE_TEST_NON_TYPE, typeName, [typeName.n
ame]); | 10894 reportError5(StaticWarningCode.TYPE_TEST_NON_TYPE, typeName, [typeName.n
ame]); |
| 10880 } else if (isTypeNameTargetInRedirectedConstructor(node)) { | 10895 } else if ((redirectingConstructorKind = getRedirectingConstructorKind(nod
e)) != null) { |
| 10881 reportError5(StaticWarningCode.REDIRECT_TO_NON_CLASS, typeName, [typeNam
e.name]); | 10896 ErrorCode errorCode = (identical(redirectingConstructorKind, Redirecting
ConstructorKind.CONST) ? CompileTimeErrorCode.REDIRECT_TO_NON_CLASS : StaticWarn
ingCode.REDIRECT_TO_NON_CLASS) as ErrorCode; |
| 10897 reportError5(errorCode, typeName, [typeName.name]); |
| 10882 } else if (isTypeNameInTypeArgumentList(node)) { | 10898 } else if (isTypeNameInTypeArgumentList(node)) { |
| 10883 reportError5(StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT, typeName,
[typeName.name]); | 10899 reportError5(StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT, typeName,
[typeName.name]); |
| 10884 } else { | 10900 } else { |
| 10885 ASTNode parent = typeName.parent; | 10901 ASTNode parent = typeName.parent; |
| 10886 while (parent is TypeName) { | 10902 while (parent is TypeName) { |
| 10887 parent = parent.parent; | 10903 parent = parent.parent; |
| 10888 } | 10904 } |
| 10889 if (parent is ExtendsClause || parent is ImplementsClause || parent is W
ithClause || parent is ClassTypeAlias) { | 10905 if (parent is ExtendsClause || parent is ImplementsClause || parent is W
ithClause || parent is ClassTypeAlias) { |
| 10890 } else { | 10906 } else { |
| 10891 reportError5(StaticWarningCode.NOT_A_TYPE, typeName, [typeName.name]); | 10907 reportError5(StaticWarningCode.NOT_A_TYPE, typeName, [typeName.name]); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11051 return CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS; | 11067 return CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS; |
| 11052 } else { | 11068 } else { |
| 11053 return StaticWarningCode.NEW_WITH_INVALID_TYPE_PARAMETERS; | 11069 return StaticWarningCode.NEW_WITH_INVALID_TYPE_PARAMETERS; |
| 11054 } | 11070 } |
| 11055 } | 11071 } |
| 11056 } | 11072 } |
| 11057 return StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS; | 11073 return StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS; |
| 11058 } | 11074 } |
| 11059 | 11075 |
| 11060 /** | 11076 /** |
| 11077 * Checks if the given type name is the target in a redirected constructor. |
| 11078 * |
| 11079 * @param typeName the type name to analyze |
| 11080 * @return some [RedirectingConstructorKind] if the given type name is used as
the type in a |
| 11081 * redirected constructor, or `null` otherwise |
| 11082 */ |
| 11083 RedirectingConstructorKind getRedirectingConstructorKind(TypeName typeName) { |
| 11084 ASTNode parent = typeName.parent; |
| 11085 if (parent is ConstructorName) { |
| 11086 ConstructorName constructorName = parent as ConstructorName; |
| 11087 parent = constructorName.parent; |
| 11088 if (parent is ConstructorDeclaration) { |
| 11089 ConstructorDeclaration constructorDeclaration = parent as ConstructorDec
laration; |
| 11090 if (identical(constructorDeclaration.redirectedConstructor, constructorN
ame)) { |
| 11091 if (constructorDeclaration.constKeyword != null) { |
| 11092 return RedirectingConstructorKind.CONST; |
| 11093 } |
| 11094 return RedirectingConstructorKind.NORMAL; |
| 11095 } |
| 11096 } |
| 11097 } |
| 11098 return null; |
| 11099 } |
| 11100 |
| 11101 /** |
| 11061 * Given the multiple elements to which a single name could potentially be res
olved, return the | 11102 * Given the multiple elements to which a single name could potentially be res
olved, return the |
| 11062 * single interface type that should be used, or `null` if there is no clear c
hoice. | 11103 * single interface type that should be used, or `null` if there is no clear c
hoice. |
| 11063 * | 11104 * |
| 11064 * @param elements the elements to which a single name could potentially be re
solved | 11105 * @param elements the elements to which a single name could potentially be re
solved |
| 11065 * @return the single interface type that should be used for the type name | 11106 * @return the single interface type that should be used for the type name |
| 11066 */ | 11107 */ |
| 11067 InterfaceType getType(List<Element> elements) { | 11108 InterfaceType getType(List<Element> elements) { |
| 11068 InterfaceType type = null; | 11109 InterfaceType type = null; |
| 11069 for (Element element in elements) { | 11110 for (Element element in elements) { |
| 11070 if (element is ClassElement) { | 11111 if (element is ClassElement) { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11183 | 11224 |
| 11184 /** | 11225 /** |
| 11185 * Checks if the given type name used in a type argument list. | 11226 * Checks if the given type name used in a type argument list. |
| 11186 * | 11227 * |
| 11187 * @param typeName the type name to analyzer | 11228 * @param typeName the type name to analyzer |
| 11188 * @return `true` if the given type name is in a type argument list | 11229 * @return `true` if the given type name is in a type argument list |
| 11189 */ | 11230 */ |
| 11190 bool isTypeNameInTypeArgumentList(TypeName typeName) => typeName.parent is Typ
eArgumentList; | 11231 bool isTypeNameInTypeArgumentList(TypeName typeName) => typeName.parent is Typ
eArgumentList; |
| 11191 | 11232 |
| 11192 /** | 11233 /** |
| 11193 * Checks if the given type name is the target in a redirected constructor. | |
| 11194 * | |
| 11195 * @param typeName the type name to analyzer | |
| 11196 * @return `true` if the given type name is used as the type in a redirected c
onstructor | |
| 11197 */ | |
| 11198 bool isTypeNameTargetInRedirectedConstructor(TypeName typeName) { | |
| 11199 ASTNode parent = typeName.parent; | |
| 11200 if (parent is ConstructorName) { | |
| 11201 ConstructorName constructorName = parent as ConstructorName; | |
| 11202 parent = constructorName.parent; | |
| 11203 if (parent is ConstructorDeclaration) { | |
| 11204 ConstructorDeclaration constructorDeclaration = parent as ConstructorDec
laration; | |
| 11205 return constructorName == constructorDeclaration.redirectedConstructor; | |
| 11206 } | |
| 11207 } | |
| 11208 return false; | |
| 11209 } | |
| 11210 | |
| 11211 /** | |
| 11212 * Record that the static type of the given node is the given type. | 11234 * Record that the static type of the given node is the given type. |
| 11213 * | 11235 * |
| 11214 * @param expression the node whose type is to be recorded | 11236 * @param expression the node whose type is to be recorded |
| 11215 * @param type the static type of the node | 11237 * @param type the static type of the node |
| 11216 */ | 11238 */ |
| 11217 Object recordType(Expression expression, Type2 type) { | 11239 Object recordType(Expression expression, Type2 type) { |
| 11218 if (type == null) { | 11240 if (type == null) { |
| 11219 expression.staticType = _dynamicType; | 11241 expression.staticType = _dynamicType; |
| 11220 } else { | 11242 } else { |
| 11221 expression.staticType = type; | 11243 expression.staticType = type; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11355 aliasElement.typeParameters = alias.typeParameters; | 11377 aliasElement.typeParameters = alias.typeParameters; |
| 11356 type.typeArguments = alias.type.typeArguments; | 11378 type.typeArguments = alias.type.typeArguments; |
| 11357 } else { | 11379 } else { |
| 11358 type.typeArguments = TypeImpl.EMPTY_ARRAY; | 11380 type.typeArguments = TypeImpl.EMPTY_ARRAY; |
| 11359 } | 11381 } |
| 11360 } | 11382 } |
| 11361 element.type = type; | 11383 element.type = type; |
| 11362 } | 11384 } |
| 11363 } | 11385 } |
| 11364 /** | 11386 /** |
| 11387 * Kind of the redirecting constructor. |
| 11388 */ |
| 11389 class RedirectingConstructorKind extends Enum<RedirectingConstructorKind> { |
| 11390 static final RedirectingConstructorKind CONST = new RedirectingConstructorKind
('CONST', 0); |
| 11391 static final RedirectingConstructorKind NORMAL = new RedirectingConstructorKin
d('NORMAL', 1); |
| 11392 static final List<RedirectingConstructorKind> values = [CONST, NORMAL]; |
| 11393 RedirectingConstructorKind(String name, int ordinal) : super(name, ordinal); |
| 11394 } |
| 11395 /** |
| 11365 * Instances of the class `VariableResolverVisitor` are used to resolve | 11396 * Instances of the class `VariableResolverVisitor` are used to resolve |
| 11366 * [SimpleIdentifier]s to local variables and formal parameters. | 11397 * [SimpleIdentifier]s to local variables and formal parameters. |
| 11367 * | 11398 * |
| 11368 * @coverage dart.engine.resolver | 11399 * @coverage dart.engine.resolver |
| 11369 */ | 11400 */ |
| 11370 class VariableResolverVisitor extends ScopedVisitor { | 11401 class VariableResolverVisitor extends ScopedVisitor { |
| 11371 | 11402 |
| 11372 /** | 11403 /** |
| 11373 * Initialize a newly created visitor to resolve the nodes in a compilation un
it. | 11404 * Initialize a newly created visitor to resolve the nodes in a compilation un
it. |
| 11374 * | 11405 * |
| (...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12732 * The current library that is being analyzed. | 12763 * The current library that is being analyzed. |
| 12733 */ | 12764 */ |
| 12734 LibraryElement _currentLibrary; | 12765 LibraryElement _currentLibrary; |
| 12735 | 12766 |
| 12736 /** | 12767 /** |
| 12737 * The type representing the type 'dynamic'. | 12768 * The type representing the type 'dynamic'. |
| 12738 */ | 12769 */ |
| 12739 Type2 _dynamicType; | 12770 Type2 _dynamicType; |
| 12740 | 12771 |
| 12741 /** | 12772 /** |
| 12773 * The type representing the type 'bool'. |
| 12774 */ |
| 12775 InterfaceType _boolType; |
| 12776 |
| 12777 /** |
| 12742 * The object providing access to the types defined by the language. | 12778 * The object providing access to the types defined by the language. |
| 12743 */ | 12779 */ |
| 12744 TypeProvider _typeProvider; | 12780 TypeProvider _typeProvider; |
| 12745 | 12781 |
| 12746 /** | 12782 /** |
| 12747 * The manager for the inheritance mappings. | 12783 * The manager for the inheritance mappings. |
| 12748 */ | 12784 */ |
| 12749 InheritanceManager _inheritanceManager; | 12785 InheritanceManager _inheritanceManager; |
| 12750 | 12786 |
| 12751 /** | 12787 /** |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12902 this._typeProvider = typeProvider; | 12938 this._typeProvider = typeProvider; |
| 12903 this._inheritanceManager = inheritanceManager; | 12939 this._inheritanceManager = inheritanceManager; |
| 12904 _strictMode = currentLibrary.context.analysisOptions.strictMode; | 12940 _strictMode = currentLibrary.context.analysisOptions.strictMode; |
| 12905 _isEnclosingConstructorConst = false; | 12941 _isEnclosingConstructorConst = false; |
| 12906 _isInCatchClause = false; | 12942 _isInCatchClause = false; |
| 12907 _isInStaticVariableDeclaration = false; | 12943 _isInStaticVariableDeclaration = false; |
| 12908 _isInInstanceVariableDeclaration = false; | 12944 _isInInstanceVariableDeclaration = false; |
| 12909 _isInInstanceVariableInitializer = false; | 12945 _isInInstanceVariableInitializer = false; |
| 12910 _isInConstructorInitializer = false; | 12946 _isInConstructorInitializer = false; |
| 12911 _isInStaticMethod = false; | 12947 _isInStaticMethod = false; |
| 12948 _boolType = typeProvider.boolType; |
| 12912 _dynamicType = typeProvider.dynamicType; | 12949 _dynamicType = typeProvider.dynamicType; |
| 12913 _DISALLOWED_TYPES_TO_EXTEND_OR_IMPLEMENT = <InterfaceType> [ | 12950 _DISALLOWED_TYPES_TO_EXTEND_OR_IMPLEMENT = <InterfaceType> [ |
| 12914 typeProvider.nullType, | 12951 typeProvider.nullType, |
| 12915 typeProvider.numType, | 12952 typeProvider.numType, |
| 12916 typeProvider.intType, | 12953 typeProvider.intType, |
| 12917 typeProvider.doubleType, | 12954 typeProvider.doubleType, |
| 12918 typeProvider.boolType, | 12955 _boolType, |
| 12919 typeProvider.stringType]; | 12956 typeProvider.stringType]; |
| 12920 } | 12957 } |
| 12921 Object visitArgumentDefinitionTest(ArgumentDefinitionTest node) { | 12958 Object visitArgumentDefinitionTest(ArgumentDefinitionTest node) { |
| 12922 checkForArgumentDefinitionTestNonParameter(node); | 12959 checkForArgumentDefinitionTestNonParameter(node); |
| 12923 return super.visitArgumentDefinitionTest(node); | 12960 return super.visitArgumentDefinitionTest(node); |
| 12924 } | 12961 } |
| 12925 Object visitArgumentList(ArgumentList node) { | 12962 Object visitArgumentList(ArgumentList node) { |
| 12926 checkForArgumentTypeNotAssignable(node); | 12963 checkForArgumentTypeNotAssignable(node); |
| 12927 return super.visitArgumentList(node); | 12964 return super.visitArgumentList(node); |
| 12928 } | 12965 } |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13298 return super.visitPostfixExpression(node); | 13335 return super.visitPostfixExpression(node); |
| 13299 } | 13336 } |
| 13300 Object visitPrefixedIdentifier(PrefixedIdentifier node) { | 13337 Object visitPrefixedIdentifier(PrefixedIdentifier node) { |
| 13301 if (node.parent is! Annotation) { | 13338 if (node.parent is! Annotation) { |
| 13302 checkForStaticAccessToInstanceMember(node.prefix, node.identifier); | 13339 checkForStaticAccessToInstanceMember(node.prefix, node.identifier); |
| 13303 checkForInstanceAccessToStaticMember(node.prefix, node.identifier); | 13340 checkForInstanceAccessToStaticMember(node.prefix, node.identifier); |
| 13304 } | 13341 } |
| 13305 return super.visitPrefixedIdentifier(node); | 13342 return super.visitPrefixedIdentifier(node); |
| 13306 } | 13343 } |
| 13307 Object visitPrefixExpression(PrefixExpression node) { | 13344 Object visitPrefixExpression(PrefixExpression node) { |
| 13308 if (node.operator.type.isIncrementOperator) { | 13345 sc.TokenType operatorType = node.operator.type; |
| 13309 checkForAssignmentToFinal2(node.operand); | 13346 Expression operand = node.operand; |
| 13347 if (identical(operatorType, sc.TokenType.BANG)) { |
| 13348 checkForNonBoolNegationExpression(operand); |
| 13349 } else if (operatorType.isIncrementOperator) { |
| 13350 checkForAssignmentToFinal2(operand); |
| 13310 } | 13351 } |
| 13311 checkForIntNotAssignable(node.operand); | 13352 checkForIntNotAssignable(operand); |
| 13312 return super.visitPrefixExpression(node); | 13353 return super.visitPrefixExpression(node); |
| 13313 } | 13354 } |
| 13314 Object visitPropertyAccess(PropertyAccess node) { | 13355 Object visitPropertyAccess(PropertyAccess node) { |
| 13315 Expression target = node.realTarget; | 13356 Expression target = node.realTarget; |
| 13316 SimpleIdentifier propertyName = node.propertyName; | 13357 SimpleIdentifier propertyName = node.propertyName; |
| 13317 checkForStaticAccessToInstanceMember(target, propertyName); | 13358 checkForStaticAccessToInstanceMember(target, propertyName); |
| 13318 checkForInstanceAccessToStaticMember(target, propertyName); | 13359 checkForInstanceAccessToStaticMember(target, propertyName); |
| 13319 return super.visitPropertyAccess(node); | 13360 return super.visitPropertyAccess(node); |
| 13320 } | 13361 } |
| 13321 Object visitRedirectingConstructorInvocation(RedirectingConstructorInvocation
node) { | 13362 Object visitRedirectingConstructorInvocation(RedirectingConstructorInvocation
node) { |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13865 } | 13906 } |
| 13866 ConstructorElement redirectedElement = redirectedConstructor.staticElement; | 13907 ConstructorElement redirectedElement = redirectedConstructor.staticElement; |
| 13867 if (redirectedElement == null) { | 13908 if (redirectedElement == null) { |
| 13868 TypeName constructorTypeName = redirectedConstructor.type; | 13909 TypeName constructorTypeName = redirectedConstructor.type; |
| 13869 Type2 redirectedType = constructorTypeName.type; | 13910 Type2 redirectedType = constructorTypeName.type; |
| 13870 if (redirectedType != null && redirectedType.element != null && !redirecte
dType.isDynamic) { | 13911 if (redirectedType != null && redirectedType.element != null && !redirecte
dType.isDynamic) { |
| 13871 String constructorStrName = constructorTypeName.name.name; | 13912 String constructorStrName = constructorTypeName.name.name; |
| 13872 if (redirectedConstructor.name != null) { | 13913 if (redirectedConstructor.name != null) { |
| 13873 constructorStrName += ".${redirectedConstructor.name.name}"; | 13914 constructorStrName += ".${redirectedConstructor.name.name}"; |
| 13874 } | 13915 } |
| 13875 _errorReporter.reportError2(StaticWarningCode.REDIRECT_TO_MISSING_CONSTR
UCTOR, redirectedConstructor, [constructorStrName, redirectedType.displayName]); | 13916 ErrorCode errorCode = (node.constKeyword != null ? CompileTimeErrorCode.
REDIRECT_TO_MISSING_CONSTRUCTOR : StaticWarningCode.REDIRECT_TO_MISSING_CONSTRUC
TOR) as ErrorCode; |
| 13917 _errorReporter.reportError2(errorCode, redirectedConstructor, [construct
orStrName, redirectedType.displayName]); |
| 13876 return true; | 13918 return true; |
| 13877 } | 13919 } |
| 13878 return false; | 13920 return false; |
| 13879 } | 13921 } |
| 13880 FunctionType redirectedType = redirectedElement.type; | 13922 FunctionType redirectedType = redirectedElement.type; |
| 13881 Type2 redirectedReturnType = redirectedType.returnType; | 13923 Type2 redirectedReturnType = redirectedType.returnType; |
| 13882 FunctionType constructorType = node.element.type; | 13924 FunctionType constructorType = node.element.type; |
| 13883 Type2 constructorReturnType = constructorType.returnType; | 13925 Type2 constructorReturnType = constructorType.returnType; |
| 13884 if (!redirectedReturnType.isAssignableTo(constructorReturnType)) { | 13926 if (!redirectedReturnType.isAssignableTo(constructorReturnType)) { |
| 13885 _errorReporter.reportError2(StaticWarningCode.REDIRECT_TO_INVALID_RETURN_T
YPE, redirectedConstructor, [redirectedReturnType, constructorReturnType]); | 13927 _errorReporter.reportError2(StaticWarningCode.REDIRECT_TO_INVALID_RETURN_T
YPE, redirectedConstructor, [redirectedReturnType, constructorReturnType]); |
| (...skipping 1986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15872 /** | 15914 /** |
| 15873 * Checks to ensure that the expressions that need to be of type bool, are. Ot
herwise an error is | 15915 * Checks to ensure that the expressions that need to be of type bool, are. Ot
herwise an error is |
| 15874 * reported on the expression. | 15916 * reported on the expression. |
| 15875 * | 15917 * |
| 15876 * @param condition the conditional expression to test | 15918 * @param condition the conditional expression to test |
| 15877 * @return `true` if and only if an error code is generated on the passed node | 15919 * @return `true` if and only if an error code is generated on the passed node |
| 15878 * @see StaticTypeWarningCode#NON_BOOL_CONDITION | 15920 * @see StaticTypeWarningCode#NON_BOOL_CONDITION |
| 15879 */ | 15921 */ |
| 15880 bool checkForNonBoolCondition(Expression condition) { | 15922 bool checkForNonBoolCondition(Expression condition) { |
| 15881 Type2 conditionType = getStaticType(condition); | 15923 Type2 conditionType = getStaticType(condition); |
| 15882 if (conditionType != null && !conditionType.isAssignableTo(_typeProvider.boo
lType)) { | 15924 if (conditionType != null && !conditionType.isAssignableTo(_boolType)) { |
| 15883 _errorReporter.reportError2(StaticTypeWarningCode.NON_BOOL_CONDITION, cond
ition, []); | 15925 _errorReporter.reportError2(StaticTypeWarningCode.NON_BOOL_CONDITION, cond
ition, []); |
| 15884 return true; | 15926 return true; |
| 15885 } | 15927 } |
| 15886 return false; | 15928 return false; |
| 15887 } | 15929 } |
| 15888 | 15930 |
| 15889 /** | 15931 /** |
| 15890 * This verifies that the passed assert statement has either a 'bool' or '() -
> bool' input. | 15932 * This verifies that the passed assert statement has either a 'bool' or '() -
> bool' input. |
| 15891 * | 15933 * |
| 15892 * @param node the assert statement to evaluate | 15934 * @param node the assert statement to evaluate |
| 15893 * @return `true` if and only if an error code is generated on the passed node | 15935 * @return `true` if and only if an error code is generated on the passed node |
| 15894 * @see StaticTypeWarningCode#NON_BOOL_EXPRESSION | 15936 * @see StaticTypeWarningCode#NON_BOOL_EXPRESSION |
| 15895 */ | 15937 */ |
| 15896 bool checkForNonBoolExpression(AssertStatement node) { | 15938 bool checkForNonBoolExpression(AssertStatement node) { |
| 15897 Expression expression = node.condition; | 15939 Expression expression = node.condition; |
| 15898 Type2 type = getStaticType(expression); | 15940 Type2 type = getStaticType(expression); |
| 15899 if (type is InterfaceType) { | 15941 if (type is InterfaceType) { |
| 15900 if (!type.isAssignableTo(_typeProvider.boolType)) { | 15942 if (!type.isAssignableTo(_boolType)) { |
| 15901 _errorReporter.reportError2(StaticTypeWarningCode.NON_BOOL_EXPRESSION, e
xpression, []); | 15943 _errorReporter.reportError2(StaticTypeWarningCode.NON_BOOL_EXPRESSION, e
xpression, []); |
| 15902 return true; | 15944 return true; |
| 15903 } | 15945 } |
| 15904 } else if (type is FunctionType) { | 15946 } else if (type is FunctionType) { |
| 15905 FunctionType functionType = type as FunctionType; | 15947 FunctionType functionType = type as FunctionType; |
| 15906 if (functionType.typeArguments.length == 0 && !functionType.returnType.isA
ssignableTo(_typeProvider.boolType)) { | 15948 if (functionType.typeArguments.length == 0 && !functionType.returnType.isA
ssignableTo(_boolType)) { |
| 15907 _errorReporter.reportError2(StaticTypeWarningCode.NON_BOOL_EXPRESSION, e
xpression, []); | 15949 _errorReporter.reportError2(StaticTypeWarningCode.NON_BOOL_EXPRESSION, e
xpression, []); |
| 15908 return true; | 15950 return true; |
| 15909 } | 15951 } |
| 15910 } | 15952 } |
| 15911 return false; | 15953 return false; |
| 15912 } | 15954 } |
| 15913 | 15955 |
| 15914 /** | 15956 /** |
| 15957 * Checks to ensure that the given expression is assignable to bool. |
| 15958 * |
| 15959 * @param expression the expression expression to test |
| 15960 * @return `true` if and only if an error code is generated on the passed node |
| 15961 * @see StaticTypeWarningCode#NON_BOOL_NEGATION_EXPRESSION |
| 15962 */ |
| 15963 bool checkForNonBoolNegationExpression(Expression expression) { |
| 15964 Type2 conditionType = getStaticType(expression); |
| 15965 if (conditionType != null && !conditionType.isAssignableTo(_boolType)) { |
| 15966 _errorReporter.reportError2(StaticTypeWarningCode.NON_BOOL_NEGATION_EXPRES
SION, expression, []); |
| 15967 return true; |
| 15968 } |
| 15969 return false; |
| 15970 } |
| 15971 |
| 15972 /** |
| 15915 * This verifies the passed map literal either: | 15973 * This verifies the passed map literal either: |
| 15916 * | 15974 * |
| 15917 * * has `const modifier` | 15975 * * has `const modifier` |
| 15918 * * has explicit type arguments | 15976 * * has explicit type arguments |
| 15919 * * is not start of the statement | 15977 * * is not start of the statement |
| 15920 * | 15978 * |
| 15921 * | 15979 * |
| 15922 * @param node the map literal to evaluate | 15980 * @param node the map literal to evaluate |
| 15923 * @return `true` if and only if an error code is generated on the passed node | 15981 * @return `true` if and only if an error code is generated on the passed node |
| 15924 * @see CompileTimeErrorCode#NON_CONST_MAP_AS_EXPRESSION_STATEMENT | 15982 * @see CompileTimeErrorCode#NON_CONST_MAP_AS_EXPRESSION_STATEMENT |
| (...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17128 ResolverErrorCode.con2(String name, int ordinal, ErrorType type, String messag
e, String correction) : super(name, ordinal) { | 17186 ResolverErrorCode.con2(String name, int ordinal, ErrorType type, String messag
e, String correction) : super(name, ordinal) { |
| 17129 this._type = type; | 17187 this._type = type; |
| 17130 this._message = message; | 17188 this._message = message; |
| 17131 this.correction9 = correction; | 17189 this.correction9 = correction; |
| 17132 } | 17190 } |
| 17133 String get correction => correction9; | 17191 String get correction => correction9; |
| 17134 ErrorSeverity get errorSeverity => _type.severity; | 17192 ErrorSeverity get errorSeverity => _type.severity; |
| 17135 String get message => _message; | 17193 String get message => _message; |
| 17136 ErrorType get type => _type; | 17194 ErrorType get type => _type; |
| 17137 } | 17195 } |
| OLD | NEW |