| 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 7994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8005 * @return `true` if the library is 'dart:async' | 8005 * @return `true` if the library is 'dart:async' |
| 8006 */ | 8006 */ |
| 8007 bool isAsyncLibrary(LibraryElement library) => library.name == "dart.async"; | 8007 bool isAsyncLibrary(LibraryElement library) => library.name == "dart.async"; |
| 8008 | 8008 |
| 8009 /** | 8009 /** |
| 8010 * Return `true` if the given library is the 'dart:html' library. | 8010 * Return `true` if the given library is the 'dart:html' library. |
| 8011 * | 8011 * |
| 8012 * @param library the library being tested | 8012 * @param library the library being tested |
| 8013 * @return `true` if the library is 'dart:html' | 8013 * @return `true` if the library is 'dart:html' |
| 8014 */ | 8014 */ |
| 8015 bool isHtmlLibrary(LibraryElement library) => library.name == "dart.dom.html"; | 8015 bool isHtmlLibrary(LibraryElement library) => library != null && "dart.dom.htm
l" == library.name; |
| 8016 | 8016 |
| 8017 /** | 8017 /** |
| 8018 * Return `true` if the given node is not a type literal. | 8018 * Return `true` if the given node is not a type literal. |
| 8019 * | 8019 * |
| 8020 * @param node the node being tested | 8020 * @param node the node being tested |
| 8021 * @return `true` if the given node is not a type literal | 8021 * @return `true` if the given node is not a type literal |
| 8022 */ | 8022 */ |
| 8023 bool isNotTypeLiteral(Identifier node) { | 8023 bool isNotTypeLiteral(Identifier node) { |
| 8024 ASTNode parent = node.parent; | 8024 ASTNode parent = node.parent; |
| 8025 return parent is TypeName || (parent is PrefixedIdentifier && (parent.parent
is TypeName || identical(((parent as PrefixedIdentifier)).prefix, node))) || (p
arent is PropertyAccess && identical(((parent as PropertyAccess)).target, node))
|| (parent is MethodInvocation && identical(node, ((parent as MethodInvocation)
).target)); | 8025 return parent is TypeName || (parent is PrefixedIdentifier && (parent.parent
is TypeName || identical(((parent as PrefixedIdentifier)).prefix, node))) || (p
arent is PropertyAccess && identical(((parent as PropertyAccess)).target, node))
|| (parent is MethodInvocation && identical(node, ((parent as MethodInvocation)
).target)); |
| (...skipping 3544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11570 javaSetAdd(visitedClasses, superclassElement); | 11570 javaSetAdd(visitedClasses, superclassElement); |
| 11571 List<FieldElement> fieldElts = superclassElement.fields; | 11571 List<FieldElement> fieldElts = superclassElement.fields; |
| 11572 for (FieldElement fieldElt in fieldElts) { | 11572 for (FieldElement fieldElt in fieldElts) { |
| 11573 if (fieldElt.name == executableElementName && fieldElt.isStatic) { | 11573 if (fieldElt.name == executableElementName && fieldElt.isStatic) { |
| 11574 _errorReporter.reportError2(StaticWarningCode.INSTANCE_METHOD_NAME
_COLLIDES_WITH_SUPERCLASS_STATIC, errorNameTarget, [ | 11574 _errorReporter.reportError2(StaticWarningCode.INSTANCE_METHOD_NAME
_COLLIDES_WITH_SUPERCLASS_STATIC, errorNameTarget, [ |
| 11575 executableElementName, | 11575 executableElementName, |
| 11576 fieldElt.enclosingElement.displayName]); | 11576 fieldElt.enclosingElement.displayName]); |
| 11577 return true; | 11577 return true; |
| 11578 } | 11578 } |
| 11579 } | 11579 } |
| 11580 List<PropertyAccessorElement> propertyAccessorElts = superclassElement
.accessors; | |
| 11581 for (PropertyAccessorElement accessorElt in propertyAccessorElts) { | |
| 11582 if (accessorElt.name == executableElementName && accessorElt.isStati
c) { | |
| 11583 _errorReporter.reportError2(StaticWarningCode.INSTANCE_METHOD_NAME
_COLLIDES_WITH_SUPERCLASS_STATIC, errorNameTarget, [ | |
| 11584 executableElementName, | |
| 11585 accessorElt.enclosingElement.displayName]); | |
| 11586 return true; | |
| 11587 } | |
| 11588 } | |
| 11589 List<MethodElement> methodElements = superclassElement.methods; | 11580 List<MethodElement> methodElements = superclassElement.methods; |
| 11590 for (MethodElement methodElement in methodElements) { | 11581 for (MethodElement methodElement in methodElements) { |
| 11591 if (methodElement.name == executableElementName && methodElement.isS
tatic) { | 11582 if (methodElement.name == executableElementName && methodElement.isS
tatic) { |
| 11592 _errorReporter.reportError2(StaticWarningCode.INSTANCE_METHOD_NAME
_COLLIDES_WITH_SUPERCLASS_STATIC, errorNameTarget, [ | 11583 _errorReporter.reportError2(StaticWarningCode.INSTANCE_METHOD_NAME
_COLLIDES_WITH_SUPERCLASS_STATIC, errorNameTarget, [ |
| 11593 executableElementName, | 11584 executableElementName, |
| 11594 methodElement.enclosingElement.displayName]); | 11585 methodElement.enclosingElement.displayName]); |
| 11595 return true; | 11586 return true; |
| 11596 } | 11587 } |
| 11597 } | 11588 } |
| 11598 superclassType = superclassElement.supertype; | 11589 superclassType = superclassElement.supertype; |
| (...skipping 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13369 problemReported = true; | 13360 problemReported = true; |
| 13370 } | 13361 } |
| 13371 } | 13362 } |
| 13372 return problemReported; | 13363 return problemReported; |
| 13373 } | 13364 } |
| 13374 | 13365 |
| 13375 /** | 13366 /** |
| 13376 * Check to make sure that all similarly typed accessors are of the same type
(including inherited | 13367 * Check to make sure that all similarly typed accessors are of the same type
(including inherited |
| 13377 * accessors). | 13368 * accessors). |
| 13378 * | 13369 * |
| 13379 * @param node The accessor currently being visited. | 13370 * @param node the accessor currently being visited |
| 13371 * @return `true` if and only if an error code is generated on the passed node |
| 13380 */ | 13372 */ |
| 13381 void checkForMismatchedAccessorTypes(Declaration accessorDeclaration, String a
ccessorTextName) { | 13373 bool checkForMismatchedAccessorTypes(Declaration accessorDeclaration, String a
ccessorTextName) { |
| 13382 PropertyAccessorElement counterpartAccessor = null; | |
| 13383 ExecutableElement accessorElement = accessorDeclaration.element as Executabl
eElement; | 13374 ExecutableElement accessorElement = accessorDeclaration.element as Executabl
eElement; |
| 13384 if (accessorElement is! PropertyAccessorElement) { | 13375 if (accessorElement is! PropertyAccessorElement) { |
| 13385 return; | 13376 return false; |
| 13386 } | 13377 } |
| 13378 PropertyAccessorElement counterpartAccessor = null; |
| 13387 PropertyAccessorElement propertyAccessorElement = accessorElement as Propert
yAccessorElement; | 13379 PropertyAccessorElement propertyAccessorElement = accessorElement as Propert
yAccessorElement; |
| 13388 counterpartAccessor = propertyAccessorElement.correspondingSetter; | 13380 if (propertyAccessorElement.isGetter) { |
| 13381 counterpartAccessor = propertyAccessorElement.correspondingSetter; |
| 13382 } else { |
| 13383 counterpartAccessor = propertyAccessorElement.correspondingGetter; |
| 13384 if (counterpartAccessor != null && identical(counterpartAccessor.enclosing
Element, propertyAccessorElement.enclosingElement)) { |
| 13385 return false; |
| 13386 } |
| 13387 } |
| 13389 if (counterpartAccessor == null) { | 13388 if (counterpartAccessor == null) { |
| 13390 return; | 13389 return false; |
| 13391 } | 13390 } |
| 13392 Type2 getterType = null; | 13391 Type2 getterType = null; |
| 13393 Type2 setterType = null; | 13392 Type2 setterType = null; |
| 13394 if (propertyAccessorElement.isGetter) { | 13393 if (propertyAccessorElement.isGetter) { |
| 13395 getterType = getGetterType(propertyAccessorElement); | 13394 getterType = getGetterType(propertyAccessorElement); |
| 13396 setterType = getSetterType(counterpartAccessor); | 13395 setterType = getSetterType(counterpartAccessor); |
| 13397 } else if (propertyAccessorElement.isSetter) { | 13396 } else if (propertyAccessorElement.isSetter) { |
| 13398 setterType = getSetterType(propertyAccessorElement); | 13397 setterType = getSetterType(propertyAccessorElement); |
| 13399 counterpartAccessor = propertyAccessorElement.correspondingGetter; | 13398 counterpartAccessor = propertyAccessorElement.correspondingGetter; |
| 13400 getterType = getGetterType(counterpartAccessor); | 13399 getterType = getGetterType(counterpartAccessor); |
| 13401 } | 13400 } |
| 13402 if (setterType != null && getterType != null && !getterType.isAssignableTo(s
etterType)) { | 13401 if (setterType != null && getterType != null && !getterType.isAssignableTo(s
etterType)) { |
| 13403 _errorReporter.reportError2(StaticWarningCode.MISMATCHED_GETTER_AND_SETTER
_TYPES, accessorDeclaration, [ | 13402 _errorReporter.reportError2(StaticWarningCode.MISMATCHED_GETTER_AND_SETTER
_TYPES, accessorDeclaration, [ |
| 13404 accessorTextName, | 13403 accessorTextName, |
| 13405 setterType.displayName, | 13404 setterType.displayName, |
| 13406 getterType.displayName]); | 13405 getterType.displayName]); |
| 13406 return true; |
| 13407 } | 13407 } |
| 13408 return false; |
| 13408 } | 13409 } |
| 13409 | 13410 |
| 13410 /** | 13411 /** |
| 13411 * This verifies that the passed mixin does not have an explicitly declared co
nstructor. | 13412 * This verifies that the passed mixin does not have an explicitly declared co
nstructor. |
| 13412 * | 13413 * |
| 13413 * @param mixinName the node to report problem on | 13414 * @param mixinName the node to report problem on |
| 13414 * @param mixinElement the mixing to evaluate | 13415 * @param mixinElement the mixing to evaluate |
| 13415 * @return `true` if and only if an error code is generated on the passed node | 13416 * @return `true` if and only if an error code is generated on the passed node |
| 13416 * @see CompileTimeErrorCode#MIXIN_DECLARES_CONSTRUCTOR | 13417 * @see CompileTimeErrorCode#MIXIN_DECLARES_CONSTRUCTOR |
| 13417 */ | 13418 */ |
| (...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14876 this._type = type; | 14877 this._type = type; |
| 14877 this._message = message; | 14878 this._message = message; |
| 14878 } | 14879 } |
| 14879 ErrorSeverity get errorSeverity => _type.severity; | 14880 ErrorSeverity get errorSeverity => _type.severity; |
| 14880 String get message => _message; | 14881 String get message => _message; |
| 14881 ErrorType get type => _type; | 14882 ErrorType get type => _type; |
| 14882 int compareTo(ResolverErrorCode other) => ordinal - other.ordinal; | 14883 int compareTo(ResolverErrorCode other) => ordinal - other.ordinal; |
| 14883 int get hashCode => ordinal; | 14884 int get hashCode => ordinal; |
| 14884 String toString() => name; | 14885 String toString() => name; |
| 14885 } | 14886 } |
| OLD | NEW |