| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 /** A formal parameter to a [Method]. */ | 5 /** A formal parameter to a [Method]. */ |
| 6 class Parameter { | 6 class Parameter { |
| 7 FormalNode definition; | 7 FormalNode definition; |
| 8 | 8 |
| 9 String name; | 9 String name; |
| 10 Type type; | 10 Type type; |
| (...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1462 return members[0].invoke(context, node, target, args, isDynamic); | 1462 return members[0].invoke(context, node, target, args, isDynamic); |
| 1463 } | 1463 } |
| 1464 final targets = members.filter((m) => m.canInvoke(context, args)); | 1464 final targets = members.filter((m) => m.canInvoke(context, args)); |
| 1465 if (targets.length == 1) { | 1465 if (targets.length == 1) { |
| 1466 return targets[0].invoke(context, node, target, args, isDynamic); | 1466 return targets[0].invoke(context, node, target, args, isDynamic); |
| 1467 } | 1467 } |
| 1468 | 1468 |
| 1469 Value returnValue = null; | 1469 Value returnValue = null; |
| 1470 for (var member in targets) { | 1470 for (var member in targets) { |
| 1471 final res = member.invoke(context, node, target, args, isDynamic:true); | 1471 final res = member.invoke(context, node, target, args, isDynamic:true); |
| 1472 // TODO(jmesserly): If the code has different type checks, it will fail to |
| 1473 // unify and go through a dynamic stub. Good so far. However, we'll end |
| 1474 // up with a bogus unused temp generated (usually "var $0"). We need a way |
| 1475 // to throw away temps when we throw away the code. |
| 1472 returnValue = _tryUnion(returnValue, res, node); | 1476 returnValue = _tryUnion(returnValue, res, node); |
| 1473 } | 1477 } |
| 1474 | 1478 |
| 1475 if (returnValue == null) { | 1479 if (returnValue == null) { |
| 1476 return _makeError(node, target, 'method'); | 1480 return _makeError(node, target, 'method'); |
| 1477 } | 1481 } |
| 1478 | 1482 |
| 1479 if (returnValue.code == null) { | 1483 if (returnValue.code == null) { |
| 1480 // TODO(jmesserly): make operators less special. | 1484 // TODO(jmesserly): make operators less special. |
| 1481 if (isOperator) { | 1485 if (isOperator) { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1615 } | 1619 } |
| 1616 | 1620 |
| 1617 void forEach(void f(Member member)) { | 1621 void forEach(void f(Member member)) { |
| 1618 factories.forEach((_, Map constructors) { | 1622 factories.forEach((_, Map constructors) { |
| 1619 constructors.forEach((_, Member member) { | 1623 constructors.forEach((_, Member member) { |
| 1620 f(member); | 1624 f(member); |
| 1621 }); | 1625 }); |
| 1622 }); | 1626 }); |
| 1623 } | 1627 } |
| 1624 } | 1628 } |
| OLD | NEW |