| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Mixins that implement convenience methods on [Element] subclasses. | 5 /// Mixins that implement convenience methods on [Element] subclasses. |
| 6 | 6 |
| 7 library elements.common; | 7 library elements.common; |
| 8 | 8 |
| 9 import '../common/names.dart' show | 9 import '../common/names.dart' show |
| 10 Names, | 10 Names, |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 for (ClassElement s = declaration; s != null; s = s.superclass) { | 429 for (ClassElement s = declaration; s != null; s = s.superclass) { |
| 430 if (identical(s, cls)) return true; | 430 if (identical(s, cls)) return true; |
| 431 } | 431 } |
| 432 return false; | 432 return false; |
| 433 } | 433 } |
| 434 | 434 |
| 435 FunctionType get callType { | 435 FunctionType get callType { |
| 436 MemberSignature member = lookupInterfaceMember(Names.call); | 436 MemberSignature member = lookupInterfaceMember(Names.call); |
| 437 return member != null && member.isMethod ? member.type : null; | 437 return member != null && member.isMethod ? member.type : null; |
| 438 } | 438 } |
| 439 |
| 440 @override |
| 441 bool get isNamedMixinApplication { |
| 442 return isMixinApplication && !isUnnamedMixinApplication; |
| 443 } |
| 439 } | 444 } |
| 440 | 445 |
| 441 abstract class FunctionSignatureCommon implements FunctionSignature { | 446 abstract class FunctionSignatureCommon implements FunctionSignature { |
| 442 void forEachRequiredParameter(void function(Element parameter)) { | 447 void forEachRequiredParameter(void function(Element parameter)) { |
| 443 requiredParameters.forEach(function); | 448 requiredParameters.forEach(function); |
| 444 } | 449 } |
| 445 | 450 |
| 446 void forEachOptionalParameter(void function(Element parameter)) { | 451 void forEachOptionalParameter(void function(Element parameter)) { |
| 447 optionalParameters.forEach(function); | 452 optionalParameters.forEach(function); |
| 448 } | 453 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 // this signature must not have more required parameters. Having more | 495 // this signature must not have more required parameters. Having more |
| 491 // optional parameters is not a problem, they simply are never provided | 496 // optional parameters is not a problem, they simply are never provided |
| 492 // by call sites of a call to a method with the other signature. | 497 // by call sites of a call to a method with the other signature. |
| 493 int otherTotalCount = signature.parameterCount; | 498 int otherTotalCount = signature.parameterCount; |
| 494 return requiredParameterCount <= otherTotalCount | 499 return requiredParameterCount <= otherTotalCount |
| 495 && parameterCount >= otherTotalCount; | 500 && parameterCount >= otherTotalCount; |
| 496 } | 501 } |
| 497 return true; | 502 return true; |
| 498 } | 503 } |
| 499 } | 504 } |
| OLD | NEW |