| 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 'source.dart'; | 9 import 'source.dart'; |
| 10 import 'error.dart'; | 10 import 'error.dart'; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 * @throws AnalysisException if the analysis could not be performed | 48 * @throws AnalysisException if the analysis could not be performed |
| 49 */ | 49 */ |
| 50 CompilationUnitElementImpl buildCompilationUnit(Source source) => buildCompila
tionUnit2(source, _analysisContext.parse3(source, _errorListener)); | 50 CompilationUnitElementImpl buildCompilationUnit(Source source) => buildCompila
tionUnit2(source, _analysisContext.parse3(source, _errorListener)); |
| 51 /** | 51 /** |
| 52 * Build the compilation unit element for the given source. | 52 * Build the compilation unit element for the given source. |
| 53 * @param source the source describing the compilation unit | 53 * @param source the source describing the compilation unit |
| 54 * @param unit the AST structure representing the compilation unit | 54 * @param unit the AST structure representing the compilation unit |
| 55 * @return the compilation unit element that was built | 55 * @return the compilation unit element that was built |
| 56 * @throws AnalysisException if the analysis could not be performed | 56 * @throws AnalysisException if the analysis could not be performed |
| 57 */ | 57 */ |
| 58 CompilationUnitElementImpl buildCompilationUnit2(Source source13, CompilationU
nit unit) { | 58 CompilationUnitElementImpl buildCompilationUnit2(Source source15, CompilationU
nit unit) { |
| 59 ElementHolder holder = new ElementHolder(); | 59 ElementHolder holder = new ElementHolder(); |
| 60 ElementBuilder builder = new ElementBuilder(holder); | 60 ElementBuilder builder = new ElementBuilder(holder); |
| 61 unit.accept(builder); | 61 unit.accept(builder); |
| 62 CompilationUnitElementImpl element = new CompilationUnitElementImpl(source13
.shortName); | 62 CompilationUnitElementImpl element = new CompilationUnitElementImpl(source15
.shortName); |
| 63 element.accessors = holder.accessors; | 63 element.accessors = holder.accessors; |
| 64 element.functions = holder.functions; | 64 element.functions = holder.functions; |
| 65 element.source = source13; | 65 element.source = source15; |
| 66 element.typeAliases = holder.typeAliases; | 66 element.typeAliases = holder.typeAliases; |
| 67 element.types = holder.types; | 67 element.types = holder.types; |
| 68 element.topLevelVariables = holder.topLevelVariables; | 68 element.topLevelVariables = holder.topLevelVariables; |
| 69 unit.element = element; | 69 unit.element = element; |
| 70 return element; | 70 return element; |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 /** | 73 /** |
| 74 * Instances of the class {@code ElementBuilder} traverse an AST structure and b
uild the element | 74 * Instances of the class {@code ElementBuilder} traverse an AST structure and b
uild the element |
| 75 * model representing the AST structure. | 75 * model representing the AST structure. |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 if (node.factoryKeyword != null) { | 169 if (node.factoryKeyword != null) { |
| 170 element.factory = true; | 170 element.factory = true; |
| 171 } | 171 } |
| 172 element.functions = holder.functions; | 172 element.functions = holder.functions; |
| 173 element.labels = holder.labels; | 173 element.labels = holder.labels; |
| 174 element.localVariables = holder.localVariables; | 174 element.localVariables = holder.localVariables; |
| 175 element.parameters = holder.parameters; | 175 element.parameters = holder.parameters; |
| 176 element.const2 = node.constKeyword != null; | 176 element.const2 = node.constKeyword != null; |
| 177 _currentHolder.addConstructor(element); | 177 _currentHolder.addConstructor(element); |
| 178 node.element = element; | 178 node.element = element; |
| 179 if (constructorName != null) { | 179 if (constructorName == null) { |
| 180 Identifier returnType4 = node.returnType; |
| 181 if (returnType4 != null) { |
| 182 element.nameOffset = returnType4.offset; |
| 183 } |
| 184 } else { |
| 180 constructorName.element = element; | 185 constructorName.element = element; |
| 181 } | 186 } |
| 182 return null; | 187 return null; |
| 183 } | 188 } |
| 184 Object visitDeclaredIdentifier(DeclaredIdentifier node) { | 189 Object visitDeclaredIdentifier(DeclaredIdentifier node) { |
| 185 SimpleIdentifier variableName = node.identifier; | 190 SimpleIdentifier variableName = node.identifier; |
| 186 sc.Token keyword27 = node.keyword; | 191 sc.Token keyword27 = node.keyword; |
| 187 LocalVariableElementImpl element = new LocalVariableElementImpl(variableName
); | 192 LocalVariableElementImpl element = new LocalVariableElementImpl(variableName
); |
| 188 ForEachStatement statement = node.parent as ForEachStatement; | 193 ForEachStatement statement = node.parent as ForEachStatement; |
| 189 int declarationEnd = node.offset + node.length; | 194 int declarationEnd = node.offset + node.length; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 _inFunction = wasInFunction; | 390 _inFunction = wasInFunction; |
| 386 } | 391 } |
| 387 sc.Token property = node.propertyKeyword; | 392 sc.Token property = node.propertyKeyword; |
| 388 if (property == null) { | 393 if (property == null) { |
| 389 SimpleIdentifier methodName = node.name; | 394 SimpleIdentifier methodName = node.name; |
| 390 String nameOfMethod = methodName.name; | 395 String nameOfMethod = methodName.name; |
| 391 if (nameOfMethod == sc.TokenType.MINUS.lexeme && node.parameters.parameter
s.length == 0) { | 396 if (nameOfMethod == sc.TokenType.MINUS.lexeme && node.parameters.parameter
s.length == 0) { |
| 392 nameOfMethod = "unary-"; | 397 nameOfMethod = "unary-"; |
| 393 } | 398 } |
| 394 MethodElementImpl element = new MethodElementImpl.con2(nameOfMethod, metho
dName.offset); | 399 MethodElementImpl element = new MethodElementImpl.con2(nameOfMethod, metho
dName.offset); |
| 395 sc.Token keyword = node.modifierKeyword; | 400 element.abstract = node.isAbstract(); |
| 396 element.abstract = matches(keyword, sc.Keyword.ABSTRACT); | |
| 397 element.functions = holder.functions; | 401 element.functions = holder.functions; |
| 398 element.labels = holder.labels; | 402 element.labels = holder.labels; |
| 399 element.localVariables = holder.localVariables; | 403 element.localVariables = holder.localVariables; |
| 400 element.parameters = holder.parameters; | 404 element.parameters = holder.parameters; |
| 401 element.static = matches(keyword, sc.Keyword.STATIC); | 405 element.static = node.isStatic(); |
| 402 _currentHolder.addMethod(element); | 406 _currentHolder.addMethod(element); |
| 403 methodName.element = element; | 407 methodName.element = element; |
| 404 } else { | 408 } else { |
| 405 SimpleIdentifier propertyNameNode = node.name; | 409 SimpleIdentifier propertyNameNode = node.name; |
| 406 String propertyName = propertyNameNode.name; | 410 String propertyName = propertyNameNode.name; |
| 407 FieldElementImpl field = _currentHolder.getField(propertyName) as FieldEle
mentImpl; | 411 FieldElementImpl field = _currentHolder.getField(propertyName) as FieldEle
mentImpl; |
| 408 if (field == null) { | 412 if (field == null) { |
| 409 field = new FieldElementImpl.con2(node.name.name); | 413 field = new FieldElementImpl.con2(node.name.name); |
| 410 field.final2 = true; | 414 field.final2 = true; |
| 411 field.static = matches(node.modifierKeyword, sc.Keyword.STATIC); | 415 field.static = matches(node.modifierKeyword, sc.Keyword.STATIC); |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 * @return the HTML element that was built | 747 * @return the HTML element that was built |
| 744 * @throws AnalysisException if the analysis could not be performed | 748 * @throws AnalysisException if the analysis could not be performed |
| 745 */ | 749 */ |
| 746 HtmlElementImpl buildHtmlElement(Source source) => buildHtmlElement2(source, _
context.parseHtml(source).htmlUnit); | 750 HtmlElementImpl buildHtmlElement(Source source) => buildHtmlElement2(source, _
context.parseHtml(source).htmlUnit); |
| 747 /** | 751 /** |
| 748 * Build the HTML element for the given source. | 752 * Build the HTML element for the given source. |
| 749 * @param source the source describing the compilation unit | 753 * @param source the source describing the compilation unit |
| 750 * @param unit the AST structure representing the HTML | 754 * @param unit the AST structure representing the HTML |
| 751 * @throws AnalysisException if the analysis could not be performed | 755 * @throws AnalysisException if the analysis could not be performed |
| 752 */ | 756 */ |
| 753 HtmlElementImpl buildHtmlElement2(Source source14, ht.HtmlUnit unit) { | 757 HtmlElementImpl buildHtmlElement2(Source source16, ht.HtmlUnit unit) { |
| 754 HtmlElementImpl result = new HtmlElementImpl(_context, source14.shortName); | 758 HtmlElementImpl result = new HtmlElementImpl(_context, source16.shortName); |
| 755 result.source = source14; | 759 result.source = source16; |
| 756 _htmlElement = result; | 760 _htmlElement = result; |
| 757 unit.accept(this); | 761 unit.accept(this); |
| 758 _htmlElement = null; | 762 _htmlElement = null; |
| 759 unit.element = result; | 763 unit.element = result; |
| 760 return result; | 764 return result; |
| 761 } | 765 } |
| 762 Object visitHtmlUnit(ht.HtmlUnit node) { | 766 Object visitHtmlUnit(ht.HtmlUnit node) { |
| 763 _scripts = new List<HtmlScriptElement>(); | 767 _scripts = new List<HtmlScriptElement>(); |
| 764 node.visitChildren(this); | 768 node.visitChildren(this); |
| 765 _htmlElement.scripts = new List.from(_scripts); | 769 _htmlElement.scripts = new List.from(_scripts); |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 Element element; | 1048 Element element; |
| 1045 if (target == null) { | 1049 if (target == null) { |
| 1046 element = _resolver.nameScope.lookup(methodName2, _resolver.definingLibrar
y); | 1050 element = _resolver.nameScope.lookup(methodName2, _resolver.definingLibrar
y); |
| 1047 if (element == null) { | 1051 if (element == null) { |
| 1048 element = lookUpMethod(_resolver.enclosingClass, methodName2.name); | 1052 element = lookUpMethod(_resolver.enclosingClass, methodName2.name); |
| 1049 if (element == null) { | 1053 if (element == null) { |
| 1050 PropertyAccessorElement getter = lookUpGetter(_resolver.enclosingClass
, methodName2.name); | 1054 PropertyAccessorElement getter = lookUpGetter(_resolver.enclosingClass
, methodName2.name); |
| 1051 if (getter != null) { | 1055 if (getter != null) { |
| 1052 FunctionType getterType = getter.type; | 1056 FunctionType getterType = getter.type; |
| 1053 if (getterType != null) { | 1057 if (getterType != null) { |
| 1054 Type2 returnType4 = getterType.returnType; | 1058 Type2 returnType5 = getterType.returnType; |
| 1055 if (!isExecutableType(returnType4)) { | 1059 if (!isExecutableType(returnType5)) { |
| 1056 _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FU
NCTION, methodName2, [methodName2.name]); | 1060 _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FU
NCTION, methodName2, [methodName2.name]); |
| 1057 } | 1061 } |
| 1058 } | 1062 } |
| 1059 recordResolution(methodName2, getter); | 1063 recordResolution(methodName2, getter); |
| 1060 return null; | 1064 return null; |
| 1061 } | 1065 } |
| 1062 } | 1066 } |
| 1063 } | 1067 } |
| 1064 } else { | 1068 } else { |
| 1065 Type2 targetType = getType(target); | 1069 Type2 targetType = getType(target); |
| 1066 if (targetType is InterfaceType) { | 1070 if (targetType is InterfaceType) { |
| 1067 element = lookUpMethod(targetType.element, methodName2.name); | 1071 element = lookUpMethod(targetType.element, methodName2.name); |
| 1068 if (element == null) { | 1072 if (element == null) { |
| 1069 ClassElement targetClass = targetType.element as ClassElement; | 1073 ClassElement targetClass = targetType.element as ClassElement; |
| 1070 PropertyAccessorElement accessor = lookUpGetterInType(targetClass, met
hodName2.name); | 1074 PropertyAccessorElement accessor = lookUpGetterInType(targetClass, met
hodName2.name); |
| 1071 if (accessor != null) { | 1075 if (accessor != null) { |
| 1072 Type2 returnType5 = accessor.type.returnType.substitute2(((targetTyp
e as InterfaceType)).typeArguments, TypeVariableTypeImpl.getTypes(targetClass.ty
peVariables)); | 1076 Type2 returnType6 = accessor.type.returnType.substitute2(((targetTyp
e as InterfaceType)).typeArguments, TypeVariableTypeImpl.getTypes(targetClass.ty
peVariables)); |
| 1073 if (!isExecutableType(returnType5)) { | 1077 if (!isExecutableType(returnType6)) { |
| 1074 _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNC
TION, methodName2, [methodName2.name]); | 1078 _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNC
TION, methodName2, [methodName2.name]); |
| 1075 return null; | 1079 return null; |
| 1076 } | 1080 } |
| 1077 element = accessor; | 1081 element = accessor; |
| 1078 } | 1082 } |
| 1079 } | 1083 } |
| 1080 if (element == null && target is SuperExpression) { | 1084 if (element == null && target is SuperExpression) { |
| 1081 _resolver.reportError(StaticTypeWarningCode.UNDEFINED_SUPER_METHOD, me
thodName2, [methodName2.name, targetType.element.name]); | 1085 _resolver.reportError(StaticTypeWarningCode.UNDEFINED_SUPER_METHOD, me
thodName2, [methodName2.name, targetType.element.name]); |
| 1082 return null; | 1086 return null; |
| 1083 } | 1087 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1095 } | 1099 } |
| 1096 } | 1100 } |
| 1097 ExecutableElement invokedMethod = null; | 1101 ExecutableElement invokedMethod = null; |
| 1098 if (element is ExecutableElement) { | 1102 if (element is ExecutableElement) { |
| 1099 invokedMethod = element as ExecutableElement; | 1103 invokedMethod = element as ExecutableElement; |
| 1100 } else { | 1104 } else { |
| 1101 if (element is PropertyInducingElement) { | 1105 if (element is PropertyInducingElement) { |
| 1102 PropertyAccessorElement getter3 = ((element as PropertyInducingElement))
.getter; | 1106 PropertyAccessorElement getter3 = ((element as PropertyInducingElement))
.getter; |
| 1103 FunctionType getterType = getter3.type; | 1107 FunctionType getterType = getter3.type; |
| 1104 if (getterType != null) { | 1108 if (getterType != null) { |
| 1105 Type2 returnType6 = getterType.returnType; | 1109 Type2 returnType7 = getterType.returnType; |
| 1106 if (!isExecutableType(returnType6)) { | 1110 if (!isExecutableType(returnType7)) { |
| 1107 _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTI
ON, methodName2, [methodName2.name]); | 1111 _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTI
ON, methodName2, [methodName2.name]); |
| 1108 } | 1112 } |
| 1109 } | 1113 } |
| 1110 recordResolution(methodName2, element); | 1114 recordResolution(methodName2, element); |
| 1111 return null; | 1115 return null; |
| 1112 } else if (element is VariableElement) { | 1116 } else if (element is VariableElement) { |
| 1113 Type2 variableType = ((element as VariableElement)).type; | 1117 Type2 variableType = ((element as VariableElement)).type; |
| 1114 if (!isExecutableType(variableType)) { | 1118 if (!isExecutableType(variableType)) { |
| 1115 _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION
, methodName2, [methodName2.name]); | 1119 _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION
, methodName2, [methodName2.name]); |
| 1116 } | 1120 } |
| (...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2199 Map<Source, Library> _libraryMap = new Map<Source, Library>(); | 2203 Map<Source, Library> _libraryMap = new Map<Source, Library>(); |
| 2200 /** | 2204 /** |
| 2201 * A collection containing the libraries that are being resolved together. | 2205 * A collection containing the libraries that are being resolved together. |
| 2202 */ | 2206 */ |
| 2203 Set<Library> _librariesInCycles; | 2207 Set<Library> _librariesInCycles; |
| 2204 /** | 2208 /** |
| 2205 * Initialize a newly created library resolver to resolve libraries within the
given context. | 2209 * Initialize a newly created library resolver to resolve libraries within the
given context. |
| 2206 * @param analysisContext the analysis context in which the library is being a
nalyzed | 2210 * @param analysisContext the analysis context in which the library is being a
nalyzed |
| 2207 */ | 2211 */ |
| 2208 LibraryResolver.con1(AnalysisContextImpl analysisContext) { | 2212 LibraryResolver.con1(AnalysisContextImpl analysisContext) { |
| 2209 _jtd_constructor_237_impl(analysisContext); | 2213 _jtd_constructor_239_impl(analysisContext); |
| 2210 } | 2214 } |
| 2211 _jtd_constructor_237_impl(AnalysisContextImpl analysisContext) { | 2215 _jtd_constructor_239_impl(AnalysisContextImpl analysisContext) { |
| 2212 _jtd_constructor_238_impl(analysisContext, null); | 2216 _jtd_constructor_240_impl(analysisContext, null); |
| 2213 } | 2217 } |
| 2214 /** | 2218 /** |
| 2215 * Initialize a newly created library resolver to resolve libraries within the
given context. | 2219 * Initialize a newly created library resolver to resolve libraries within the
given context. |
| 2216 * @param analysisContext the analysis context in which the library is being a
nalyzed | 2220 * @param analysisContext the analysis context in which the library is being a
nalyzed |
| 2217 * @param errorListener the listener to which analysis errors will be reported | 2221 * @param errorListener the listener to which analysis errors will be reported |
| 2218 */ | 2222 */ |
| 2219 LibraryResolver.con2(AnalysisContextImpl analysisContext2, AnalysisErrorListen
er additionalAnalysisErrorListener) { | 2223 LibraryResolver.con2(AnalysisContextImpl analysisContext2, AnalysisErrorListen
er additionalAnalysisErrorListener) { |
| 2220 _jtd_constructor_238_impl(analysisContext2, additionalAnalysisErrorListener)
; | 2224 _jtd_constructor_240_impl(analysisContext2, additionalAnalysisErrorListener)
; |
| 2221 } | 2225 } |
| 2222 _jtd_constructor_238_impl(AnalysisContextImpl analysisContext2, AnalysisErrorL
istener additionalAnalysisErrorListener) { | 2226 _jtd_constructor_240_impl(AnalysisContextImpl analysisContext2, AnalysisErrorL
istener additionalAnalysisErrorListener) { |
| 2223 this._analysisContext = analysisContext2; | 2227 this._analysisContext = analysisContext2; |
| 2224 this._recordingErrorListener = new RecordingErrorListener(); | 2228 this._recordingErrorListener = new RecordingErrorListener(); |
| 2225 if (additionalAnalysisErrorListener == null) { | 2229 if (additionalAnalysisErrorListener == null) { |
| 2226 this._errorListener = _recordingErrorListener; | 2230 this._errorListener = _recordingErrorListener; |
| 2227 } else { | 2231 } else { |
| 2228 this._errorListener = new AnalysisErrorListener_5(this, additionalAnalysis
ErrorListener); | 2232 this._errorListener = new AnalysisErrorListener_5(this, additionalAnalysis
ErrorListener); |
| 2229 } | 2233 } |
| 2230 _coreLibrarySource = analysisContext2.sourceFactory.forUri(LibraryElementBui
lder.CORE_LIBRARY_URI); | 2234 _coreLibrarySource = analysisContext2.sourceFactory.forUri(LibraryElementBui
lder.CORE_LIBRARY_URI); |
| 2231 } | 2235 } |
| 2232 /** | 2236 /** |
| (...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3177 * assignment of the form <i>e<sub>1</sub>.v op= e<sub>2</sub></i> is equivale
nt to <i>((x) => x.v | 3181 * assignment of the form <i>e<sub>1</sub>.v op= e<sub>2</sub></i> is equivale
nt to <i>((x) => x.v |
| 3178 * = 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 | 3182 * = 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 |
| 3179 * <i>e<sub>2</sub></i>. A compound assignment of the form <i>e<sub>1</sub>[e<
sub>2</sub>] op= | 3183 * <i>e<sub>2</sub></i>. A compound assignment of the form <i>e<sub>1</sub>[e<
sub>2</sub>] op= |
| 3180 * 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>, | 3184 * 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>, |
| 3181 * e<sub>2</sub>)</i> where <i>a</i> and <i>i</i> are a variables that are not
used in | 3185 * e<sub>2</sub>)</i> where <i>a</i> and <i>i</i> are a variables that are not
used in |
| 3182 * <i>e<sub>3</sub></i>. </blockquote> | 3186 * <i>e<sub>3</sub></i>. </blockquote> |
| 3183 */ | 3187 */ |
| 3184 Object visitAssignmentExpression(AssignmentExpression node) { | 3188 Object visitAssignmentExpression(AssignmentExpression node) { |
| 3185 sc.TokenType operator11 = node.operator.type; | 3189 sc.TokenType operator11 = node.operator.type; |
| 3186 if (operator11 != sc.TokenType.EQ) { | 3190 if (operator11 != sc.TokenType.EQ) { |
| 3187 return recordReturnType(node, node.element); | 3191 return recordReturnType(node, node.element, null); |
| 3188 } | 3192 } |
| 3189 return recordType(node, getType(node.rightHandSide)); | 3193 return recordType(node, getType(node.rightHandSide)); |
| 3190 } | 3194 } |
| 3191 /** | 3195 /** |
| 3192 * The Dart Language Specification, 12.20: <blockquote>The static type of a lo
gical boolean | 3196 * The Dart Language Specification, 12.20: <blockquote>The static type of a lo
gical boolean |
| 3193 * expression is {@code bool}.</blockquote> | 3197 * expression is {@code bool}.</blockquote> |
| 3194 * <p> | 3198 * <p> |
| 3195 * The Dart Language Specification, 12.21:<blockquote>A bitwise expression of
the form | 3199 * The Dart Language Specification, 12.21:<blockquote>A bitwise expression of
the form |
| 3196 * <i>e<sub>1</sub> op e<sub>2</sub></i> is equivalent to the method invocatio
n | 3200 * <i>e<sub>1</sub> op e<sub>2</sub></i> is equivalent to the method invocatio
n |
| 3197 * <i>e<sub>1</sub>.op(e<sub>2</sub>)</i>. A bitwise expression of the form <i
>super op | 3201 * <i>e<sub>1</sub>.op(e<sub>2</sub>)</i>. A bitwise expression of the form <i
>super op |
| (...skipping 28 matching lines...) Expand all Loading... |
| 3226 * <i>super.op(e<sub>2</sub>)</i>.</blockquote> | 3230 * <i>super.op(e<sub>2</sub>)</i>.</blockquote> |
| 3227 */ | 3231 */ |
| 3228 Object visitBinaryExpression(BinaryExpression node) { | 3232 Object visitBinaryExpression(BinaryExpression node) { |
| 3229 sc.TokenType operator12 = node.operator.type; | 3233 sc.TokenType operator12 = node.operator.type; |
| 3230 while (true) { | 3234 while (true) { |
| 3231 if (operator12 == sc.TokenType.AMPERSAND_AMPERSAND || operator12 == sc.Tok
enType.BAR_BAR || operator12 == sc.TokenType.EQ_EQ || operator12 == sc.TokenType
.BANG_EQ) { | 3235 if (operator12 == sc.TokenType.AMPERSAND_AMPERSAND || operator12 == sc.Tok
enType.BAR_BAR || operator12 == sc.TokenType.EQ_EQ || operator12 == sc.TokenType
.BANG_EQ) { |
| 3232 return recordType(node, _typeProvider.boolType); | 3236 return recordType(node, _typeProvider.boolType); |
| 3233 } | 3237 } |
| 3234 break; | 3238 break; |
| 3235 } | 3239 } |
| 3236 return recordReturnType(node, node.element); | 3240 return recordReturnType(node, node.element, null); |
| 3237 } | 3241 } |
| 3238 /** | 3242 /** |
| 3239 * The Dart Language Specification, 12.4: <blockquote>The static type of a boo
lean literal is{@code bool}.</blockquote> | 3243 * The Dart Language Specification, 12.4: <blockquote>The static type of a boo
lean literal is{@code bool}.</blockquote> |
| 3240 */ | 3244 */ |
| 3241 Object visitBooleanLiteral(BooleanLiteral node) => recordType(node, _typeProvi
der.boolType); | 3245 Object visitBooleanLiteral(BooleanLiteral node) => recordType(node, _typeProvi
der.boolType); |
| 3242 /** | 3246 /** |
| 3243 * The Dart Language Specification, 12.15.2: <blockquote>A cascaded method inv
ocation expression | 3247 * The Dart Language Specification, 12.15.2: <blockquote>A cascaded method inv
ocation expression |
| 3244 * of the form <i>e..suffix</i> is equivalent to the expression <i>(t) {t.suff
ix; return | 3248 * of the form <i>e..suffix</i> is equivalent to the expression <i>(t) {t.suff
ix; return |
| 3245 * t;}(e)</i>.</blockquote> | 3249 * t;}(e)</i>.</blockquote> |
| 3246 */ | 3250 */ |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3316 * has the form <i>e<sub>f</sub>(a<sub>1</sub>, …, a<sub>n</sub>, x<sub
>n+1</sub>: | 3320 * has the form <i>e<sub>f</sub>(a<sub>1</sub>, …, a<sub>n</sub>, x<sub
>n+1</sub>: |
| 3317 * a<sub>n+1</sub>, …, x<sub>n+k</sub>: a<sub>n+k</sub>)</i>, where <i>
e<sub>f</sub></i> is | 3321 * a<sub>n+1</sub>, …, x<sub>n+k</sub>: a<sub>n+k</sub>)</i>, where <i>
e<sub>f</sub></i> is |
| 3318 * an expression. | 3322 * an expression. |
| 3319 * <p> | 3323 * <p> |
| 3320 * It is a static type warning if the static type <i>F</i> of <i>e<sub>f</sub>
</i> may not be | 3324 * It is a static type warning if the static type <i>F</i> of <i>e<sub>f</sub>
</i> may not be |
| 3321 * assigned to a function type. | 3325 * assigned to a function type. |
| 3322 * <p> | 3326 * <p> |
| 3323 * If <i>F</i> is not a function type, the static type of <i>i</i> is dynamic.
Otherwise the | 3327 * If <i>F</i> is not a function type, the static type of <i>i</i> is dynamic.
Otherwise the |
| 3324 * static type of <i>i</i> is the declared return type of <i>F</i>.</blockquot
e> | 3328 * static type of <i>i</i> is the declared return type of <i>F</i>.</blockquot
e> |
| 3325 */ | 3329 */ |
| 3326 Object visitFunctionExpressionInvocation(FunctionExpressionInvocation node) =>
recordReturnType(node, node.element); | 3330 Object visitFunctionExpressionInvocation(FunctionExpressionInvocation node) =>
recordReturnType(node, node.element, null); |
| 3327 /** | 3331 /** |
| 3328 * The Dart Language Specification, 12.29: <blockquote>An assignable expressio
n of the form | 3332 * The Dart Language Specification, 12.29: <blockquote>An assignable expressio
n of the form |
| 3329 * <i>e<sub>1</sub>[e<sub>2</sub>]</i> is evaluated as a method invocation of
the operator method | 3333 * <i>e<sub>1</sub>[e<sub>2</sub>]</i> is evaluated as a method invocation of
the operator method |
| 3330 * <i>[]</i> on <i>e<sub>1</sub></i> with argument <i>e<sub>2</sub></i>.</bloc
kquote> | 3334 * <i>[]</i> on <i>e<sub>1</sub></i> with argument <i>e<sub>2</sub></i>.</bloc
kquote> |
| 3331 */ | 3335 */ |
| 3332 Object visitIndexExpression(IndexExpression node) { | 3336 Object visitIndexExpression(IndexExpression node) { |
| 3337 Type2 type = getType(node.realTarget); |
| 3338 List<Type2> typeArgs = null; |
| 3339 if (type is InterfaceType) { |
| 3340 typeArgs = ((type as InterfaceType)).typeArguments; |
| 3341 } |
| 3333 if (node.inSetterContext()) { | 3342 if (node.inSetterContext()) { |
| 3334 return recordArgumentType(node, node.element); | 3343 return recordArgumentType(node, node.element, typeArgs); |
| 3335 } | 3344 } |
| 3336 return recordReturnType(node, node.element); | 3345 return recordReturnType(node, node.element, typeArgs); |
| 3337 } | 3346 } |
| 3338 /** | 3347 /** |
| 3339 * The Dart Language Specification, 12.11.1: <blockquote>The static type of a
new expression of | 3348 * The Dart Language Specification, 12.11.1: <blockquote>The static type of a
new expression of |
| 3340 * either the form <i>new T.id(a<sub>1</sub>, …, a<sub>n</sub>)</i> or
the form <i>new | 3349 * either the form <i>new T.id(a<sub>1</sub>, …, a<sub>n</sub>)</i> or
the form <i>new |
| 3341 * T(a<sub>1</sub>, …, a<sub>n</sub>)</i> is <i>T</i>.</blockquote> | 3350 * T(a<sub>1</sub>, …, a<sub>n</sub>)</i> is <i>T</i>.</blockquote> |
| 3342 * <p> | 3351 * <p> |
| 3343 * The Dart Language Specification, 12.11.2: <blockquote>The static type of a
constant object | 3352 * The Dart Language Specification, 12.11.2: <blockquote>The static type of a
constant object |
| 3344 * expression of either the form <i>const T.id(a<sub>1</sub>, …, a<sub>
n</sub>)</i> or the | 3353 * expression of either the form <i>const T.id(a<sub>1</sub>, …, a<sub>
n</sub>)</i> or the |
| 3345 * form <i>const T(a<sub>1</sub>, …, a<sub>n</sub>)</i> is <i>T</i>. </
blockquote> | 3354 * form <i>const T(a<sub>1</sub>, …, a<sub>n</sub>)</i> is <i>T</i>. </
blockquote> |
| 3346 */ | 3355 */ |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3429 * …, x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. | 3438 * …, x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. |
| 3430 * <p> | 3439 * <p> |
| 3431 * It is a static type warning if <i>S</i> does not have an accessible instanc
e member named m. If | 3440 * It is a static type warning if <i>S</i> does not have an accessible instanc
e member named m. If |
| 3432 * <i>S.m</i> exists, it is a static warning if the type <i>F</i> of <i>S.m</i
> may not be | 3441 * <i>S.m</i> exists, it is a static warning if the type <i>F</i> of <i>S.m</i
> may not be |
| 3433 * assigned to a function type. | 3442 * assigned to a function type. |
| 3434 * <p> | 3443 * <p> |
| 3435 * If <i>S.m</i> does not exist, or if <i>F</i> is not a function type, the st
atic type of | 3444 * If <i>S.m</i> does not exist, or if <i>F</i> is not a function type, the st
atic type of |
| 3436 * <i>i</i> is dynamic. Otherwise the static type of <i>i</i> is the declared
return type of | 3445 * <i>i</i> is dynamic. Otherwise the static type of <i>i</i> is the declared
return type of |
| 3437 * <i>F</i>.</blockquote> | 3446 * <i>F</i>.</blockquote> |
| 3438 */ | 3447 */ |
| 3439 Object visitMethodInvocation(MethodInvocation node) => recordReturnType(node,
node.methodName.element); | 3448 Object visitMethodInvocation(MethodInvocation node) => recordReturnType(node,
node.methodName.element, null); |
| 3440 Object visitNamedExpression(NamedExpression node) => recordType(node, getType(
node.expression)); | 3449 Object visitNamedExpression(NamedExpression node) => recordType(node, getType(
node.expression)); |
| 3441 /** | 3450 /** |
| 3442 * The Dart Language Specification, 12.2: <blockquote>The static type of {@cod
e null} is bottom. | 3451 * The Dart Language Specification, 12.2: <blockquote>The static type of {@cod
e null} is bottom. |
| 3443 * </blockquote> | 3452 * </blockquote> |
| 3444 */ | 3453 */ |
| 3445 Object visitNullLiteral(NullLiteral node) => recordType(node, _typeProvider.bo
ttomType); | 3454 Object visitNullLiteral(NullLiteral node) => recordType(node, _typeProvider.bo
ttomType); |
| 3446 Object visitParenthesizedExpression(ParenthesizedExpression node) => recordTyp
e(node, getType(node.expression)); | 3455 Object visitParenthesizedExpression(ParenthesizedExpression node) => recordTyp
e(node, getType(node.expression)); |
| 3447 /** | 3456 /** |
| 3448 * The Dart Language Specification, 12.28: <blockquote>A postfix expression of
the form | 3457 * The Dart Language Specification, 12.28: <blockquote>A postfix expression of
the form |
| 3449 * <i>v++</i>, where <i>v</i> is an identifier, is equivalent to <i>(){var r =
v; v = r + 1; | 3458 * <i>v++</i>, where <i>v</i> is an identifier, is equivalent to <i>(){var r =
v; v = r + 1; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3497 /** | 3506 /** |
| 3498 * The Dart Language Specification, 12.27: <blockquote>A unary expression <i>u
</i> of the form | 3507 * The Dart Language Specification, 12.27: <blockquote>A unary expression <i>u
</i> of the form |
| 3499 * <i>op e</i> is equivalent to a method invocation <i>expression e.op()</i>.
An expression of the | 3508 * <i>op e</i> is equivalent to a method invocation <i>expression e.op()</i>.
An expression of the |
| 3500 * form <i>op super</i> is equivalent to the method invocation <i>super.op()<i
>.</blockquote> | 3509 * form <i>op super</i> is equivalent to the method invocation <i>super.op()<i
>.</blockquote> |
| 3501 */ | 3510 */ |
| 3502 Object visitPrefixExpression(PrefixExpression node) { | 3511 Object visitPrefixExpression(PrefixExpression node) { |
| 3503 sc.TokenType operator13 = node.operator.type; | 3512 sc.TokenType operator13 = node.operator.type; |
| 3504 if (identical(operator13, sc.TokenType.BANG)) { | 3513 if (identical(operator13, sc.TokenType.BANG)) { |
| 3505 return recordType(node, _typeProvider.boolType); | 3514 return recordType(node, _typeProvider.boolType); |
| 3506 } | 3515 } |
| 3507 return recordReturnType(node, node.element); | 3516 return recordReturnType(node, node.element, null); |
| 3508 } | 3517 } |
| 3509 /** | 3518 /** |
| 3510 * The Dart Language Specification, 12.13: <blockquote> Property extraction al
lows for a member of | 3519 * The Dart Language Specification, 12.13: <blockquote> Property extraction al
lows for a member of |
| 3511 * an object to be concisely extracted from the object. If <i>o</i> is an obje
ct, and if <i>m</i> | 3520 * an object to be concisely extracted from the object. If <i>o</i> is an obje
ct, and if <i>m</i> |
| 3512 * is the name of a method member of <i>o</i>, then | 3521 * is the name of a method member of <i>o</i>, then |
| 3513 * <ul> | 3522 * <ul> |
| 3514 * <li><i>o.m</i> is defined to be equivalent to: <i>(r<sub>1</sub>, …,
r<sub>n</sub>, | 3523 * <li><i>o.m</i> is defined to be equivalent to: <i>(r<sub>1</sub>, …,
r<sub>n</sub>, |
| 3515 * {p<sub>1</sub> : d<sub>1</sub>, …, p<sub>k</sub> : d<sub>k</sub>}){r
eturn | 3524 * {p<sub>1</sub> : d<sub>1</sub>, …, p<sub>k</sub> : d<sub>k</sub>}){r
eturn |
| 3516 * o.m(r<sub>1</sub>, …, r<sub>n</sub>, p<sub>1</sub>: p<sub>1</sub>, &
hellip;, | 3525 * o.m(r<sub>1</sub>, …, r<sub>n</sub>, p<sub>1</sub>: p<sub>1</sub>, &
hellip;, |
| 3517 * p<sub>k</sub>: p<sub>k</sub>);}</i> if <i>m</i> has required parameters <i>
r<sub>1</sub>, | 3526 * p<sub>k</sub>: p<sub>k</sub>);}</i> if <i>m</i> has required parameters <i>
r<sub>1</sub>, |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3666 */ | 3675 */ |
| 3667 Object visitThrowExpression(ThrowExpression node) => recordType(node, _typePro
vider.bottomType); | 3676 Object visitThrowExpression(ThrowExpression node) => recordType(node, _typePro
vider.bottomType); |
| 3668 /** | 3677 /** |
| 3669 * Given a function declaration, compute the return type of the function. The
return type of | 3678 * Given a function declaration, compute the return type of the function. The
return type of |
| 3670 * functions with a block body is {@code dynamicType}, with an expression body
it is the type of | 3679 * functions with a block body is {@code dynamicType}, with an expression body
it is the type of |
| 3671 * the expression. | 3680 * the expression. |
| 3672 * @param node the function expression whose return type is to be computed | 3681 * @param node the function expression whose return type is to be computed |
| 3673 * @return the return type that was computed | 3682 * @return the return type that was computed |
| 3674 */ | 3683 */ |
| 3675 Type2 computeReturnType(FunctionDeclaration node) { | 3684 Type2 computeReturnType(FunctionDeclaration node) { |
| 3676 TypeName returnType7 = node.returnType; | 3685 TypeName returnType8 = node.returnType; |
| 3677 if (returnType7 == null) { | 3686 if (returnType8 == null) { |
| 3678 return computeReturnType2(node.functionExpression); | 3687 return computeReturnType2(node.functionExpression); |
| 3679 } | 3688 } |
| 3680 return returnType7.type; | 3689 return returnType8.type; |
| 3681 } | 3690 } |
| 3682 /** | 3691 /** |
| 3683 * Given a function expression, compute the return type of the function. The r
eturn type of | 3692 * Given a function expression, compute the return type of the function. The r
eturn type of |
| 3684 * functions with a block body is {@code dynamicType}, with an expression body
it is the type of | 3693 * functions with a block body is {@code dynamicType}, with an expression body
it is the type of |
| 3685 * the expression. | 3694 * the expression. |
| 3686 * @param node the function expression whose return type is to be computed | 3695 * @param node the function expression whose return type is to be computed |
| 3687 * @return the return type that was computed | 3696 * @return the return type that was computed |
| 3688 */ | 3697 */ |
| 3689 Type2 computeReturnType2(FunctionExpression node) { | 3698 Type2 computeReturnType2(FunctionExpression node) { |
| 3690 FunctionBody body4 = node.body; | 3699 FunctionBody body4 = node.body; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3750 */ | 3759 */ |
| 3751 bool isNotTypeLiteral(SimpleIdentifier node) { | 3760 bool isNotTypeLiteral(SimpleIdentifier node) { |
| 3752 ASTNode parent15 = node.parent; | 3761 ASTNode parent15 = node.parent; |
| 3753 return parent15 is TypeName || (parent15 is PrefixedIdentifier && (parent15.
parent is TypeName || identical(((parent15 as PrefixedIdentifier)).prefix, node)
)) || (parent15 is PropertyAccess && identical(((parent15 as PropertyAccess)).ta
rget, node)) || (parent15 is MethodInvocation && identical(node, ((parent15 as M
ethodInvocation)).target)); | 3762 return parent15 is TypeName || (parent15 is PrefixedIdentifier && (parent15.
parent is TypeName || identical(((parent15 as PrefixedIdentifier)).prefix, node)
)) || (parent15 is PropertyAccess && identical(((parent15 as PropertyAccess)).ta
rget, node)) || (parent15 is MethodInvocation && identical(node, ((parent15 as M
ethodInvocation)).target)); |
| 3754 } | 3763 } |
| 3755 /** | 3764 /** |
| 3756 * Record that the static type of the given node is the type of the second arg
ument to the method | 3765 * Record that the static type of the given node is the type of the second arg
ument to the method |
| 3757 * represented by the given element. | 3766 * represented by the given element. |
| 3758 * @param expression the node whose type is to be recorded | 3767 * @param expression the node whose type is to be recorded |
| 3759 * @param element the element representing the method invoked by the given nod
e | 3768 * @param element the element representing the method invoked by the given nod
e |
| 3769 * @param typeArguments the array of {@link Type}s to perform a substitution o
n the parameter |
| 3770 * types from the type in the passed {@link Element}, or <code>null</code> |
| 3760 */ | 3771 */ |
| 3761 Object recordArgumentType(IndexExpression expression, MethodElement element) { | 3772 Object recordArgumentType(IndexExpression expression, MethodElement element, L
ist<Type2> typeArguments10) { |
| 3762 if (element != null) { | 3773 if (element != null) { |
| 3763 List<ParameterElement> parameters12 = element.parameters; | 3774 List<ParameterElement> parameters12 = element.parameters; |
| 3764 if (parameters12 != null && parameters12.length == 2) { | 3775 if (parameters12 != null && parameters12.length == 2) { |
| 3765 return recordType(expression, parameters12[1].type); | 3776 ClassElement classElement = parameters12[1].getAncestor(ClassElement); |
| 3777 List<Type2> typeParameters = classElement == null ? null : classElement.
type.typeArguments; |
| 3778 if (typeArguments10 == null || typeParameters == null || typeArguments10
.length != typeParameters.length) { |
| 3779 return recordType(expression, parameters12[1].type); |
| 3780 } else { |
| 3781 return recordType(expression, parameters12[1].type.substitute2(typeArg
uments10, typeParameters)); |
| 3782 } |
| 3766 } | 3783 } |
| 3767 } | 3784 } |
| 3768 return recordType(expression, _dynamicType); | 3785 return recordType(expression, _dynamicType); |
| 3769 } | 3786 } |
| 3770 /** | 3787 /** |
| 3771 * Record that the static type of the given node is the return type of the met
hod or function | 3788 * Record that the static type of the given node is the return type of the met
hod or function |
| 3772 * represented by the given element. | 3789 * represented by the given element. |
| 3773 * @param expression the node whose type is to be recorded | 3790 * @param expression the node whose type is to be recorded |
| 3774 * @param element the element representing the method or function invoked by t
he given node | 3791 * @param element the element representing the method or function invoked by t
he given node |
| 3792 * @param typeArguments the array of {@link Type}s to perform a substitution o
n the parameter |
| 3793 * types from the type in the passed {@link Element}, or <code>null</code> |
| 3775 */ | 3794 */ |
| 3776 Object recordReturnType(Expression expression, Element element) { | 3795 Object recordReturnType(Expression expression, Element element, List<Type2> ty
peArguments11) { |
| 3777 if (element is PropertyAccessorElement) { | 3796 if (element is PropertyAccessorElement) { |
| 3778 FunctionType propertyType = ((element as PropertyAccessorElement)).type; | 3797 FunctionType propertyType = ((element as PropertyAccessorElement)).type; |
| 3779 if (propertyType != null) { | 3798 if (propertyType != null) { |
| 3780 Type2 returnType8 = propertyType.returnType; | 3799 Type2 returnType9 = propertyType.returnType; |
| 3781 if (returnType8 is FunctionType) { | 3800 if (returnType9 is FunctionType) { |
| 3782 Type2 innerReturnType = ((returnType8 as FunctionType)).returnType; | 3801 Type2 innerReturnType = ((returnType9 as FunctionType)).returnType; |
| 3783 if (innerReturnType != null) { | 3802 if (innerReturnType != null) { |
| 3784 return recordType(expression, innerReturnType); | 3803 return recordType(expression, innerReturnType); |
| 3785 } | 3804 } |
| 3786 } | 3805 } |
| 3787 if (returnType8 != null) { | 3806 if (returnType9 != null) { |
| 3788 return recordType(expression, returnType8); | 3807 return recordType(expression, returnType9); |
| 3789 } | 3808 } |
| 3790 } | 3809 } |
| 3791 } else if (element is ExecutableElement) { | 3810 } else if (element is ExecutableElement) { |
| 3792 FunctionType type17 = ((element as ExecutableElement)).type; | 3811 FunctionType type17 = ((element as ExecutableElement)).type; |
| 3793 if (type17 != null) { | 3812 if (type17 != null) { |
| 3794 return recordType(expression, type17.returnType); | 3813 ClassElement classElement = element.getAncestor(ClassElement); |
| 3814 List<Type2> typeParameters = classElement == null ? null : classElement.
type.typeArguments; |
| 3815 if (typeArguments11 == null || typeParameters == null || typeArguments11
.length != typeParameters.length) { |
| 3816 return recordType(expression, type17.returnType); |
| 3817 } else { |
| 3818 return recordType(expression, type17.returnType.substitute2(typeArgume
nts11, typeParameters)); |
| 3819 } |
| 3795 } | 3820 } |
| 3796 } else if (element is VariableElement) { | 3821 } else if (element is VariableElement) { |
| 3797 Type2 variableType = ((element as VariableElement)).type; | 3822 Type2 variableType = ((element as VariableElement)).type; |
| 3798 if (variableType is FunctionType) { | 3823 if (variableType is FunctionType) { |
| 3799 return recordType(expression, ((variableType as FunctionType)).returnTyp
e); | 3824 return recordType(expression, ((variableType as FunctionType)).returnTyp
e); |
| 3800 } | 3825 } |
| 3801 } | 3826 } |
| 3802 return recordType(expression, _dynamicType); | 3827 return recordType(expression, _dynamicType); |
| 3803 } | 3828 } |
| 3804 /** | 3829 /** |
| 3805 * Record that the static type of the given node is the given type. | 3830 * Record that the static type of the given node is the given type. |
| 3806 * @param expression the node whose type is to be recorded | 3831 * @param expression the node whose type is to be recorded |
| 3807 * @param type the static type of the node | 3832 * @param type the static type of the node |
| 3808 */ | 3833 */ |
| 3809 Object recordType(Expression expression, Type2 type) { | 3834 Object recordType(Expression expression, Type2 type) { |
| 3810 if (type == null) { | 3835 if (type == null) { |
| 3811 expression.staticType = _dynamicType; | 3836 expression.staticType = _dynamicType; |
| 3812 } else { | 3837 } else { |
| 3813 expression.staticType = type; | 3838 expression.staticType = type; |
| 3814 } | 3839 } |
| 3815 return null; | 3840 return null; |
| 3816 } | 3841 } |
| 3817 /** | 3842 /** |
| 3818 * Set the return type and parameter type information for the given function t
ype based on the | 3843 * Set the return type and parameter type information for the given function t
ype based on the |
| 3819 * given return type and parameter elements. | 3844 * given return type and parameter elements. |
| 3820 * @param functionType the function type to be filled in | 3845 * @param functionType the function type to be filled in |
| 3821 * @param returnType the return type of the function, or {@code null} if no ty
pe was declared | 3846 * @param returnType the return type of the function, or {@code null} if no ty
pe was declared |
| 3822 * @param parameters the elements representing the parameters to the function | 3847 * @param parameters the elements representing the parameters to the function |
| 3823 */ | 3848 */ |
| 3824 void setTypeInformation(FunctionTypeImpl functionType, Type2 returnType11, For
malParameterList parameterList) { | 3849 void setTypeInformation(FunctionTypeImpl functionType, Type2 returnType12, For
malParameterList parameterList) { |
| 3825 List<Type2> normalParameterTypes = new List<Type2>(); | 3850 List<Type2> normalParameterTypes = new List<Type2>(); |
| 3826 List<Type2> optionalParameterTypes = new List<Type2>(); | 3851 List<Type2> optionalParameterTypes = new List<Type2>(); |
| 3827 LinkedHashMap<String, Type2> namedParameterTypes = new LinkedHashMap<String,
Type2>(); | 3852 LinkedHashMap<String, Type2> namedParameterTypes = new LinkedHashMap<String,
Type2>(); |
| 3828 if (parameterList != null) { | 3853 if (parameterList != null) { |
| 3829 for (ParameterElement parameter in parameterList.elements) { | 3854 for (ParameterElement parameter in parameterList.elements) { |
| 3830 while (true) { | 3855 while (true) { |
| 3831 if (parameter.parameterKind == ParameterKind.REQUIRED) { | 3856 if (parameter.parameterKind == ParameterKind.REQUIRED) { |
| 3832 normalParameterTypes.add(parameter.type); | 3857 normalParameterTypes.add(parameter.type); |
| 3833 } else if (parameter.parameterKind == ParameterKind.POSITIONAL) { | 3858 } else if (parameter.parameterKind == ParameterKind.POSITIONAL) { |
| 3834 optionalParameterTypes.add(parameter.type); | 3859 optionalParameterTypes.add(parameter.type); |
| 3835 } else if (parameter.parameterKind == ParameterKind.NAMED) { | 3860 } else if (parameter.parameterKind == ParameterKind.NAMED) { |
| 3836 namedParameterTypes[parameter.name] = parameter.type; | 3861 namedParameterTypes[parameter.name] = parameter.type; |
| 3837 } | 3862 } |
| 3838 break; | 3863 break; |
| 3839 } | 3864 } |
| 3840 } | 3865 } |
| 3841 } | 3866 } |
| 3842 functionType.normalParameterTypes = new List.from(normalParameterTypes); | 3867 functionType.normalParameterTypes = new List.from(normalParameterTypes); |
| 3843 functionType.optionalParameterTypes = new List.from(optionalParameterTypes); | 3868 functionType.optionalParameterTypes = new List.from(optionalParameterTypes); |
| 3844 functionType.namedParameterTypes = namedParameterTypes; | 3869 functionType.namedParameterTypes = namedParameterTypes; |
| 3845 functionType.returnType = returnType11; | 3870 functionType.returnType = returnType12; |
| 3846 } | 3871 } |
| 3847 get thisType_J2DAccessor => _thisType; | 3872 get thisType_J2DAccessor => _thisType; |
| 3848 set thisType_J2DAccessor(__v) => _thisType = __v; | 3873 set thisType_J2DAccessor(__v) => _thisType = __v; |
| 3849 } | 3874 } |
| 3850 /** | 3875 /** |
| 3851 * The interface {@code TypeProvider} defines the behavior of objects that provi
de access to types | 3876 * The interface {@code TypeProvider} defines the behavior of objects that provi
de access to types |
| 3852 * defined by the language. | 3877 * defined by the language. |
| 3853 * @coverage dart.engine.resolver | 3878 * @coverage dart.engine.resolver |
| 3854 */ | 3879 */ |
| 3855 abstract class TypeProvider { | 3880 abstract class TypeProvider { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3887 * Return the type representing the built-in type 'List'. | 3912 * Return the type representing the built-in type 'List'. |
| 3888 * @return the type representing the built-in type 'List' | 3913 * @return the type representing the built-in type 'List' |
| 3889 */ | 3914 */ |
| 3890 InterfaceType get listType; | 3915 InterfaceType get listType; |
| 3891 /** | 3916 /** |
| 3892 * Return the type representing the built-in type 'Map'. | 3917 * Return the type representing the built-in type 'Map'. |
| 3893 * @return the type representing the built-in type 'Map' | 3918 * @return the type representing the built-in type 'Map' |
| 3894 */ | 3919 */ |
| 3895 InterfaceType get mapType; | 3920 InterfaceType get mapType; |
| 3896 /** | 3921 /** |
| 3922 * Return the type representing the built-in type 'num'. |
| 3923 * @return the type representing the built-in type 'num' |
| 3924 */ |
| 3925 InterfaceType get numType; |
| 3926 /** |
| 3897 * Return the type representing the built-in type 'Object'. | 3927 * Return the type representing the built-in type 'Object'. |
| 3898 * @return the type representing the built-in type 'Object' | 3928 * @return the type representing the built-in type 'Object' |
| 3899 */ | 3929 */ |
| 3900 InterfaceType get objectType; | 3930 InterfaceType get objectType; |
| 3901 /** | 3931 /** |
| 3902 * Return the type representing the built-in type 'StackTrace'. | 3932 * Return the type representing the built-in type 'StackTrace'. |
| 3903 * @return the type representing the built-in type 'StackTrace' | 3933 * @return the type representing the built-in type 'StackTrace' |
| 3904 */ | 3934 */ |
| 3905 InterfaceType get stackTraceType; | 3935 InterfaceType get stackTraceType; |
| 3906 /** | 3936 /** |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3946 InterfaceType _intType; | 3976 InterfaceType _intType; |
| 3947 /** | 3977 /** |
| 3948 * The type representing the built-in type 'List'. | 3978 * The type representing the built-in type 'List'. |
| 3949 */ | 3979 */ |
| 3950 InterfaceType _listType; | 3980 InterfaceType _listType; |
| 3951 /** | 3981 /** |
| 3952 * The type representing the built-in type 'Map'. | 3982 * The type representing the built-in type 'Map'. |
| 3953 */ | 3983 */ |
| 3954 InterfaceType _mapType; | 3984 InterfaceType _mapType; |
| 3955 /** | 3985 /** |
| 3986 * The type representing the built-in type 'num'. |
| 3987 */ |
| 3988 InterfaceType _numType; |
| 3989 /** |
| 3956 * The type representing the built-in type 'Object'. | 3990 * The type representing the built-in type 'Object'. |
| 3957 */ | 3991 */ |
| 3958 InterfaceType _objectType; | 3992 InterfaceType _objectType; |
| 3959 /** | 3993 /** |
| 3960 * The type representing the built-in type 'StackTrace'. | 3994 * The type representing the built-in type 'StackTrace'. |
| 3961 */ | 3995 */ |
| 3962 InterfaceType _stackTraceType; | 3996 InterfaceType _stackTraceType; |
| 3963 /** | 3997 /** |
| 3964 * The type representing the built-in type 'String'. | 3998 * The type representing the built-in type 'String'. |
| 3965 */ | 3999 */ |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3976 initializeFrom(coreLibrary); | 4010 initializeFrom(coreLibrary); |
| 3977 } | 4011 } |
| 3978 InterfaceType get boolType => _boolType; | 4012 InterfaceType get boolType => _boolType; |
| 3979 Type2 get bottomType => _bottomType; | 4013 Type2 get bottomType => _bottomType; |
| 3980 InterfaceType get doubleType => _doubleType; | 4014 InterfaceType get doubleType => _doubleType; |
| 3981 Type2 get dynamicType => _dynamicType; | 4015 Type2 get dynamicType => _dynamicType; |
| 3982 InterfaceType get functionType => _functionType; | 4016 InterfaceType get functionType => _functionType; |
| 3983 InterfaceType get intType => _intType; | 4017 InterfaceType get intType => _intType; |
| 3984 InterfaceType get listType => _listType; | 4018 InterfaceType get listType => _listType; |
| 3985 InterfaceType get mapType => _mapType; | 4019 InterfaceType get mapType => _mapType; |
| 4020 InterfaceType get numType => _numType; |
| 3986 InterfaceType get objectType => _objectType; | 4021 InterfaceType get objectType => _objectType; |
| 3987 InterfaceType get stackTraceType => _stackTraceType; | 4022 InterfaceType get stackTraceType => _stackTraceType; |
| 3988 InterfaceType get stringType => _stringType; | 4023 InterfaceType get stringType => _stringType; |
| 3989 InterfaceType get typeType => _typeType; | 4024 InterfaceType get typeType => _typeType; |
| 3990 /** | 4025 /** |
| 3991 * Return the type with the given name from the given namespace, or {@code nul
l} if there is no | 4026 * Return the type with the given name from the given namespace, or {@code nul
l} if there is no |
| 3992 * class with the given name. | 4027 * class with the given name. |
| 3993 * @param namespace the namespace in which to search for the given name | 4028 * @param namespace the namespace in which to search for the given name |
| 3994 * @param typeName the name of the type being searched for | 4029 * @param typeName the name of the type being searched for |
| 3995 * @return the type that was found | 4030 * @return the type that was found |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4009 void initializeFrom(LibraryElement library) { | 4044 void initializeFrom(LibraryElement library) { |
| 4010 Namespace namespace = new NamespaceBuilder().createPublicNamespace(library); | 4045 Namespace namespace = new NamespaceBuilder().createPublicNamespace(library); |
| 4011 _boolType = getType(namespace, "bool"); | 4046 _boolType = getType(namespace, "bool"); |
| 4012 _bottomType = BottomTypeImpl.instance; | 4047 _bottomType = BottomTypeImpl.instance; |
| 4013 _doubleType = getType(namespace, "double"); | 4048 _doubleType = getType(namespace, "double"); |
| 4014 _dynamicType = DynamicTypeImpl.instance; | 4049 _dynamicType = DynamicTypeImpl.instance; |
| 4015 _functionType = getType(namespace, "Function"); | 4050 _functionType = getType(namespace, "Function"); |
| 4016 _intType = getType(namespace, "int"); | 4051 _intType = getType(namespace, "int"); |
| 4017 _listType = getType(namespace, "List"); | 4052 _listType = getType(namespace, "List"); |
| 4018 _mapType = getType(namespace, "Map"); | 4053 _mapType = getType(namespace, "Map"); |
| 4054 _numType = getType(namespace, "num"); |
| 4019 _objectType = getType(namespace, "Object"); | 4055 _objectType = getType(namespace, "Object"); |
| 4020 _stackTraceType = getType(namespace, "StackTrace"); | 4056 _stackTraceType = getType(namespace, "StackTrace"); |
| 4021 _stringType = getType(namespace, "String"); | 4057 _stringType = getType(namespace, "String"); |
| 4022 _typeType = getType(namespace, "Type"); | 4058 _typeType = getType(namespace, "Type"); |
| 4023 } | 4059 } |
| 4024 } | 4060 } |
| 4025 /** | 4061 /** |
| 4026 * Instances of the class {@code TypeResolverVisitor} are used to resolve the ty
pes associated with | 4062 * Instances of the class {@code TypeResolverVisitor} are used to resolve the ty
pes associated with |
| 4027 * the elements in the element model. This includes the types of superclasses, m
ixins, interfaces, | 4063 * the elements in the element model. This includes the types of superclasses, m
ixins, interfaces, |
| 4028 * fields, methods, parameters, and local variables. As a side-effect, this also
finishes building | 4064 * fields, methods, parameters, and local variables. As a side-effect, this also
finishes building |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4541 } | 4577 } |
| 4542 } | 4578 } |
| 4543 } | 4579 } |
| 4544 /** | 4580 /** |
| 4545 * Set the return type and parameter type information for the given function t
ype based on the | 4581 * Set the return type and parameter type information for the given function t
ype based on the |
| 4546 * given return type and parameter elements. | 4582 * given return type and parameter elements. |
| 4547 * @param functionType the function type to be filled in | 4583 * @param functionType the function type to be filled in |
| 4548 * @param returnType the return type of the function, or {@code null} if no ty
pe was declared | 4584 * @param returnType the return type of the function, or {@code null} if no ty
pe was declared |
| 4549 * @param parameters the elements representing the parameters to the function | 4585 * @param parameters the elements representing the parameters to the function |
| 4550 */ | 4586 */ |
| 4551 void setTypeInformation(FunctionTypeImpl functionType, TypeName returnType12,
List<ParameterElement> parameters) { | 4587 void setTypeInformation(FunctionTypeImpl functionType, TypeName returnType13,
List<ParameterElement> parameters) { |
| 4552 List<Type2> normalParameterTypes = new List<Type2>(); | 4588 List<Type2> normalParameterTypes = new List<Type2>(); |
| 4553 List<Type2> optionalParameterTypes = new List<Type2>(); | 4589 List<Type2> optionalParameterTypes = new List<Type2>(); |
| 4554 LinkedHashMap<String, Type2> namedParameterTypes = new LinkedHashMap<String,
Type2>(); | 4590 LinkedHashMap<String, Type2> namedParameterTypes = new LinkedHashMap<String,
Type2>(); |
| 4555 for (ParameterElement parameter in parameters) { | 4591 for (ParameterElement parameter in parameters) { |
| 4556 while (true) { | 4592 while (true) { |
| 4557 if (parameter.parameterKind == ParameterKind.REQUIRED) { | 4593 if (parameter.parameterKind == ParameterKind.REQUIRED) { |
| 4558 normalParameterTypes.add(parameter.type); | 4594 normalParameterTypes.add(parameter.type); |
| 4559 } else if (parameter.parameterKind == ParameterKind.POSITIONAL) { | 4595 } else if (parameter.parameterKind == ParameterKind.POSITIONAL) { |
| 4560 optionalParameterTypes.add(parameter.type); | 4596 optionalParameterTypes.add(parameter.type); |
| 4561 } else if (parameter.parameterKind == ParameterKind.NAMED) { | 4597 } else if (parameter.parameterKind == ParameterKind.NAMED) { |
| 4562 namedParameterTypes[parameter.name] = parameter.type; | 4598 namedParameterTypes[parameter.name] = parameter.type; |
| 4563 } | 4599 } |
| 4564 break; | 4600 break; |
| 4565 } | 4601 } |
| 4566 } | 4602 } |
| 4567 if (!normalParameterTypes.isEmpty) { | 4603 if (!normalParameterTypes.isEmpty) { |
| 4568 functionType.normalParameterTypes = new List.from(normalParameterTypes); | 4604 functionType.normalParameterTypes = new List.from(normalParameterTypes); |
| 4569 } | 4605 } |
| 4570 if (!optionalParameterTypes.isEmpty) { | 4606 if (!optionalParameterTypes.isEmpty) { |
| 4571 functionType.optionalParameterTypes = new List.from(optionalParameterTypes
); | 4607 functionType.optionalParameterTypes = new List.from(optionalParameterTypes
); |
| 4572 } | 4608 } |
| 4573 if (!namedParameterTypes.isEmpty) { | 4609 if (!namedParameterTypes.isEmpty) { |
| 4574 functionType.namedParameterTypes = namedParameterTypes; | 4610 functionType.namedParameterTypes = namedParameterTypes; |
| 4575 } | 4611 } |
| 4576 if (returnType12 == null) { | 4612 if (returnType13 == null) { |
| 4577 functionType.returnType = _dynamicType; | 4613 functionType.returnType = _dynamicType; |
| 4578 } else { | 4614 } else { |
| 4579 functionType.returnType = returnType12.type; | 4615 functionType.returnType = returnType13.type; |
| 4580 } | 4616 } |
| 4581 } | 4617 } |
| 4582 } | 4618 } |
| 4583 /** | 4619 /** |
| 4584 * Instances of the class {@code ClassScope} implement the scope defined by a cl
ass. | 4620 * Instances of the class {@code ClassScope} implement the scope defined by a cl
ass. |
| 4585 * @coverage dart.engine.resolver | 4621 * @coverage dart.engine.resolver |
| 4586 */ | 4622 */ |
| 4587 class ClassScope extends EnclosedScope { | 4623 class ClassScope extends EnclosedScope { |
| 4588 /** | 4624 /** |
| 4589 * Initialize a newly created scope enclosed within another scope. | 4625 * Initialize a newly created scope enclosed within another scope. |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4731 * The label element returned for scopes that can be the target of an unlabele
d {@code break} or{@code continue}. | 4767 * The label element returned for scopes that can be the target of an unlabele
d {@code break} or{@code continue}. |
| 4732 */ | 4768 */ |
| 4733 static SimpleIdentifier _EMPTY_LABEL_IDENTIFIER = new SimpleIdentifier.full(ne
w sc.StringToken(sc.TokenType.IDENTIFIER, "", 0)); | 4769 static SimpleIdentifier _EMPTY_LABEL_IDENTIFIER = new SimpleIdentifier.full(ne
w sc.StringToken(sc.TokenType.IDENTIFIER, "", 0)); |
| 4734 /** | 4770 /** |
| 4735 * Initialize a newly created scope to represent the potential target of an un
labeled{@code break} or {@code continue}. | 4771 * Initialize a newly created scope to represent the potential target of an un
labeled{@code break} or {@code continue}. |
| 4736 * @param outerScope the label scope enclosing the new label scope | 4772 * @param outerScope the label scope enclosing the new label scope |
| 4737 * @param onSwitchStatement {@code true} if this label is associated with a {@
code switch}statement | 4773 * @param onSwitchStatement {@code true} if this label is associated with a {@
code switch}statement |
| 4738 * @param onSwitchMember {@code true} if this label is associated with a {@cod
e switch} member | 4774 * @param onSwitchMember {@code true} if this label is associated with a {@cod
e switch} member |
| 4739 */ | 4775 */ |
| 4740 LabelScope.con1(LabelScope outerScope, bool onSwitchStatement, bool onSwitchMe
mber) { | 4776 LabelScope.con1(LabelScope outerScope, bool onSwitchStatement, bool onSwitchMe
mber) { |
| 4741 _jtd_constructor_248_impl(outerScope, onSwitchStatement, onSwitchMember); | 4777 _jtd_constructor_250_impl(outerScope, onSwitchStatement, onSwitchMember); |
| 4742 } | 4778 } |
| 4743 _jtd_constructor_248_impl(LabelScope outerScope, bool onSwitchStatement, bool
onSwitchMember) { | 4779 _jtd_constructor_250_impl(LabelScope outerScope, bool onSwitchStatement, bool
onSwitchMember) { |
| 4744 _jtd_constructor_249_impl(outerScope, EMPTY_LABEL, new LabelElementImpl(_EMP
TY_LABEL_IDENTIFIER, onSwitchStatement, onSwitchMember)); | 4780 _jtd_constructor_251_impl(outerScope, EMPTY_LABEL, new LabelElementImpl(_EMP
TY_LABEL_IDENTIFIER, onSwitchStatement, onSwitchMember)); |
| 4745 } | 4781 } |
| 4746 /** | 4782 /** |
| 4747 * Initialize a newly created scope to represent the given label. | 4783 * Initialize a newly created scope to represent the given label. |
| 4748 * @param outerScope the label scope enclosing the new label scope | 4784 * @param outerScope the label scope enclosing the new label scope |
| 4749 * @param label the label defined in this scope | 4785 * @param label the label defined in this scope |
| 4750 * @param element the element to which the label resolves | 4786 * @param element the element to which the label resolves |
| 4751 */ | 4787 */ |
| 4752 LabelScope.con2(LabelScope outerScope2, String label4, LabelElement element19)
{ | 4788 LabelScope.con2(LabelScope outerScope2, String label4, LabelElement element19)
{ |
| 4753 _jtd_constructor_249_impl(outerScope2, label4, element19); | 4789 _jtd_constructor_251_impl(outerScope2, label4, element19); |
| 4754 } | 4790 } |
| 4755 _jtd_constructor_249_impl(LabelScope outerScope2, String label4, LabelElement
element19) { | 4791 _jtd_constructor_251_impl(LabelScope outerScope2, String label4, LabelElement
element19) { |
| 4756 this._outerScope = outerScope2; | 4792 this._outerScope = outerScope2; |
| 4757 this._label = label4; | 4793 this._label = label4; |
| 4758 this._element = element19; | 4794 this._element = element19; |
| 4759 } | 4795 } |
| 4760 /** | 4796 /** |
| 4761 * Return the label element corresponding to the given label, or {@code null}
if the given label | 4797 * Return the label element corresponding to the given label, or {@code null}
if the given label |
| 4762 * is not defined in this scope. | 4798 * is not defined in this scope. |
| 4763 * @param targetLabel the label being looked up | 4799 * @param targetLabel the label being looked up |
| 4764 * @return the label element corresponding to the given label | 4800 * @return the label element corresponding to the given label |
| 4765 */ | 4801 */ |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5346 } | 5382 } |
| 5347 } | 5383 } |
| 5348 } | 5384 } |
| 5349 return result; | 5385 return result; |
| 5350 } | 5386 } |
| 5351 /** | 5387 /** |
| 5352 * Validate that the default value associated with each of the parameters in t
he given list is a | 5388 * Validate that the default value associated with each of the parameters in t
he given list is a |
| 5353 * compile time constant. | 5389 * compile time constant. |
| 5354 * @param parameters the list of parameters to be validated | 5390 * @param parameters the list of parameters to be validated |
| 5355 */ | 5391 */ |
| 5356 void validateDefaultValues(FormalParameterList parameters14) { | 5392 void validateDefaultValues(FormalParameterList parameters15) { |
| 5357 if (parameters14 == null) { | 5393 if (parameters15 == null) { |
| 5358 return; | 5394 return; |
| 5359 } | 5395 } |
| 5360 for (FormalParameter parameter in parameters14.parameters) { | 5396 for (FormalParameter parameter in parameters15.parameters) { |
| 5361 if (parameter is DefaultFormalParameter) { | 5397 if (parameter is DefaultFormalParameter) { |
| 5362 DefaultFormalParameter defaultParameter = parameter as DefaultFormalPara
meter; | 5398 DefaultFormalParameter defaultParameter = parameter as DefaultFormalPara
meter; |
| 5363 Expression defaultValue2 = defaultParameter.defaultValue; | 5399 Expression defaultValue2 = defaultParameter.defaultValue; |
| 5364 if (defaultValue2 != null) { | 5400 if (defaultValue2 != null) { |
| 5365 EvaluationResultImpl result = validate(defaultValue2, CompileTimeError
Code.NON_CONSTANT_DEFAULT_VALUE); | 5401 EvaluationResultImpl result = validate(defaultValue2, CompileTimeError
Code.NON_CONSTANT_DEFAULT_VALUE); |
| 5366 if (defaultParameter.isConst()) { | 5402 if (defaultParameter.isConst()) { |
| 5367 VariableElementImpl element46 = parameter.element as VariableElement
Impl; | 5403 VariableElementImpl element46 = parameter.element as VariableElement
Impl; |
| 5368 element46.evaluationResult = result; | 5404 element46.evaluationResult = result; |
| 5369 } | 5405 } |
| 5370 } | 5406 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 5388 LibraryElement _currentLibrary; | 5424 LibraryElement _currentLibrary; |
| 5389 /** | 5425 /** |
| 5390 * The type representing the type 'dynamic'. | 5426 * The type representing the type 'dynamic'. |
| 5391 */ | 5427 */ |
| 5392 Type2 _dynamicType; | 5428 Type2 _dynamicType; |
| 5393 /** | 5429 /** |
| 5394 * The object providing access to the types defined by the language. | 5430 * The object providing access to the types defined by the language. |
| 5395 */ | 5431 */ |
| 5396 TypeProvider _typeProvider; | 5432 TypeProvider _typeProvider; |
| 5397 /** | 5433 /** |
| 5434 * This is set to <code>true</code> iff the visitor is currently visiting chil
dren nodes of a{@link ConstructorDeclaration} and the constructor is 'const'. |
| 5435 * @see #visitConstructorDeclaration(ConstructorDeclaration) |
| 5436 */ |
| 5437 bool _isEnclosingConstructorConst = false; |
| 5438 /** |
| 5398 * The method or function that we are currently visiting, or {@code null} if w
e are not inside a | 5439 * The method or function that we are currently visiting, or {@code null} if w
e are not inside a |
| 5399 * method or function. | 5440 * method or function. |
| 5400 */ | 5441 */ |
| 5401 ExecutableElement _currentFunction; | 5442 ExecutableElement _currentFunction; |
| 5443 /** |
| 5444 * A list of types used by the {@link CompileTimeErrorCode#EXTENDS_DISALLOWED_
CLASS} and{@link CompileTimeErrorCode#IMPLEMENTS_DISALLOWED_CLASS} error codes. |
| 5445 */ |
| 5446 List<InterfaceType> _DISALLOWED_TYPES_TO_EXTEND_OR_IMPLEMENT; |
| 5402 ErrorVerifier(ErrorReporter errorReporter, LibraryElement currentLibrary, Type
Provider typeProvider) { | 5447 ErrorVerifier(ErrorReporter errorReporter, LibraryElement currentLibrary, Type
Provider typeProvider) { |
| 5403 this._errorReporter = errorReporter; | 5448 this._errorReporter = errorReporter; |
| 5404 this._currentLibrary = currentLibrary; | 5449 this._currentLibrary = currentLibrary; |
| 5405 this._typeProvider = typeProvider; | 5450 this._typeProvider = typeProvider; |
| 5451 _isEnclosingConstructorConst = false; |
| 5406 _dynamicType = typeProvider.dynamicType; | 5452 _dynamicType = typeProvider.dynamicType; |
| 5453 _DISALLOWED_TYPES_TO_EXTEND_OR_IMPLEMENT = <InterfaceType> [typeProvider.num
Type, typeProvider.intType, typeProvider.doubleType, typeProvider.boolType, type
Provider.stringType]; |
| 5407 } | 5454 } |
| 5408 Object visitArgumentDefinitionTest(ArgumentDefinitionTest node) { | 5455 Object visitArgumentDefinitionTest(ArgumentDefinitionTest node) { |
| 5409 checkForArgumentDefinitionTestNonParameter(node); | 5456 checkForArgumentDefinitionTestNonParameter(node); |
| 5410 return super.visitArgumentDefinitionTest(node); | 5457 return super.visitArgumentDefinitionTest(node); |
| 5411 } | 5458 } |
| 5412 Object visitAssertStatement(AssertStatement node) { | 5459 Object visitAssertStatement(AssertStatement node) { |
| 5413 checkForNonBoolExpression(node); | 5460 checkForNonBoolExpression(node); |
| 5414 return super.visitAssertStatement(node); | 5461 return super.visitAssertStatement(node); |
| 5415 } | 5462 } |
| 5416 Object visitAssignmentExpression(AssignmentExpression node) { | 5463 Object visitAssignmentExpression(AssignmentExpression node) { |
| 5417 checkForInvalidAssignment(node); | 5464 checkForInvalidAssignment(node); |
| 5418 return super.visitAssignmentExpression(node); | 5465 return super.visitAssignmentExpression(node); |
| 5419 } | 5466 } |
| 5420 Object visitClassDeclaration(ClassDeclaration node) { | 5467 Object visitClassDeclaration(ClassDeclaration node) { |
| 5421 checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDE
NTIFIER_AS_TYPE_NAME); | 5468 checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDE
NTIFIER_AS_TYPE_NAME); |
| 5422 return super.visitClassDeclaration(node); | 5469 return super.visitClassDeclaration(node); |
| 5423 } | 5470 } |
| 5424 Object visitClassTypeAlias(ClassTypeAlias node) { | 5471 Object visitClassTypeAlias(ClassTypeAlias node) { |
| 5425 checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDE
NTIFIER_AS_TYPEDEF_NAME); | 5472 checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDE
NTIFIER_AS_TYPEDEF_NAME); |
| 5426 return super.visitClassTypeAlias(node); | 5473 return super.visitClassTypeAlias(node); |
| 5427 } | 5474 } |
| 5428 Object visitConditionalExpression(ConditionalExpression node) { | 5475 Object visitConditionalExpression(ConditionalExpression node) { |
| 5429 checkForNonBoolCondition(node.condition); | 5476 checkForNonBoolCondition(node.condition); |
| 5430 return super.visitConditionalExpression(node); | 5477 return super.visitConditionalExpression(node); |
| 5431 } | 5478 } |
| 5432 Object visitConstructorDeclaration(ConstructorDeclaration node) { | 5479 Object visitConstructorDeclaration(ConstructorDeclaration node) { |
| 5433 ExecutableElement previousFunction = _currentFunction; | 5480 ExecutableElement previousFunction = _currentFunction; |
| 5434 try { | 5481 try { |
| 5435 _currentFunction = node.element; | 5482 _currentFunction = node.element; |
| 5483 _isEnclosingConstructorConst = node.constKeyword != null; |
| 5436 checkForConstConstructorWithNonFinalField(node); | 5484 checkForConstConstructorWithNonFinalField(node); |
| 5437 checkForConflictingConstructorNameAndMember(node); | 5485 checkForConflictingConstructorNameAndMember(node); |
| 5438 return super.visitConstructorDeclaration(node); | 5486 return super.visitConstructorDeclaration(node); |
| 5439 } finally { | 5487 } finally { |
| 5488 _isEnclosingConstructorConst = false; |
| 5440 _currentFunction = previousFunction; | 5489 _currentFunction = previousFunction; |
| 5441 } | 5490 } |
| 5442 } | 5491 } |
| 5443 Object visitDoStatement(DoStatement node) { | 5492 Object visitDoStatement(DoStatement node) { |
| 5444 checkForNonBoolCondition(node.condition); | 5493 checkForNonBoolCondition(node.condition); |
| 5445 return super.visitDoStatement(node); | 5494 return super.visitDoStatement(node); |
| 5446 } | 5495 } |
| 5496 Object visitExtendsClause(ExtendsClause node) { |
| 5497 checkForExtendsDisallowedClass(node); |
| 5498 return super.visitExtendsClause(node); |
| 5499 } |
| 5447 Object visitFieldFormalParameter(FieldFormalParameter node) { | 5500 Object visitFieldFormalParameter(FieldFormalParameter node) { |
| 5448 checkForConstFormalParameter(node); | 5501 checkForConstFormalParameter(node); |
| 5449 return super.visitFieldFormalParameter(node); | 5502 return super.visitFieldFormalParameter(node); |
| 5450 } | 5503 } |
| 5451 Object visitFunctionDeclaration(FunctionDeclaration node) { | 5504 Object visitFunctionDeclaration(FunctionDeclaration node) { |
| 5452 ExecutableElement previousFunction = _currentFunction; | 5505 ExecutableElement previousFunction = _currentFunction; |
| 5453 try { | 5506 try { |
| 5454 _currentFunction = node.element; | 5507 _currentFunction = node.element; |
| 5455 return super.visitFunctionDeclaration(node); | 5508 return super.visitFunctionDeclaration(node); |
| 5456 } finally { | 5509 } finally { |
| 5457 _currentFunction = previousFunction; | 5510 _currentFunction = previousFunction; |
| 5458 } | 5511 } |
| 5459 } | 5512 } |
| 5460 Object visitFunctionExpression(FunctionExpression node) { | 5513 Object visitFunctionExpression(FunctionExpression node) { |
| 5461 ExecutableElement previousFunction = _currentFunction; | 5514 ExecutableElement previousFunction = _currentFunction; |
| 5462 try { | 5515 try { |
| 5463 _currentFunction = node.element; | 5516 _currentFunction = node.element; |
| 5464 return super.visitFunctionExpression(node); | 5517 return super.visitFunctionExpression(node); |
| 5465 } finally { | 5518 } finally { |
| 5466 _currentFunction = previousFunction; | 5519 _currentFunction = previousFunction; |
| 5467 } | 5520 } |
| 5468 } | 5521 } |
| 5469 Object visitFunctionTypeAlias(FunctionTypeAlias node) { | 5522 Object visitFunctionTypeAlias(FunctionTypeAlias node) { |
| 5470 checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDE
NTIFIER_AS_TYPEDEF_NAME); | 5523 checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDE
NTIFIER_AS_TYPEDEF_NAME); |
| 5524 checkForDefaultValueInFunctionTypeAlias(node); |
| 5471 return super.visitFunctionTypeAlias(node); | 5525 return super.visitFunctionTypeAlias(node); |
| 5472 } | 5526 } |
| 5473 Object visitIfStatement(IfStatement node) { | 5527 Object visitIfStatement(IfStatement node) { |
| 5474 checkForNonBoolCondition(node.condition); | 5528 checkForNonBoolCondition(node.condition); |
| 5475 return super.visitIfStatement(node); | 5529 return super.visitIfStatement(node); |
| 5476 } | 5530 } |
| 5531 Object visitImplementsClause(ImplementsClause node) { |
| 5532 checkForImplementsDisallowedClass(node); |
| 5533 return super.visitImplementsClause(node); |
| 5534 } |
| 5477 Object visitInstanceCreationExpression(InstanceCreationExpression node) { | 5535 Object visitInstanceCreationExpression(InstanceCreationExpression node) { |
| 5478 ConstructorName constructorName4 = node.constructorName; | 5536 ConstructorName constructorName4 = node.constructorName; |
| 5479 TypeName typeName = constructorName4.type; | 5537 TypeName typeName = constructorName4.type; |
| 5480 Type2 type20 = typeName.type; | 5538 Type2 type20 = typeName.type; |
| 5481 if (type20 is InterfaceType) { | 5539 if (type20 is InterfaceType) { |
| 5482 InterfaceType interfaceType = type20 as InterfaceType; | 5540 InterfaceType interfaceType = type20 as InterfaceType; |
| 5483 checkForConstWithNonConst(node); | 5541 checkForConstWithNonConst(node); |
| 5484 checkForConstOrNewWithAbstractClass(node, typeName, interfaceType); | 5542 checkForConstOrNewWithAbstractClass(node, typeName, interfaceType); |
| 5485 checkForTypeArgumentNotMatchingBounds(node, constructorName4.element, type
Name); | 5543 checkForTypeArgumentNotMatchingBounds(node, constructorName4.element, type
Name); |
| 5486 } | 5544 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 5500 return super.visitReturnStatement(node); | 5558 return super.visitReturnStatement(node); |
| 5501 } | 5559 } |
| 5502 Object visitSimpleFormalParameter(SimpleFormalParameter node) { | 5560 Object visitSimpleFormalParameter(SimpleFormalParameter node) { |
| 5503 checkForConstFormalParameter(node); | 5561 checkForConstFormalParameter(node); |
| 5504 return super.visitSimpleFormalParameter(node); | 5562 return super.visitSimpleFormalParameter(node); |
| 5505 } | 5563 } |
| 5506 Object visitSwitchStatement(SwitchStatement node) { | 5564 Object visitSwitchStatement(SwitchStatement node) { |
| 5507 checkForCaseExpressionTypeImplementsEquals(node); | 5565 checkForCaseExpressionTypeImplementsEquals(node); |
| 5508 return super.visitSwitchStatement(node); | 5566 return super.visitSwitchStatement(node); |
| 5509 } | 5567 } |
| 5568 Object visitThrowExpression(ThrowExpression node) { |
| 5569 checkForConstEvalThrowsException(node); |
| 5570 return super.visitThrowExpression(node); |
| 5571 } |
| 5510 Object visitTypeParameter(TypeParameter node) { | 5572 Object visitTypeParameter(TypeParameter node) { |
| 5511 checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDE
NTIFIER_AS_TYPE_VARIABLE_NAME); | 5573 checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDE
NTIFIER_AS_TYPE_VARIABLE_NAME); |
| 5512 return super.visitTypeParameter(node); | 5574 return super.visitTypeParameter(node); |
| 5513 } | 5575 } |
| 5514 Object visitVariableDeclarationList(VariableDeclarationList node) { | 5576 Object visitVariableDeclarationList(VariableDeclarationList node) { |
| 5515 checkForBuiltInIdentifierAsName2(node); | 5577 checkForBuiltInIdentifierAsName2(node); |
| 5516 return super.visitVariableDeclarationList(node); | 5578 return super.visitVariableDeclarationList(node); |
| 5517 } | 5579 } |
| 5518 Object visitWhileStatement(WhileStatement node) { | 5580 Object visitWhileStatement(WhileStatement node) { |
| 5519 checkForNonBoolCondition(node.condition); | 5581 checkForNonBoolCondition(node.condition); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5623 return false; | 5685 return false; |
| 5624 } | 5686 } |
| 5625 /** | 5687 /** |
| 5626 * This verifies that the passed constructor declaration is not 'const' if it
has a non-final | 5688 * This verifies that the passed constructor declaration is not 'const' if it
has a non-final |
| 5627 * instance variable. | 5689 * instance variable. |
| 5628 * @param node the instance creation expression to evaluate | 5690 * @param node the instance creation expression to evaluate |
| 5629 * @return return <code>true</code> if and only if an error code is generated
on the passed node | 5691 * @return return <code>true</code> if and only if an error code is generated
on the passed node |
| 5630 * @see CompileTimeErrorCode#CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD | 5692 * @see CompileTimeErrorCode#CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD |
| 5631 */ | 5693 */ |
| 5632 bool checkForConstConstructorWithNonFinalField(ConstructorDeclaration node) { | 5694 bool checkForConstConstructorWithNonFinalField(ConstructorDeclaration node) { |
| 5633 if (node.constKeyword == null) { | 5695 if (!_isEnclosingConstructorConst) { |
| 5634 return false; | 5696 return false; |
| 5635 } | 5697 } |
| 5636 ConstructorElement constructorElement = node.element; | 5698 ConstructorElement constructorElement = node.element; |
| 5637 if (constructorElement != null) { | 5699 if (constructorElement != null) { |
| 5638 ClassElement classElement = constructorElement.enclosingElement; | 5700 ClassElement classElement = constructorElement.enclosingElement; |
| 5639 List<FieldElement> elements = classElement.fields; | 5701 List<FieldElement> elements = classElement.fields; |
| 5640 for (FieldElement field in elements) { | 5702 for (FieldElement field in elements) { |
| 5641 if (!field.isFinal() && !field.isConst() && !field.isSynthetic()) { | 5703 if (!field.isFinal() && !field.isConst() && !field.isSynthetic()) { |
| 5642 _errorReporter.reportError(CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH
_NON_FINAL_FIELD, node, []); | 5704 _errorReporter.reportError(CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH
_NON_FINAL_FIELD, node, []); |
| 5643 return true; | 5705 return true; |
| 5644 } | 5706 } |
| 5645 } | 5707 } |
| 5646 } | 5708 } |
| 5647 return false; | 5709 return false; |
| 5648 } | 5710 } |
| 5649 /** | 5711 /** |
| 5712 * This verifies that the passed throw expression is not enclosed in a 'const'
constructor |
| 5713 * declaration. |
| 5714 * @param node the throw expression expression to evaluate |
| 5715 * @return return <code>true</code> if and only if an error code is generated
on the passed node |
| 5716 * @see CompileTimeErrorCode#CONST_EVAL_THROWS_EXCEPTION |
| 5717 */ |
| 5718 bool checkForConstEvalThrowsException(ThrowExpression node) { |
| 5719 if (_isEnclosingConstructorConst) { |
| 5720 _errorReporter.reportError(CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTIO
N, node, []); |
| 5721 return true; |
| 5722 } |
| 5723 return false; |
| 5724 } |
| 5725 /** |
| 5650 * This verifies that the passed normal formal parameter is not 'const'. | 5726 * This verifies that the passed normal formal parameter is not 'const'. |
| 5651 * @param node the normal formal parameter to evaluate | 5727 * @param node the normal formal parameter to evaluate |
| 5652 * @return return <code>true</code> if and only if an error code is generated
on the passed node | 5728 * @return return <code>true</code> if and only if an error code is generated
on the passed node |
| 5653 * @see CompileTimeErrorCode#CONST_FORMAL_PARAMETER | 5729 * @see CompileTimeErrorCode#CONST_FORMAL_PARAMETER |
| 5654 */ | 5730 */ |
| 5655 bool checkForConstFormalParameter(NormalFormalParameter node) { | 5731 bool checkForConstFormalParameter(NormalFormalParameter node) { |
| 5656 if (node.isConst()) { | 5732 if (node.isConst()) { |
| 5657 _errorReporter.reportError(CompileTimeErrorCode.CONST_FORMAL_PARAMETER, no
de, []); | 5733 _errorReporter.reportError(CompileTimeErrorCode.CONST_FORMAL_PARAMETER, no
de, []); |
| 5658 return true; | 5734 return true; |
| 5659 } | 5735 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 5684 return false; | 5760 return false; |
| 5685 } | 5761 } |
| 5686 /** | 5762 /** |
| 5687 * This verifies that if the passed instance creation expression is 'const', t
hen it is not being | 5763 * This verifies that if the passed instance creation expression is 'const', t
hen it is not being |
| 5688 * invoked on a constructor that is not 'const'. | 5764 * invoked on a constructor that is not 'const'. |
| 5689 * @param node the instance creation expression to evaluate | 5765 * @param node the instance creation expression to evaluate |
| 5690 * @return return <code>true</code> if and only if an error code is generated
on the passed node | 5766 * @return return <code>true</code> if and only if an error code is generated
on the passed node |
| 5691 * @see CompileTimeErrorCode#CONST_WITH_NON_CONST | 5767 * @see CompileTimeErrorCode#CONST_WITH_NON_CONST |
| 5692 */ | 5768 */ |
| 5693 bool checkForConstWithNonConst(InstanceCreationExpression node) { | 5769 bool checkForConstWithNonConst(InstanceCreationExpression node) { |
| 5694 if (node.isConst() && !node.element.isConst()) { | 5770 ConstructorElement constructorElement = node.element; |
| 5771 if (node.isConst() && constructorElement != null && !constructorElement.isCo
nst()) { |
| 5695 _errorReporter.reportError(CompileTimeErrorCode.CONST_WITH_NON_CONST, node
, []); | 5772 _errorReporter.reportError(CompileTimeErrorCode.CONST_WITH_NON_CONST, node
, []); |
| 5696 return true; | 5773 return true; |
| 5697 } | 5774 } |
| 5698 return false; | 5775 return false; |
| 5699 } | 5776 } |
| 5700 /** | 5777 /** |
| 5778 * This verifies that there are no default parameters in the passed function t
ype alias. |
| 5779 * @param node the function type alias to evaluate |
| 5780 * @return return <code>true</code> if and only if an error code is generated
on the passed node |
| 5781 * @see CompileTimeErrorCode#DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS |
| 5782 */ |
| 5783 bool checkForDefaultValueInFunctionTypeAlias(FunctionTypeAlias node) { |
| 5784 bool result = false; |
| 5785 FormalParameterList formalParameterList = node.parameters; |
| 5786 NodeList<FormalParameter> parameters13 = formalParameterList.parameters; |
| 5787 for (FormalParameter formalParameter in parameters13) { |
| 5788 if (formalParameter is DefaultFormalParameter) { |
| 5789 DefaultFormalParameter defaultFormalParameter = formalParameter as Defau
ltFormalParameter; |
| 5790 if (defaultFormalParameter.defaultValue != null) { |
| 5791 _errorReporter.reportError(CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCT
ION_TYPE_ALIAS, node, []); |
| 5792 result = true; |
| 5793 } |
| 5794 } |
| 5795 } |
| 5796 return result; |
| 5797 } |
| 5798 /** |
| 5799 * This verifies that the passed extends clause does not extend classes such a
s num or String. |
| 5800 * @param node the extends clause to test |
| 5801 * @return return <code>true</code> if and only if an error code is generated
on the passed node |
| 5802 * @see CompileTimeErrorCode#EXTENDS_DISALLOWED_CLASS |
| 5803 */ |
| 5804 bool checkForExtendsDisallowedClass(ExtendsClause extendsClause) => checkForEx
tendsOrImplementsDisallowedClass(extendsClause.superclass, CompileTimeErrorCode.
EXTENDS_DISALLOWED_CLASS); |
| 5805 /** |
| 5806 * This verifies that the passed type name does not extend or implement classe
s such as 'num' or |
| 5807 * 'String'. |
| 5808 * @param node the type name to test |
| 5809 * @return return <code>true</code> if and only if an error code is generated
on the passed node |
| 5810 * @see #checkForExtendsDisallowedClass(ExtendsClause) |
| 5811 * @see #checkForImplementsDisallowedClass(ImplementsClause) |
| 5812 * @see CompileTimeErrorCode#EXTENDS_DISALLOWED_CLASS |
| 5813 * @see CompileTimeErrorCode#IMPLEMENTS_DISALLOWED_CLASS |
| 5814 */ |
| 5815 bool checkForExtendsOrImplementsDisallowedClass(TypeName typeName, ErrorCode e
rrorCode) { |
| 5816 if (typeName.isSynthetic()) { |
| 5817 return false; |
| 5818 } |
| 5819 Type2 superType = typeName.type; |
| 5820 for (InterfaceType disallowedType in _DISALLOWED_TYPES_TO_EXTEND_OR_IMPLEMEN
T) { |
| 5821 if (superType == disallowedType) { |
| 5822 if (superType == _typeProvider.numType) { |
| 5823 ASTNode grandParent = typeName.parent.parent; |
| 5824 if (grandParent is ClassDeclaration) { |
| 5825 ClassElement classElement = ((grandParent as ClassDeclaration)).elem
ent; |
| 5826 Type2 classType = classElement.type; |
| 5827 if (classType != null && (classType == _typeProvider.intType || clas
sType == _typeProvider.doubleType)) { |
| 5828 return false; |
| 5829 } |
| 5830 } |
| 5831 } |
| 5832 _errorReporter.reportError(errorCode, typeName, [disallowedType.name]); |
| 5833 return true; |
| 5834 } |
| 5835 } |
| 5836 return false; |
| 5837 } |
| 5838 /** |
| 5839 * This verifies that the passed implements clause does not implement classes
such as 'num' or |
| 5840 * 'String'. |
| 5841 * @param node the implements clause to test |
| 5842 * @return return <code>true</code> if and only if an error code is generated
on the passed node |
| 5843 * @see CompileTimeErrorCode#IMPLEMENTS_DISALLOWED_CLASS |
| 5844 */ |
| 5845 bool checkForImplementsDisallowedClass(ImplementsClause implementsClause) { |
| 5846 bool result = false; |
| 5847 for (TypeName type in implementsClause.interfaces) { |
| 5848 result = javaBooleanOr(result, checkForExtendsOrImplementsDisallowedClass(
type, CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS)); |
| 5849 ; |
| 5850 } |
| 5851 return result; |
| 5852 } |
| 5853 /** |
| 5701 * This verifies that the passed assignment expression represents a valid assi
gnment. | 5854 * This verifies that the passed assignment expression represents a valid assi
gnment. |
| 5702 * @param node the assignment expression to evaluate | 5855 * @param node the assignment expression to evaluate |
| 5703 * @return return <code>true</code> if and only if an error code is generated
on the passed node | 5856 * @return return <code>true</code> if and only if an error code is generated
on the passed node |
| 5704 * @see StaticTypeWarningCode#INVALID_ASSIGNMENT | 5857 * @see StaticTypeWarningCode#INVALID_ASSIGNMENT |
| 5705 */ | 5858 */ |
| 5706 bool checkForInvalidAssignment(AssignmentExpression node) { | 5859 bool checkForInvalidAssignment(AssignmentExpression node) { |
| 5707 Expression lhs = node.leftHandSide; | 5860 Expression lhs = node.leftHandSide; |
| 5708 Expression rhs = node.rightHandSide; | 5861 Expression rhs = node.rightHandSide; |
| 5709 Type2 leftType = getType(lhs); | 5862 Type2 leftType = getType(lhs); |
| 5710 Type2 rightType = getType(rhs); | 5863 Type2 rightType = getType(rhs); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5844 ResolverErrorCode(this.__name, this.__ordinal, ErrorType type, String message)
{ | 5997 ResolverErrorCode(this.__name, this.__ordinal, ErrorType type, String message)
{ |
| 5845 this._type = type; | 5998 this._type = type; |
| 5846 this._message = message; | 5999 this._message = message; |
| 5847 } | 6000 } |
| 5848 ErrorSeverity get errorSeverity => _type.severity; | 6001 ErrorSeverity get errorSeverity => _type.severity; |
| 5849 String get message => _message; | 6002 String get message => _message; |
| 5850 ErrorType get type => _type; | 6003 ErrorType get type => _type; |
| 5851 bool needsRecompilation() => true; | 6004 bool needsRecompilation() => true; |
| 5852 String toString() => __name; | 6005 String toString() => __name; |
| 5853 } | 6006 } |
| OLD | NEW |