| 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 } |
| 337 | 339 |
| 338 FunctionElement function = element; | 340 bool signatureApplies(FunctionElement function, Compiler compiler) { |
| 339 FunctionSignature parameters = function.computeSignature(compiler); | 341 FunctionSignature parameters = function.computeSignature(compiler); |
| 340 if (argumentCount > parameters.parameterCount) return false; | 342 if (argumentCount > parameters.parameterCount) return false; |
| 341 int requiredParameterCount = parameters.requiredParameterCount; | 343 int requiredParameterCount = parameters.requiredParameterCount; |
| 342 int optionalParameterCount = parameters.optionalParameterCount; | 344 int optionalParameterCount = parameters.optionalParameterCount; |
| 343 if (positionalArgumentCount < requiredParameterCount) return false; | 345 if (positionalArgumentCount < requiredParameterCount) return false; |
| 344 | 346 |
| 345 if (!parameters.optionalParametersAreNamed) { | 347 if (!parameters.optionalParametersAreNamed) { |
| 346 // We have already checked that the number of arguments are | 348 // We have already checked that the number of arguments are |
| 347 // not greater than the number of parameters. Therefore the | 349 // not greater than the number of parameters. Therefore the |
| 348 // number of positional arguments are not greater than the | 350 // number of positional arguments are not greater than the |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 } | 673 } |
| 672 | 674 |
| 673 Selector extendIfReachesAll(Compiler compiler) { | 675 Selector extendIfReachesAll(Compiler compiler) { |
| 674 bool canReachAll = compiler.enabledInvokeOn | 676 bool canReachAll = compiler.enabledInvokeOn |
| 675 && mask.needsNoSuchMethodHandling(this, compiler); | 677 && mask.needsNoSuchMethodHandling(this, compiler); |
| 676 return canReachAll | 678 return canReachAll |
| 677 ? new TypedSelector(compiler.typesTask.dynamicType, this) | 679 ? new TypedSelector(compiler.typesTask.dynamicType, this) |
| 678 : this; | 680 : this; |
| 679 } | 681 } |
| 680 } | 682 } |
| OLD | NEW |