Chromium Code Reviews| 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 part of resolution; | 5 part of resolution; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Core implementation of resolution. | 8 * Core implementation of resolution. |
| 9 * | 9 * |
| 10 * Do not subclass or instantiate this class outside this library | 10 * Do not subclass or instantiate this class outside this library |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 if (node.isConditional) { | 533 if (node.isConditional) { |
| 534 sendIsMemberAccess = oldSendIsMemberAccess; | 534 sendIsMemberAccess = oldSendIsMemberAccess; |
| 535 allowedCategory = oldAllowedCategory; | 535 allowedCategory = oldAllowedCategory; |
| 536 } | 536 } |
| 537 | 537 |
| 538 allowedCategory = oldCategory; | 538 allowedCategory = oldCategory; |
| 539 | 539 |
| 540 Element target; | 540 Element target; |
| 541 String name = node.selector.asIdentifier().source; | 541 String name = node.selector.asIdentifier().source; |
| 542 if (identical(name, 'this')) { | 542 if (identical(name, 'this')) { |
| 543 // TODO(ahe): Why is this using GENERIC? | 543 error(node.selector, MessageKind.THIS_PROPERTY); |
| 544 error(node.selector, MessageKind.GENERIC, | |
| 545 {'text': "expected an identifier"}); | |
| 546 return const NoneResult(); | 544 return const NoneResult(); |
| 547 } else if (node.isSuperCall) { | 545 } else if (node.isSuperCall) { |
| 548 if (node.isOperator) { | 546 if (node.isOperator) { |
| 549 if (isUserDefinableOperator(name)) { | 547 if (isUserDefinableOperator(name)) { |
| 550 name = selector.name; | 548 name = selector.name; |
| 551 } else { | 549 } else { |
| 552 error(node.selector, MessageKind.ILLEGAL_SUPER_SEND, {'name': name}); | 550 error(node.selector, MessageKind.ILLEGAL_SUPER_SEND, {'name': name}); |
| 553 return const NoneResult(); | 551 return const NoneResult(); |
| 554 } | 552 } |
| 555 } | 553 } |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 950 target = error; | 948 target = error; |
| 951 } | 949 } |
| 952 // We still need to register the invocation, because we might | 950 // We still need to register the invocation, because we might |
| 953 // call [:super.noSuchMethod:] which calls [JSInvocationMirror._invokeOn]. | 951 // call [:super.noSuchMethod:] which calls [JSInvocationMirror._invokeOn]. |
| 954 registry.registerDynamicInvocation(selector); | 952 registry.registerDynamicInvocation(selector); |
| 955 registry.registerSuperNoSuchMethod(); | 953 registry.registerSuperNoSuchMethod(); |
| 956 } | 954 } |
| 957 return computeSuperAccessSemantics(node, target); | 955 return computeSuperAccessSemantics(node, target); |
| 958 } | 956 } |
| 959 | 957 |
| 960 /// Resolve [node] as subexpression that is _not_ the prefix of a member | 958 /// Resolve [node] as a subexpression that is _not_ the prefix of a member |
| 961 /// access. For instance `a` in `a + b`, as opposed to `a` in `a.b`. | 959 /// access. For instance `a` in `a + b`, as opposed to `a` in `a.b`. |
| 962 ResolutionResult visitExpression(Node node) { | 960 ResolutionResult visitExpression(Node node) { |
| 963 bool oldSendIsMemberAccess = sendIsMemberAccess; | 961 bool oldSendIsMemberAccess = sendIsMemberAccess; |
| 964 sendIsMemberAccess = false; | 962 sendIsMemberAccess = false; |
| 965 ResolutionResult result = visit(node); | 963 ResolutionResult result = visit(node); |
| 966 sendIsMemberAccess = oldSendIsMemberAccess; | 964 sendIsMemberAccess = oldSendIsMemberAccess; |
| 967 return result; | 965 return result; |
| 968 } | 966 } |
| 969 | 967 |
| 968 /// Resolve [node] as a subexpression that _is_ the prefix of a member access. | |
| 969 /// For instance `a` in `a.b`, as opposed to `a` in `a + b`. | |
| 970 ResolutionResult visitExpressionPrefix(Node node) { | |
| 971 int oldAllowedCategory = allowedCategory; | |
| 972 bool oldSendIsMemberAccess = sendIsMemberAccess; | |
| 973 allowedCategory |= ElementCategory.PREFIX | ElementCategory.SUPER; | |
| 974 sendIsMemberAccess = true; | |
| 975 ResolutionResult result = visit(node); | |
| 976 sendIsMemberAccess = oldSendIsMemberAccess; | |
| 977 allowedCategory = oldAllowedCategory; | |
| 978 return result; | |
| 979 } | |
| 980 | |
| 981 /// Resolved [node] as a subexpression that is the prefix of a conditional | |
| 982 /// access. For instance `a` in `a?.b`. | |
| 983 ResolutionResult visitConditionalPrefix(Node node) { | |
| 984 // Conditional sends like `e?.foo` treat the receiver as an expression. So | |
| 985 // `C?.foo` needs to be treated like `(C).foo`, not like C.foo. Prefixes and | |
| 986 // super are not allowed on their own in that context. | |
| 987 int oldAllowedCategory = allowedCategory; | |
| 988 bool oldSendIsMemberAccess = sendIsMemberAccess; | |
| 989 sendIsMemberAccess = false; | |
| 990 allowedCategory = | |
| 991 ElementCategory.VARIABLE | | |
| 992 ElementCategory.FUNCTION | | |
| 993 ElementCategory.IMPLIES_TYPE; | |
| 994 ResolutionResult result = visit(node); | |
| 995 sendIsMemberAccess = oldSendIsMemberAccess; | |
| 996 allowedCategory = oldAllowedCategory; | |
| 997 return result; | |
| 998 } | |
| 999 | |
| 970 /// Handle a type test expression, like `a is T` and `a is! T`. | 1000 /// Handle a type test expression, like `a is T` and `a is! T`. |
| 971 ResolutionResult handleIs(Send node) { | 1001 ResolutionResult handleIs(Send node) { |
| 972 Node expression = node.receiver; | 1002 Node expression = node.receiver; |
| 973 visitExpression(expression); | 1003 visitExpression(expression); |
| 974 | 1004 |
| 975 // TODO(johnniwinther): Use seen type tests to avoid registration of | 1005 // TODO(johnniwinther): Use seen type tests to avoid registration of |
| 976 // mutation/access to unpromoted variables. | 1006 // mutation/access to unpromoted variables. |
| 977 | 1007 |
| 978 Send notTypeNode = node.arguments.head.asSend(); | 1008 Send notTypeNode = node.arguments.head.asSend(); |
| 979 DartType type; | 1009 DartType type; |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1382 sendStructure = const InvalidAssertStructure(); | 1412 sendStructure = const InvalidAssertStructure(); |
| 1383 } | 1413 } |
| 1384 registry.registerAssert(node); | 1414 registry.registerAssert(node); |
| 1385 registry.registerSendStructure(node, sendStructure); | 1415 registry.registerSendStructure(node, sendStructure); |
| 1386 return const AssertResult(); | 1416 return const AssertResult(); |
| 1387 } | 1417 } |
| 1388 | 1418 |
| 1389 /// Handle access of a property of [name] on `this`, like `this.name` and | 1419 /// Handle access of a property of [name] on `this`, like `this.name` and |
| 1390 /// `this.name()`, or `name` and `name()` in instance context. | 1420 /// `this.name()`, or `name` and `name()` in instance context. |
| 1391 ResolutionResult handleThisPropertyAccess(Send node, Name name) { | 1421 ResolutionResult handleThisPropertyAccess(Send node, Name name) { |
| 1392 AccessSemantics accessSemantics = new AccessSemantics.thisProperty(); | 1422 AccessSemantics semantics = new AccessSemantics.thisProperty(); |
| 1393 SendStructure sendStructure; | 1423 return handleDynamicAccessSemantics(node, name, semantics); |
| 1394 Selector selector; | |
| 1395 if (node.isCall) { | |
| 1396 CallStructure callStructure = resolveArguments(node.argumentsNode); | |
| 1397 selector = new Selector(SelectorKind.CALL, name, callStructure); | |
| 1398 registry.registerDynamicInvocation(selector); | |
| 1399 sendStructure = new InvokeStructure(accessSemantics, selector); | |
| 1400 } else { | |
| 1401 assert(invariant(node, node.isPropertyAccess)); | |
| 1402 selector = new Selector( | |
| 1403 SelectorKind.GETTER, name, CallStructure.NO_ARGS); | |
| 1404 registry.registerDynamicGetter(selector); | |
| 1405 sendStructure = new GetStructure(accessSemantics, selector); | |
| 1406 } | |
| 1407 registry.registerSendStructure(node, sendStructure); | |
| 1408 // TODO(johnniwinther): Remove this when all information goes through | |
| 1409 // the [SendStructure]. | |
| 1410 registry.setSelector(node, selector); | |
| 1411 return const NoneResult(); | |
| 1412 } | 1424 } |
| 1413 | 1425 |
| 1414 /// Handle access on `this`, like `this()` and `this` when it is parsed as a | 1426 /// Handle access on `this`, like `this()` and `this` when it is parsed as a |
| 1415 /// [Send] node. | 1427 /// [Send] node. |
| 1416 ResolutionResult handleThisAccess(Send node) { | 1428 ResolutionResult handleThisAccess(Send node) { |
| 1417 AccessSemantics accessSemantics = new AccessSemantics.thisAccess(); | 1429 AccessSemantics accessSemantics = new AccessSemantics.thisAccess(); |
| 1418 if (node.isCall) { | 1430 if (node.isCall) { |
| 1419 CallStructure callStructure = resolveArguments(node.argumentsNode); | 1431 CallStructure callStructure = resolveArguments(node.argumentsNode); |
| 1420 Selector selector = callStructure.callSelector; | 1432 Selector selector = callStructure.callSelector; |
| 1421 // TODO(johnniwinther): Handle invalid this access as an | 1433 // TODO(johnniwinther): Handle invalid this access as an |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1569 case BinaryOperatorKind.LT: | 1581 case BinaryOperatorKind.LT: |
| 1570 case BinaryOperatorKind.AND: | 1582 case BinaryOperatorKind.AND: |
| 1571 case BinaryOperatorKind.OR: | 1583 case BinaryOperatorKind.OR: |
| 1572 case BinaryOperatorKind.XOR: | 1584 case BinaryOperatorKind.XOR: |
| 1573 return handleUserDefinableBinary(node, operator); | 1585 return handleUserDefinableBinary(node, operator); |
| 1574 } | 1586 } |
| 1575 } | 1587 } |
| 1576 } | 1588 } |
| 1577 } | 1589 } |
| 1578 | 1590 |
| 1591 /// Handle qualified access to an unresolved static class member, like `a.b` | |
| 1592 /// or `a.b()` where `a` is a class and `b` is unresolved. | |
| 1593 ResolutionResult handleUnresolvedStaticMemberAccess( | |
| 1594 Send node, Name name, ClassElement receiverClass) { | |
| 1595 registry.registerThrowNoSuchMethod(); | |
|
karlklose
2015/06/12 07:01:03
Share code with l. 1599-1630, making the message k
Johnni Winther
2015/06/12 07:50:30
Added a TODO. I wan't to specialize the semantics
| |
| 1596 // TODO(johnniwinther): Produce a different error if [name] is resolves to | |
| 1597 // a constructor. | |
| 1598 | |
| 1599 // TODO(johnniwinther): With the simplified [TreeElements] invariant, | |
| 1600 // try to resolve injected elements if [currentClass] is in the patch | |
| 1601 // library of [receiverClass]. | |
| 1602 | |
| 1603 // TODO(karlklose): this should be reported by the caller of | |
| 1604 // [resolveSend] to select better warning messages for getters and | |
| 1605 // setters. | |
| 1606 ErroneousElement error = reportAndCreateErroneousElement( | |
| 1607 node, name.text, MessageKind.MEMBER_NOT_FOUND, | |
| 1608 {'className': receiverClass.name, 'memberName': name.text}); | |
| 1609 // TODO(johnniwinther): Add an [AccessSemantics] for unresolved static | |
| 1610 // member access. | |
| 1611 return handleErroneousAccess( | |
| 1612 node, name, error, new StaticAccess.unresolved(error)); | |
| 1613 } | |
| 1614 | |
| 1615 /// Handle qualified access of an instance member, like `a.b` or `a.b()` where | |
| 1616 /// `a` is a class and `b` is a non-static member. | |
| 1617 ResolutionResult handleStaticInstanceMemberAccess( | |
| 1618 Send node, Name name, ClassElement receiverClass, Element member) { | |
| 1619 | |
| 1620 registry.registerThrowNoSuchMethod(); | |
| 1621 // TODO(johnniwinther): With the simplified [TreeElements] invariant, | |
| 1622 // try to resolve injected elements if [currentClass] is in the patch | |
| 1623 // library of [receiverClass]. | |
| 1624 | |
| 1625 // TODO(karlklose): this should be reported by the caller of | |
| 1626 // [resolveSend] to select better warning messages for getters and | |
| 1627 // setters. | |
| 1628 ErroneousElement error = reportAndCreateErroneousElement( | |
| 1629 node, name.text, MessageKind.MEMBER_NOT_STATIC, | |
| 1630 {'className': receiverClass.name, 'memberName': name}); | |
| 1631 | |
| 1632 // TODO(johnniwinther): Add an [AccessSemantics] for statically accessed | |
| 1633 // instance members. | |
| 1634 return handleErroneousAccess( | |
| 1635 node, name, error, new StaticAccess.unresolved(error)); | |
| 1636 } | |
| 1637 | |
| 1638 /// Handle qualified access of an inaccessible private static class member, | |
| 1639 /// like `a._b` or `a.b()` where `a` is class, `_b` is static member of `a` | |
| 1640 /// but `a` is not defined in the current library. | |
| 1641 ResolutionResult handlePrivateStaticMemberAccess( | |
| 1642 Send node, Name name, ClassElement receiverClass, Element member) { | |
| 1643 registry.registerThrowNoSuchMethod(); | |
| 1644 ErroneousElement error = reportAndCreateErroneousElement( | |
| 1645 node, name.text, MessageKind.PRIVATE_ACCESS, | |
| 1646 {'libraryName': member.library.getLibraryOrScriptName(), | |
| 1647 'name': name}); | |
| 1648 // TODO(johnniwinther): Add an [AccessSemantics] for unresolved static | |
| 1649 // member access. | |
| 1650 return handleErroneousAccess( | |
| 1651 node, name, error, new StaticAccess.unresolved(error)); | |
| 1652 } | |
| 1653 | |
| 1654 /// Handle qualified access to a static member, like `a.b` or `a.b()` where | |
| 1655 /// `a` is class and `b` is a static member of `a`. | |
|
karlklose
2015/06/12 07:01:03
"`a` is *a* class"
Johnni Winther
2015/06/12 07:50:30
Done.
| |
| 1656 ResolutionResult handleStaticMemberAccess( | |
| 1657 Send node, Name memberName, ClassElement receiverClass) { | |
| 1658 String name = memberName.text; | |
| 1659 receiverClass.ensureResolved(compiler); | |
| 1660 if (node.isOperator) { | |
| 1661 // When the resolved receiver is a class, we can have two cases: | |
| 1662 // 1) a static send: C.foo, or | |
| 1663 // 2) an operator send, where the receiver is a class literal: 'C + 1'. | |
| 1664 // The following code that looks up the selector on the resolved | |
| 1665 // receiver will treat the second as the invocation of a static operator | |
| 1666 // if the resolved receiver is not null. | |
| 1667 return const NoneResult(); | |
| 1668 } | |
| 1669 MembersCreator.computeClassMembersByName( | |
| 1670 compiler, receiverClass.declaration, name); | |
| 1671 Element member = receiverClass.lookupLocalMember(name); | |
| 1672 if (member == null) { | |
| 1673 return handleUnresolvedStaticMemberAccess( | |
| 1674 node, memberName, receiverClass); | |
| 1675 } else if (member.isInstanceMember) { | |
| 1676 return handleStaticInstanceMemberAccess( | |
| 1677 node, memberName, receiverClass, member); | |
| 1678 } else if (memberName.isPrivate && memberName.library != member.library) { | |
| 1679 return handlePrivateStaticMemberAccess( | |
| 1680 node, memberName, receiverClass, member); | |
| 1681 } else { | |
| 1682 return handleStaticOrTopLevelAccess(node, memberName, member); | |
| 1683 } | |
| 1684 } | |
| 1685 | |
| 1686 /// Handle qualified [Send] where the receiver resolves to an [Element], like | |
| 1687 /// `a.b` where `a` is a local, field, class, or prefix, etc. | |
| 1688 ResolutionResult handleResolvedQualifiedSend( | |
| 1689 Send node, Name name, Element element) { | |
| 1690 if (element.isPrefix) { | |
| 1691 return oldVisitSend(node); | |
| 1692 } else if (element.isClass) { | |
| 1693 return handleStaticMemberAccess(node, name, element); | |
| 1694 } | |
| 1695 return oldVisitSend(node); | |
| 1696 } | |
| 1697 | |
| 1698 /// Handle dynamic access of [semantics]. | |
| 1699 ResolutionResult handleDynamicAccessSemantics( | |
| 1700 Send node, Name name, AccessSemantics semantics) { | |
| 1701 SendStructure sendStructure; | |
| 1702 Selector selector; | |
| 1703 if (node.isCall) { | |
| 1704 CallStructure callStructure = resolveArguments(node.argumentsNode); | |
| 1705 selector = new Selector(SelectorKind.CALL, name, callStructure); | |
| 1706 registry.registerDynamicInvocation(selector); | |
| 1707 sendStructure = new InvokeStructure(semantics, selector); | |
| 1708 } else { | |
| 1709 assert(invariant(node, node.isPropertyAccess)); | |
| 1710 selector = new Selector( | |
| 1711 SelectorKind.GETTER, name, CallStructure.NO_ARGS); | |
| 1712 registry.registerDynamicGetter(selector); | |
| 1713 sendStructure = new GetStructure(semantics, selector); | |
| 1714 } | |
| 1715 registry.registerSendStructure(node, sendStructure); | |
| 1716 // TODO(johnniwinther): Remove this when all information goes through | |
| 1717 // the [SendStructure]. | |
| 1718 registry.setSelector(node, selector); | |
| 1719 return const NoneResult(); | |
| 1720 } | |
| 1721 | |
| 1722 /// Handle dynamic property access, like `a.b` or `a.b()` where `a` is not a | |
| 1723 /// prefix or class. | |
| 1724 ResolutionResult handleDynamicPropertyAccess(Send node, Name name) { | |
| 1725 AccessSemantics semantics = | |
| 1726 new DynamicAccess.dynamicProperty(node.receiver); | |
| 1727 return handleDynamicAccessSemantics(node, name, semantics); | |
| 1728 } | |
| 1729 | |
| 1730 /// Handle conditional access, like `a?.b` or `a?.b()`. | |
| 1731 ResolutionResult handleConditionalAccess(Send node, Name name) { | |
| 1732 Node receiver = node.receiver; | |
| 1733 visitExpression(receiver); | |
| 1734 AccessSemantics semantics = | |
| 1735 new DynamicAccess.ifNotNullProperty(receiver); | |
| 1736 return handleDynamicAccessSemantics(node, name, semantics); | |
| 1737 } | |
| 1738 | |
| 1739 /// Handle `this` as a qualified property, like `a.this`. | |
| 1740 ResolutionResult handleQualifiedThisAccess(Send node, Name name) { | |
| 1741 ErroneousElement error = reportAndCreateErroneousElement( | |
| 1742 node.selector, | |
| 1743 name.text, | |
| 1744 MessageKind.THIS_PROPERTY, {}, | |
| 1745 isError: true); | |
| 1746 // TODO(johnniwinther): Support `this` as property as an [AccessSemantics]. | |
| 1747 AccessSemantics accessSemantics = new StaticAccess.unresolved(error); | |
| 1748 return handleErroneousAccess(node, name, error, accessSemantics); | |
| 1749 } | |
| 1750 | |
| 1579 /// Handle a qualified [Send], that is where the receiver is non-null, like | 1751 /// Handle a qualified [Send], that is where the receiver is non-null, like |
| 1580 /// `a.b`, `a.b()`, `this.a()` and `super.a()`. | 1752 /// `a.b`, `a.b()`, `this.a()` and `super.a()`. |
| 1581 ResolutionResult handleQualifiedSend(Send node) { | 1753 ResolutionResult handleQualifiedSend(Send node) { |
| 1582 Identifier selector = node.selector.asIdentifier(); | 1754 Identifier selector = node.selector.asIdentifier(); |
| 1583 Name name = new Name(selector.source, enclosingElement.library); | 1755 String text = selector.source; |
| 1584 if (node.isSuperCall) { | 1756 Name name = new Name(text, enclosingElement.library); |
| 1757 if (text == 'this') { | |
| 1758 return handleQualifiedThisAccess(node, name); | |
| 1759 } else if (node.isSuperCall) { | |
| 1585 return handleSuperPropertyAccess(node, name); | 1760 return handleSuperPropertyAccess(node, name); |
| 1586 } else if (node.receiver.isThis()) { | 1761 } else if (node.receiver.isThis()) { |
| 1587 if (checkThisAccess(node)) { | 1762 if (checkThisAccess(node)) { |
| 1588 return handleThisPropertyAccess(node, name); | 1763 return handleThisPropertyAccess(node, name); |
| 1589 } | 1764 } |
| 1590 // TODO(johnniwinther): Handle invalid this access as an | 1765 // TODO(johnniwinther): Handle invalid this access as an |
| 1591 // [AccessSemantics]. | 1766 // [AccessSemantics]. |
| 1592 return const NoneResult(); | 1767 return const NoneResult(); |
| 1768 } else if (node.isConditional) { | |
| 1769 return handleConditionalAccess(node, name); | |
| 1593 } | 1770 } |
| 1594 // TODO(johnniwinther): Handle remaining qualified sends. | 1771 ResolutionResult result = visitExpressionPrefix(node.receiver); |
| 1595 return oldVisitSend(node); | 1772 if (result.element != null) { |
| 1773 return handleResolvedQualifiedSend(node, name, result.element); | |
| 1774 } else { | |
| 1775 return handleDynamicPropertyAccess(node, name); | |
| 1776 } | |
| 1596 } | 1777 } |
| 1597 | 1778 |
| 1598 /// Handle access unresolved access to [name] in a non-instance context. | 1779 /// Handle access unresolved access to [name] in a non-instance context. |
| 1599 ResolutionResult handleUnresolvedAccess( | 1780 ResolutionResult handleUnresolvedAccess( |
| 1600 Send node, Name name, Element element) { | 1781 Send node, Name name, Element element) { |
| 1601 // TODO(johnniwinther): Support unresolved top level access as an | 1782 // TODO(johnniwinther): Support unresolved top level access as an |
| 1602 // [AccessSemantics]. | 1783 // [AccessSemantics]. |
| 1603 AccessSemantics accessSemantics = new StaticAccess.unresolved(element); | 1784 AccessSemantics accessSemantics = new StaticAccess.unresolved(element); |
| 1604 return handleErroneousAccess(node, name, element, accessSemantics); | 1785 return handleErroneousAccess(node, name, element, accessSemantics); |
| 1605 } | 1786 } |
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2457 ResolutionResult visitWhile(While node) { | 2638 ResolutionResult visitWhile(While node) { |
| 2458 visit(node.condition); | 2639 visit(node.condition); |
| 2459 visitLoopBodyIn(node, node.body, new BlockScope(scope)); | 2640 visitLoopBodyIn(node, node.body, new BlockScope(scope)); |
| 2460 return const NoneResult(); | 2641 return const NoneResult(); |
| 2461 } | 2642 } |
| 2462 | 2643 |
| 2463 ResolutionResult visitParenthesizedExpression(ParenthesizedExpression node) { | 2644 ResolutionResult visitParenthesizedExpression(ParenthesizedExpression node) { |
| 2464 bool oldSendIsMemberAccess = sendIsMemberAccess; | 2645 bool oldSendIsMemberAccess = sendIsMemberAccess; |
| 2465 sendIsMemberAccess = false; | 2646 sendIsMemberAccess = false; |
| 2466 var oldCategory = allowedCategory; | 2647 var oldCategory = allowedCategory; |
| 2467 allowedCategory = ElementCategory.VARIABLE | ElementCategory.FUNCTION | 2648 allowedCategory = |
| 2468 | ElementCategory.IMPLIES_TYPE; | 2649 ElementCategory.VARIABLE | |
| 2650 ElementCategory.FUNCTION | | |
| 2651 ElementCategory.IMPLIES_TYPE; | |
| 2469 ResolutionResult result = visit(node.expression); | 2652 ResolutionResult result = visit(node.expression); |
| 2470 allowedCategory = oldCategory; | 2653 allowedCategory = oldCategory; |
| 2471 sendIsMemberAccess = oldSendIsMemberAccess; | 2654 sendIsMemberAccess = oldSendIsMemberAccess; |
| 2472 if (result.kind == ResultKind.CONSTANT) { | 2655 if (result.kind == ResultKind.CONSTANT) { |
| 2473 return result; | 2656 return result; |
| 2474 } | 2657 } |
| 2475 return const NoneResult(); | 2658 return const NoneResult(); |
| 2476 } | 2659 } |
| 2477 | 2660 |
| 2478 ResolutionResult visitNewExpression(NewExpression node) { | 2661 ResolutionResult visitNewExpression(NewExpression node) { |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3273 } | 3456 } |
| 3274 return const NoneResult(); | 3457 return const NoneResult(); |
| 3275 } | 3458 } |
| 3276 } | 3459 } |
| 3277 | 3460 |
| 3278 /// Looks up [name] in [scope] and unwraps the result. | 3461 /// Looks up [name] in [scope] and unwraps the result. |
| 3279 Element lookupInScope(Compiler compiler, Node node, | 3462 Element lookupInScope(Compiler compiler, Node node, |
| 3280 Scope scope, String name) { | 3463 Scope scope, String name) { |
| 3281 return Elements.unwrap(scope.lookup(name), compiler, node); | 3464 return Elements.unwrap(scope.lookup(name), compiler, node); |
| 3282 } | 3465 } |
| OLD | NEW |