| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 universe; | 5 library universe; |
| 6 | 6 |
| 7 import '../elements/elements.dart'; | 7 import '../elements/elements.dart'; |
| 8 import '../dart2jslib.dart'; | 8 import '../dart2jslib.dart'; |
| 9 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
| 10 import '../types/types.dart'; | 10 import '../types/types.dart'; |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 if (element.isForeign(compiler)) return true; | 327 if (element.isForeign(compiler)) return true; |
| 328 if (element.isSetter()) return isSetter(); | 328 if (element.isSetter()) return isSetter(); |
| 329 if (element.isGetter()) return isGetter() || isCall(); | 329 if (element.isGetter()) return isGetter() || isCall(); |
| 330 if (element.isField()) { | 330 if (element.isField()) { |
| 331 return isSetter() | 331 return isSetter() |
| 332 ? !element.modifiers.isFinalOrConst() | 332 ? !element.modifiers.isFinalOrConst() |
| 333 : isGetter() || isCall(); | 333 : isGetter() || isCall(); |
| 334 } | 334 } |
| 335 if (isGetter()) return true; | 335 if (isGetter()) return true; |
| 336 if (isSetter()) return false; | 336 if (isSetter()) return false; |
| 337 return signatureApplies(element, compiler); | |
| 338 } | |
| 339 | 337 |
| 340 bool signatureApplies(FunctionElement function, Compiler compiler) { | 338 FunctionElement function = element; |
| 341 FunctionSignature parameters = function.computeSignature(compiler); | 339 FunctionSignature parameters = function.computeSignature(compiler); |
| 342 if (argumentCount > parameters.parameterCount) return false; | 340 if (argumentCount > parameters.parameterCount) return false; |
| 343 int requiredParameterCount = parameters.requiredParameterCount; | 341 int requiredParameterCount = parameters.requiredParameterCount; |
| 344 int optionalParameterCount = parameters.optionalParameterCount; | 342 int optionalParameterCount = parameters.optionalParameterCount; |
| 345 if (positionalArgumentCount < requiredParameterCount) return false; | 343 if (positionalArgumentCount < requiredParameterCount) return false; |
| 346 | 344 |
| 347 if (!parameters.optionalParametersAreNamed) { | 345 if (!parameters.optionalParametersAreNamed) { |
| 348 // We have already checked that the number of arguments are | 346 // We have already checked that the number of arguments are |
| 349 // not greater than the number of parameters. Therefore the | 347 // not greater than the number of parameters. Therefore the |
| 350 // number of positional arguments are not greater than the | 348 // number of positional arguments are not greater than the |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 } | 671 } |
| 674 | 672 |
| 675 Selector extendIfReachesAll(Compiler compiler) { | 673 Selector extendIfReachesAll(Compiler compiler) { |
| 676 bool canReachAll = compiler.enabledInvokeOn | 674 bool canReachAll = compiler.enabledInvokeOn |
| 677 && mask.needsNoSuchMethodHandling(this, compiler); | 675 && mask.needsNoSuchMethodHandling(this, compiler); |
| 678 return canReachAll | 676 return canReachAll |
| 679 ? new TypedSelector(compiler.typesTask.dynamicType, this) | 677 ? new TypedSelector(compiler.typesTask.dynamicType, this) |
| 680 : this; | 678 : this; |
| 681 } | 679 } |
| 682 } | 680 } |
| OLD | NEW |