| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyzer.src.generated.error_verifier; | 5 library analyzer.src.generated.error_verifier; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import "dart:math" as math; | 8 import "dart:math" as math; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 4502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4513 } | 4513 } |
| 4514 // | 4514 // |
| 4515 // Store in local sets the set of all method and accessor names | 4515 // Store in local sets the set of all method and accessor names |
| 4516 // | 4516 // |
| 4517 HashSet<ExecutableElement> missingOverrides = | 4517 HashSet<ExecutableElement> missingOverrides = |
| 4518 new HashSet<ExecutableElement>(); | 4518 new HashSet<ExecutableElement>(); |
| 4519 // | 4519 // |
| 4520 // Loop through the set of all executable elements declared in the implicit | 4520 // Loop through the set of all executable elements declared in the implicit |
| 4521 // interface. | 4521 // interface. |
| 4522 // | 4522 // |
| 4523 MemberMap membersInheritedFromInterfaces = _inheritanceManager | 4523 Map<String, ExecutableElement> membersInheritedFromInterfaces = |
| 4524 .getMapOfMembersInheritedFromInterfaces(_enclosingClass); | 4524 _inheritanceManager |
| 4525 MemberMap membersInheritedFromSuperclasses = _inheritanceManager | 4525 .getMapOfMembersInheritedFromInterfaces(_enclosingClass); |
| 4526 .getMapOfMembersInheritedFromClasses(_enclosingClass); | 4526 Map<String, ExecutableElement> membersInheritedFromSuperclasses = |
| 4527 for (int i = 0; i < membersInheritedFromInterfaces.size; i++) { | 4527 _inheritanceManager |
| 4528 String memberName = membersInheritedFromInterfaces.getKey(i); | 4528 .getMapOfMembersInheritedFromClasses(_enclosingClass); |
| 4529 for (String memberName in membersInheritedFromInterfaces.keys) { |
| 4529 ExecutableElement executableElt = | 4530 ExecutableElement executableElt = |
| 4530 membersInheritedFromInterfaces.getValue(i); | 4531 membersInheritedFromInterfaces[memberName]; |
| 4531 if (memberName == null) { | |
| 4532 break; | |
| 4533 } | |
| 4534 // If the element is not synthetic and can be determined to be defined in | 4532 // If the element is not synthetic and can be determined to be defined in |
| 4535 // Object, skip it. | 4533 // Object, skip it. |
| 4536 if (executableElt.enclosingElement != null && | 4534 if (executableElt.enclosingElement != null && |
| 4537 (executableElt.enclosingElement as ClassElement).type.isObject) { | 4535 (executableElt.enclosingElement as ClassElement).type.isObject) { |
| 4538 continue; | 4536 continue; |
| 4539 } | 4537 } |
| 4540 // Check to see if some element is in local enclosing class that matches | 4538 // Check to see if some element is in local enclosing class that matches |
| 4541 // the name of the required member. | 4539 // the name of the required member. |
| 4542 if (_isMemberInClassOrMixin(executableElt, _enclosingClass)) { | 4540 if (_isMemberInClassOrMixin(executableElt, _enclosingClass)) { |
| 4543 // We do not have to verify that this implementation of the found method | 4541 // We do not have to verify that this implementation of the found method |
| 4544 // matches the required function type: the set of | 4542 // matches the required function type: the set of |
| 4545 // StaticWarningCode.INVALID_METHOD_OVERRIDE_* warnings break out the | 4543 // StaticWarningCode.INVALID_METHOD_OVERRIDE_* warnings break out the |
| 4546 // different specific situations. | 4544 // different specific situations. |
| 4547 continue; | 4545 continue; |
| 4548 } | 4546 } |
| 4549 // First check to see if this element was declared in the superclass | 4547 // First check to see if this element was declared in the superclass |
| 4550 // chain, in which case there is already a concrete implementation. | 4548 // chain, in which case there is already a concrete implementation. |
| 4551 ExecutableElement elt = membersInheritedFromSuperclasses.get(memberName); | 4549 ExecutableElement elt = membersInheritedFromSuperclasses[memberName]; |
| 4552 // Check to see if an element was found in the superclass chain with the | 4550 // Check to see if an element was found in the superclass chain with the |
| 4553 // correct name. | 4551 // correct name. |
| 4554 if (elt != null) { | 4552 if (elt != null) { |
| 4555 // Reference the types, if any are null then continue. | 4553 // Reference the types, if any are null then continue. |
| 4556 InterfaceType enclosingType = _enclosingClass.type; | 4554 InterfaceType enclosingType = _enclosingClass.type; |
| 4557 FunctionType concreteType = elt.type; | 4555 FunctionType concreteType = elt.type; |
| 4558 FunctionType requiredMemberType = executableElt.type; | 4556 FunctionType requiredMemberType = executableElt.type; |
| 4559 if (enclosingType == null || | 4557 if (enclosingType == null || |
| 4560 concreteType == null || | 4558 concreteType == null || |
| 4561 requiredMemberType == null) { | 4559 requiredMemberType == null) { |
| (...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6157 class _InvocationCollector extends RecursiveAstVisitor { | 6155 class _InvocationCollector extends RecursiveAstVisitor { |
| 6158 final List<String> superCalls = <String>[]; | 6156 final List<String> superCalls = <String>[]; |
| 6159 | 6157 |
| 6160 @override | 6158 @override |
| 6161 visitMethodInvocation(MethodInvocation node) { | 6159 visitMethodInvocation(MethodInvocation node) { |
| 6162 if (node.target is SuperExpression) { | 6160 if (node.target is SuperExpression) { |
| 6163 superCalls.add(node.methodName.name); | 6161 superCalls.add(node.methodName.name); |
| 6164 } | 6162 } |
| 6165 } | 6163 } |
| 6166 } | 6164 } |
| OLD | NEW |