| 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 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1397 if (overridingFT == null || overriddenFT == null) { | 1397 if (overridingFT == null || overriddenFT == null) { |
| 1398 return false; | 1398 return false; |
| 1399 } | 1399 } |
| 1400 | 1400 |
| 1401 // Handle generic function type parameters. | 1401 // Handle generic function type parameters. |
| 1402 // TODO(jmesserly): this duplicates some code in isSubtypeOf and most of | 1402 // TODO(jmesserly): this duplicates some code in isSubtypeOf and most of |
| 1403 // _isGenericFunctionSubtypeOf. Ideally, we'd let TypeSystem produce | 1403 // _isGenericFunctionSubtypeOf. Ideally, we'd let TypeSystem produce |
| 1404 // an error message once it's ready to "return false". | 1404 // an error message once it's ready to "return false". |
| 1405 if (!overridingFT.typeFormals.isEmpty) { | 1405 if (!overridingFT.typeFormals.isEmpty) { |
| 1406 if (overriddenFT.typeFormals.isEmpty) { | 1406 if (overriddenFT.typeFormals.isEmpty) { |
| 1407 overriddenFT = _typeSystem.instantiateToBounds(overriddenFT); | 1407 overridingFT = _typeSystem.instantiateToBounds(overridingFT); |
| 1408 } else { | 1408 } else { |
| 1409 List<TypeParameterElement> params1 = overridingFT.typeFormals; | 1409 List<TypeParameterElement> params1 = overridingFT.typeFormals; |
| 1410 List<TypeParameterElement> params2 = overriddenFT.typeFormals; | 1410 List<TypeParameterElement> params2 = overriddenFT.typeFormals; |
| 1411 int count = params1.length; | 1411 int count = params1.length; |
| 1412 if (params2.length != count) { | 1412 if (params2.length != count) { |
| 1413 _errorReporter.reportErrorForNode( | 1413 _errorReporter.reportErrorForNode( |
| 1414 StaticWarningCode.INVALID_METHOD_OVERRIDE_TYPE_PARAMETERS, | 1414 StaticWarningCode.INVALID_METHOD_OVERRIDE_TYPE_PARAMETERS, |
| 1415 errorNameTarget, [ | 1415 errorNameTarget, [ |
| 1416 count, | 1416 count, |
| 1417 params2.length, | 1417 params2.length, |
| (...skipping 3146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4564 if ((elt is MethodElement && !elt.isAbstract) || | 4564 if ((elt is MethodElement && !elt.isAbstract) || |
| 4565 (elt is PropertyAccessorElement && !elt.isAbstract)) { | 4565 (elt is PropertyAccessorElement && !elt.isAbstract)) { |
| 4566 // Since we are comparing two function types, we need to do the | 4566 // Since we are comparing two function types, we need to do the |
| 4567 // appropriate type substitutions first (). | 4567 // appropriate type substitutions first (). |
| 4568 FunctionType foundConcreteFT = _inheritanceManager | 4568 FunctionType foundConcreteFT = _inheritanceManager |
| 4569 .substituteTypeArgumentsInMemberFromInheritance( | 4569 .substituteTypeArgumentsInMemberFromInheritance( |
| 4570 concreteType, memberName, enclosingType); | 4570 concreteType, memberName, enclosingType); |
| 4571 FunctionType requiredMemberFT = _inheritanceManager | 4571 FunctionType requiredMemberFT = _inheritanceManager |
| 4572 .substituteTypeArgumentsInMemberFromInheritance( | 4572 .substituteTypeArgumentsInMemberFromInheritance( |
| 4573 requiredMemberType, memberName, enclosingType); | 4573 requiredMemberType, memberName, enclosingType); |
| 4574 foundConcreteFT = |
| 4575 _typeSystem.typeToConcreteType(_typeProvider, foundConcreteFT); |
| 4576 requiredMemberFT = |
| 4577 _typeSystem.typeToConcreteType(_typeProvider, requiredMemberFT); |
| 4574 if (_typeSystem.isSubtypeOf(foundConcreteFT, requiredMemberFT)) { | 4578 if (_typeSystem.isSubtypeOf(foundConcreteFT, requiredMemberFT)) { |
| 4575 continue; | 4579 continue; |
| 4576 } | 4580 } |
| 4577 } | 4581 } |
| 4578 } | 4582 } |
| 4579 // The not qualifying concrete executable element was found, add it to the | 4583 // The not qualifying concrete executable element was found, add it to the |
| 4580 // list. | 4584 // list. |
| 4581 missingOverrides.add(executableElt); | 4585 missingOverrides.add(executableElt); |
| 4582 } | 4586 } |
| 4583 // Now that we have the set of missing overrides, generate a warning on this | 4587 // Now that we have the set of missing overrides, generate a warning on this |
| (...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6138 class _InvocationCollector extends RecursiveAstVisitor { | 6142 class _InvocationCollector extends RecursiveAstVisitor { |
| 6139 final List<String> superCalls = <String>[]; | 6143 final List<String> superCalls = <String>[]; |
| 6140 | 6144 |
| 6141 @override | 6145 @override |
| 6142 visitMethodInvocation(MethodInvocation node) { | 6146 visitMethodInvocation(MethodInvocation node) { |
| 6143 if (node.target is SuperExpression) { | 6147 if (node.target is SuperExpression) { |
| 6144 superCalls.add(node.methodName.name); | 6148 superCalls.add(node.methodName.name); |
| 6145 } | 6149 } |
| 6146 } | 6150 } |
| 6147 } | 6151 } |
| OLD | NEW |