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 } | |
444 } | 439 } |
445 | 440 |
446 abstract class FunctionSignatureCommon implements FunctionSignature { | 441 abstract class FunctionSignatureCommon implements FunctionSignature { |
447 void forEachRequiredParameter(void function(Element parameter)) { | 442 void forEachRequiredParameter(void function(Element parameter)) { |
448 requiredParameters.forEach(function); | 443 requiredParameters.forEach(function); |
449 } | 444 } |
450 | 445 |
451 void forEachOptionalParameter(void function(Element parameter)) { | 446 void forEachOptionalParameter(void function(Element parameter)) { |
452 optionalParameters.forEach(function); | 447 optionalParameters.forEach(function); |
453 } | 448 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 // this signature must not have more required parameters. Having more | 490 // this signature must not have more required parameters. Having more |
496 // optional parameters is not a problem, they simply are never provided | 491 // optional parameters is not a problem, they simply are never provided |
497 // by call sites of a call to a method with the other signature. | 492 // by call sites of a call to a method with the other signature. |
498 int otherTotalCount = signature.parameterCount; | 493 int otherTotalCount = signature.parameterCount; |
499 return requiredParameterCount <= otherTotalCount | 494 return requiredParameterCount <= otherTotalCount |
500 && parameterCount >= otherTotalCount; | 495 && parameterCount >= otherTotalCount; |
501 } | 496 } |
502 return true; | 497 return true; |
503 } | 498 } |
504 } | 499 } |
OLD | NEW |