| 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 4508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4519 } | 4519 } |
| 4520 // | 4520 // |
| 4521 // Store in local sets the set of all method and accessor names | 4521 // Store in local sets the set of all method and accessor names |
| 4522 // | 4522 // |
| 4523 HashSet<ExecutableElement> missingOverrides = | 4523 HashSet<ExecutableElement> missingOverrides = |
| 4524 new HashSet<ExecutableElement>(); | 4524 new HashSet<ExecutableElement>(); |
| 4525 // | 4525 // |
| 4526 // Loop through the set of all executable elements declared in the implicit | 4526 // Loop through the set of all executable elements declared in the implicit |
| 4527 // interface. | 4527 // interface. |
| 4528 // | 4528 // |
| 4529 Map<String, ExecutableElement> membersInheritedFromInterfaces = | 4529 MemberMap membersInheritedFromInterfaces = _inheritanceManager |
| 4530 _inheritanceManager | 4530 .getMapOfMembersInheritedFromInterfaces(_enclosingClass); |
| 4531 .getMapOfMembersInheritedFromInterfaces(_enclosingClass); | 4531 MemberMap membersInheritedFromSuperclasses = _inheritanceManager |
| 4532 Map<String, ExecutableElement> membersInheritedFromSuperclasses = | 4532 .getMapOfMembersInheritedFromClasses(_enclosingClass); |
| 4533 _inheritanceManager | 4533 for (int i = 0; i < membersInheritedFromInterfaces.size; i++) { |
| 4534 .getMapOfMembersInheritedFromClasses(_enclosingClass); | 4534 String memberName = membersInheritedFromInterfaces.getKey(i); |
| 4535 for (String memberName in membersInheritedFromInterfaces.keys) { | |
| 4536 ExecutableElement executableElt = | 4535 ExecutableElement executableElt = |
| 4537 membersInheritedFromInterfaces[memberName]; | 4536 membersInheritedFromInterfaces.getValue(i); |
| 4537 if (memberName == null) { |
| 4538 break; |
| 4539 } |
| 4538 // If the element is not synthetic and can be determined to be defined in | 4540 // If the element is not synthetic and can be determined to be defined in |
| 4539 // Object, skip it. | 4541 // Object, skip it. |
| 4540 if (executableElt.enclosingElement != null && | 4542 if (executableElt.enclosingElement != null && |
| 4541 (executableElt.enclosingElement as ClassElement).type.isObject) { | 4543 (executableElt.enclosingElement as ClassElement).type.isObject) { |
| 4542 continue; | 4544 continue; |
| 4543 } | 4545 } |
| 4544 // Check to see if some element is in local enclosing class that matches | 4546 // Check to see if some element is in local enclosing class that matches |
| 4545 // the name of the required member. | 4547 // the name of the required member. |
| 4546 if (_isMemberInClassOrMixin(executableElt, _enclosingClass)) { | 4548 if (_isMemberInClassOrMixin(executableElt, _enclosingClass)) { |
| 4547 // We do not have to verify that this implementation of the found method | 4549 // We do not have to verify that this implementation of the found method |
| 4548 // matches the required function type: the set of | 4550 // matches the required function type: the set of |
| 4549 // StaticWarningCode.INVALID_METHOD_OVERRIDE_* warnings break out the | 4551 // StaticWarningCode.INVALID_METHOD_OVERRIDE_* warnings break out the |
| 4550 // different specific situations. | 4552 // different specific situations. |
| 4551 continue; | 4553 continue; |
| 4552 } | 4554 } |
| 4553 // First check to see if this element was declared in the superclass | 4555 // First check to see if this element was declared in the superclass |
| 4554 // chain, in which case there is already a concrete implementation. | 4556 // chain, in which case there is already a concrete implementation. |
| 4555 ExecutableElement elt = membersInheritedFromSuperclasses[memberName]; | 4557 ExecutableElement elt = membersInheritedFromSuperclasses.get(memberName); |
| 4556 // Check to see if an element was found in the superclass chain with the | 4558 // Check to see if an element was found in the superclass chain with the |
| 4557 // correct name. | 4559 // correct name. |
| 4558 if (elt != null) { | 4560 if (elt != null) { |
| 4559 // Reference the types, if any are null then continue. | 4561 // Reference the types, if any are null then continue. |
| 4560 InterfaceType enclosingType = _enclosingClass.type; | 4562 InterfaceType enclosingType = _enclosingClass.type; |
| 4561 FunctionType concreteType = elt.type; | 4563 FunctionType concreteType = elt.type; |
| 4562 FunctionType requiredMemberType = executableElt.type; | 4564 FunctionType requiredMemberType = executableElt.type; |
| 4563 if (enclosingType == null || | 4565 if (enclosingType == null || |
| 4564 concreteType == null || | 4566 concreteType == null || |
| 4565 requiredMemberType == null) { | 4567 requiredMemberType == null) { |
| (...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6161 class _InvocationCollector extends RecursiveAstVisitor { | 6163 class _InvocationCollector extends RecursiveAstVisitor { |
| 6162 final List<String> superCalls = <String>[]; | 6164 final List<String> superCalls = <String>[]; |
| 6163 | 6165 |
| 6164 @override | 6166 @override |
| 6165 visitMethodInvocation(MethodInvocation node) { | 6167 visitMethodInvocation(MethodInvocation node) { |
| 6166 if (node.target is SuperExpression) { | 6168 if (node.target is SuperExpression) { |
| 6167 superCalls.add(node.methodName.name); | 6169 superCalls.add(node.methodName.name); |
| 6168 } | 6170 } |
| 6169 } | 6171 } |
| 6170 } | 6172 } |
| OLD | NEW |