| 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 10784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10795 | 10795 |
| 10796 /** | 10796 /** |
| 10797 * This is set to `true` iff the visitor is currently visiting children nodes
of a | 10797 * This is set to `true` iff the visitor is currently visiting children nodes
of a |
| 10798 * [CatchClause]. | 10798 * [CatchClause]. |
| 10799 * | 10799 * |
| 10800 * @see #visitCatchClause(CatchClause) | 10800 * @see #visitCatchClause(CatchClause) |
| 10801 */ | 10801 */ |
| 10802 bool _isInCatchClause = false; | 10802 bool _isInCatchClause = false; |
| 10803 | 10803 |
| 10804 /** | 10804 /** |
| 10805 * This is set to `true` iff the visitor is currently visiting a static variab
le |
| 10806 * declaration. |
| 10807 */ |
| 10808 bool _isInStaticVariableDeclaration = false; |
| 10809 |
| 10810 /** |
| 10805 * This is set to `true` iff the visitor is currently visiting an instance var
iable | 10811 * This is set to `true` iff the visitor is currently visiting an instance var
iable |
| 10806 * declaration. | 10812 * declaration. |
| 10807 */ | 10813 */ |
| 10808 bool _isInInstanceVariableDeclaration = false; | 10814 bool _isInInstanceVariableDeclaration = false; |
| 10809 | 10815 |
| 10810 /** | 10816 /** |
| 10811 * This is set to `true` iff the visitor is currently visiting an instance var
iable | 10817 * This is set to `true` iff the visitor is currently visiting an instance var
iable |
| 10812 * initializer. | 10818 * initializer. |
| 10813 */ | 10819 */ |
| 10814 bool _isInInstanceVariableInitializer = false; | 10820 bool _isInInstanceVariableInitializer = false; |
| 10815 | 10821 |
| 10816 /** | 10822 /** |
| 10817 * This is set to `true` iff the visitor is currently visiting a | 10823 * This is set to `true` iff the visitor is currently visiting a |
| 10818 * [ConstructorInitializer]. | 10824 * [ConstructorInitializer]. |
| 10819 */ | 10825 */ |
| 10820 bool _isInConstructorInitializer = false; | 10826 bool _isInConstructorInitializer = false; |
| 10821 | 10827 |
| 10822 /** | 10828 /** |
| 10823 * This is set to `true` iff the visitor is currently visiting a static method
. | 10829 * This is set to `true` iff the visitor is currently visiting a static method
. By "method" |
| 10830 * here getter, setter and operator declarations are also implied since they a
re all represented |
| 10831 * with a [MethodDeclaration] in the AST structure. |
| 10824 */ | 10832 */ |
| 10825 bool _isInStaticMethod = false; | 10833 bool _isInStaticMethod = false; |
| 10826 | 10834 |
| 10827 /** | 10835 /** |
| 10828 * This is set to `true` iff the visitor is currently visiting code in the SDK
. | 10836 * This is set to `true` iff the visitor is currently visiting code in the SDK
. |
| 10829 */ | 10837 */ |
| 10830 bool _isInSystemLibrary = false; | 10838 bool _isInSystemLibrary = false; |
| 10831 | 10839 |
| 10832 /** | 10840 /** |
| 10833 * The class containing the AST nodes being visited, or `null` if we are not i
n the scope of | 10841 * The class containing the AST nodes being visited, or `null` if we are not i
n the scope of |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10884 List<InterfaceType> _DISALLOWED_TYPES_TO_EXTEND_OR_IMPLEMENT; | 10892 List<InterfaceType> _DISALLOWED_TYPES_TO_EXTEND_OR_IMPLEMENT; |
| 10885 ErrorVerifier(ErrorReporter errorReporter, LibraryElement currentLibrary, Type
Provider typeProvider, InheritanceManager inheritanceManager) { | 10893 ErrorVerifier(ErrorReporter errorReporter, LibraryElement currentLibrary, Type
Provider typeProvider, InheritanceManager inheritanceManager) { |
| 10886 this._errorReporter = errorReporter; | 10894 this._errorReporter = errorReporter; |
| 10887 this._currentLibrary = currentLibrary; | 10895 this._currentLibrary = currentLibrary; |
| 10888 this._isInSystemLibrary = currentLibrary.source.isInSystemLibrary; | 10896 this._isInSystemLibrary = currentLibrary.source.isInSystemLibrary; |
| 10889 this._typeProvider = typeProvider; | 10897 this._typeProvider = typeProvider; |
| 10890 this._inheritanceManager = inheritanceManager; | 10898 this._inheritanceManager = inheritanceManager; |
| 10891 _strictMode = currentLibrary.context.analysisOptions.strictMode; | 10899 _strictMode = currentLibrary.context.analysisOptions.strictMode; |
| 10892 _isEnclosingConstructorConst = false; | 10900 _isEnclosingConstructorConst = false; |
| 10893 _isInCatchClause = false; | 10901 _isInCatchClause = false; |
| 10902 _isInStaticVariableDeclaration = false; |
| 10903 _isInInstanceVariableDeclaration = false; |
| 10904 _isInInstanceVariableInitializer = false; |
| 10905 _isInConstructorInitializer = false; |
| 10906 _isInStaticMethod = false; |
| 10894 _dynamicType = typeProvider.dynamicType; | 10907 _dynamicType = typeProvider.dynamicType; |
| 10895 _DISALLOWED_TYPES_TO_EXTEND_OR_IMPLEMENT = <InterfaceType> [typeProvider.num
Type, typeProvider.intType, typeProvider.doubleType, typeProvider.boolType, type
Provider.stringType]; | 10908 _DISALLOWED_TYPES_TO_EXTEND_OR_IMPLEMENT = <InterfaceType> [typeProvider.num
Type, typeProvider.intType, typeProvider.doubleType, typeProvider.boolType, type
Provider.stringType]; |
| 10896 } | 10909 } |
| 10897 Object visitArgumentDefinitionTest(ArgumentDefinitionTest node) { | 10910 Object visitArgumentDefinitionTest(ArgumentDefinitionTest node) { |
| 10898 checkForArgumentDefinitionTestNonParameter(node); | 10911 checkForArgumentDefinitionTestNonParameter(node); |
| 10899 return super.visitArgumentDefinitionTest(node); | 10912 return super.visitArgumentDefinitionTest(node); |
| 10900 } | 10913 } |
| 10901 Object visitArgumentList(ArgumentList node) { | 10914 Object visitArgumentList(ArgumentList node) { |
| 10902 checkForArgumentTypeNotAssignable(node); | 10915 checkForArgumentTypeNotAssignable(node); |
| 10903 return super.visitArgumentList(node); | 10916 return super.visitArgumentList(node); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11029 checkForReturnOfInvalidType(node.expression, expectedReturnType); | 11042 checkForReturnOfInvalidType(node.expression, expectedReturnType); |
| 11030 return super.visitExpressionFunctionBody(node); | 11043 return super.visitExpressionFunctionBody(node); |
| 11031 } | 11044 } |
| 11032 Object visitFieldDeclaration(FieldDeclaration node) { | 11045 Object visitFieldDeclaration(FieldDeclaration node) { |
| 11033 if (!node.isStatic) { | 11046 if (!node.isStatic) { |
| 11034 VariableDeclarationList variables = node.fields; | 11047 VariableDeclarationList variables = node.fields; |
| 11035 if (variables.isConst) { | 11048 if (variables.isConst) { |
| 11036 _errorReporter.reportError4(CompileTimeErrorCode.CONST_INSTANCE_FIELD, v
ariables.keyword, []); | 11049 _errorReporter.reportError4(CompileTimeErrorCode.CONST_INSTANCE_FIELD, v
ariables.keyword, []); |
| 11037 } | 11050 } |
| 11038 } | 11051 } |
| 11039 _isInInstanceVariableDeclaration = !node.isStatic; | 11052 _isInStaticVariableDeclaration = node.isStatic; |
| 11053 _isInInstanceVariableDeclaration = !_isInStaticVariableDeclaration; |
| 11040 try { | 11054 try { |
| 11041 return super.visitFieldDeclaration(node); | 11055 return super.visitFieldDeclaration(node); |
| 11042 } finally { | 11056 } finally { |
| 11057 _isInStaticVariableDeclaration = false; |
| 11043 _isInInstanceVariableDeclaration = false; | 11058 _isInInstanceVariableDeclaration = false; |
| 11044 } | 11059 } |
| 11045 } | 11060 } |
| 11046 Object visitFieldFormalParameter(FieldFormalParameter node) { | 11061 Object visitFieldFormalParameter(FieldFormalParameter node) { |
| 11047 checkForConstFormalParameter(node); | 11062 checkForConstFormalParameter(node); |
| 11048 checkForPrivateOptionalParameter(node); | 11063 checkForPrivateOptionalParameter(node); |
| 11049 checkForFieldInitializingFormalRedirectingConstructor(node); | 11064 checkForFieldInitializingFormalRedirectingConstructor(node); |
| 11050 return super.visitFieldFormalParameter(node); | 11065 return super.visitFieldFormalParameter(node); |
| 11051 } | 11066 } |
| 11052 Object visitFunctionDeclaration(FunctionDeclaration node) { | 11067 Object visitFunctionDeclaration(FunctionDeclaration node) { |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11257 Object visitThrowExpression(ThrowExpression node) { | 11272 Object visitThrowExpression(ThrowExpression node) { |
| 11258 checkForConstEvalThrowsException(node); | 11273 checkForConstEvalThrowsException(node); |
| 11259 return super.visitThrowExpression(node); | 11274 return super.visitThrowExpression(node); |
| 11260 } | 11275 } |
| 11261 Object visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) { | 11276 Object visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) { |
| 11262 checkForFinalNotInitialized2(node.variables); | 11277 checkForFinalNotInitialized2(node.variables); |
| 11263 return super.visitTopLevelVariableDeclaration(node); | 11278 return super.visitTopLevelVariableDeclaration(node); |
| 11264 } | 11279 } |
| 11265 Object visitTypeName(TypeName node) { | 11280 Object visitTypeName(TypeName node) { |
| 11266 checkForTypeArgumentNotMatchingBounds(node); | 11281 checkForTypeArgumentNotMatchingBounds(node); |
| 11282 checkForTypeParameterReferencedByStatic(node); |
| 11267 return super.visitTypeName(node); | 11283 return super.visitTypeName(node); |
| 11268 } | 11284 } |
| 11269 Object visitTypeParameter(TypeParameter node) { | 11285 Object visitTypeParameter(TypeParameter node) { |
| 11270 checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDE
NTIFIER_AS_TYPE_VARIABLE_NAME); | 11286 checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDE
NTIFIER_AS_TYPE_VARIABLE_NAME); |
| 11271 return super.visitTypeParameter(node); | 11287 return super.visitTypeParameter(node); |
| 11272 } | 11288 } |
| 11273 Object visitVariableDeclaration(VariableDeclaration node) { | 11289 Object visitVariableDeclaration(VariableDeclaration node) { |
| 11274 SimpleIdentifier nameNode = node.name; | 11290 SimpleIdentifier nameNode = node.name; |
| 11275 Expression initializerNode = node.initializer; | 11291 Expression initializerNode = node.initializer; |
| 11276 checkForInvalidAssignment2(nameNode, initializerNode); | 11292 checkForInvalidAssignment2(nameNode, initializerNode); |
| (...skipping 2558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13835 } | 13851 } |
| 13836 _errorReporter.reportError2(errorCode, argTypeName, [argTypeName.name,
boundType.displayName]); | 13852 _errorReporter.reportError2(errorCode, argTypeName, [argTypeName.name,
boundType.displayName]); |
| 13837 foundError = true; | 13853 foundError = true; |
| 13838 } | 13854 } |
| 13839 } | 13855 } |
| 13840 } | 13856 } |
| 13841 return foundError; | 13857 return foundError; |
| 13842 } | 13858 } |
| 13843 | 13859 |
| 13844 /** | 13860 /** |
| 13861 * This checks that if the passed type name is a type parameter being used to
define a static |
| 13862 * member. |
| 13863 * |
| 13864 * @param node the type name to evaluate |
| 13865 * @return `true` if and only if an error code is generated on the passed node |
| 13866 * @see StaticWarningCode#TYPE_PARAMETER_REFERENCED_BY_STATIC |
| 13867 */ |
| 13868 bool checkForTypeParameterReferencedByStatic(TypeName node) { |
| 13869 if (_isInStaticMethod || _isInStaticVariableDeclaration) { |
| 13870 Type2 type = node.type; |
| 13871 if (type is TypeVariableType) { |
| 13872 _errorReporter.reportError2(StaticWarningCode.TYPE_PARAMETER_REFERENCED_
BY_STATIC, node, []); |
| 13873 return true; |
| 13874 } |
| 13875 } |
| 13876 return false; |
| 13877 } |
| 13878 |
| 13879 /** |
| 13845 * This checks that if the passed generative constructor has neither an explic
it super constructor | 13880 * This checks that if the passed generative constructor has neither an explic
it super constructor |
| 13846 * invocation nor a redirecting constructor invocation, that the superclass ha
s a default | 13881 * invocation nor a redirecting constructor invocation, that the superclass ha
s a default |
| 13847 * generative constructor. | 13882 * generative constructor. |
| 13848 * | 13883 * |
| 13849 * @param node the constructor declaration to evaluate | 13884 * @param node the constructor declaration to evaluate |
| 13850 * @return `true` if and only if an error code is generated on the passed node | 13885 * @return `true` if and only if an error code is generated on the passed node |
| 13851 * @see CompileTimeErrorCode#UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT | 13886 * @see CompileTimeErrorCode#UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT |
| 13852 * @see CompileTimeErrorCode#NON_GENERATIVE_CONSTRUCTOR | 13887 * @see CompileTimeErrorCode#NON_GENERATIVE_CONSTRUCTOR |
| 13853 * @see StaticWarningCode#NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT | 13888 * @see StaticWarningCode#NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT |
| 13854 */ | 13889 */ |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14376 this._type = type; | 14411 this._type = type; |
| 14377 this._message = message; | 14412 this._message = message; |
| 14378 } | 14413 } |
| 14379 ErrorSeverity get errorSeverity => _type.severity; | 14414 ErrorSeverity get errorSeverity => _type.severity; |
| 14380 String get message => _message; | 14415 String get message => _message; |
| 14381 ErrorType get type => _type; | 14416 ErrorType get type => _type; |
| 14382 int compareTo(ResolverErrorCode other) => ordinal - other.ordinal; | 14417 int compareTo(ResolverErrorCode other) => ordinal - other.ordinal; |
| 14383 int get hashCode => ordinal; | 14418 int get hashCode => ordinal; |
| 14384 String toString() => name; | 14419 String toString() => name; |
| 14385 } | 14420 } |
| OLD | NEW |