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 abstract class TreeElements { | 7 abstract class TreeElements { |
| 8 Element get currentElement; | 8 Element get currentElement; |
| 9 Set<Node> get superUses; | 9 Set<Node> get superUses; |
| 10 | 10 |
| (...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1468 return type; | 1468 return type; |
| 1469 } | 1469 } |
| 1470 | 1470 |
| 1471 if (element == null) { | 1471 if (element == null) { |
| 1472 type = reportFailureAndCreateType( | 1472 type = reportFailureAndCreateType( |
| 1473 MessageKind.CANNOT_RESOLVE_TYPE, {'typeName': node.typeName}); | 1473 MessageKind.CANNOT_RESOLVE_TYPE, {'typeName': node.typeName}); |
| 1474 } else if (element.isAmbiguous()) { | 1474 } else if (element.isAmbiguous()) { |
| 1475 AmbiguousElement ambiguous = element; | 1475 AmbiguousElement ambiguous = element; |
| 1476 type = reportFailureAndCreateType( | 1476 type = reportFailureAndCreateType( |
| 1477 ambiguous.messageKind, ambiguous.messageArguments); | 1477 ambiguous.messageKind, ambiguous.messageArguments); |
| 1478 if (ambiguous.existingElement == ambiguous.newElement) { | |
| 1479 compiler.reportMessage( | |
| 1480 compiler.spanFromSpannable(ambiguous.existingElement), | |
| 1481 MessageKind.GENERIC.error( | |
| 1482 {'text': 'Giladism: you cannot refer to the same element ' | |
|
ahe
2013/04/17 14:56:25
Perhaps Gilad can help us come up with a better er
| |
| 1483 'through different imports.'}), | |
| 1484 Diagnostic.INFO); | |
| 1485 } else { | |
| 1486 compiler.reportMessage( | |
| 1487 compiler.spanFromSpannable(ambiguous.existingElement), | |
| 1488 MessageKind.GENERIC.error( | |
| 1489 {'text': 'Note: this is the location of the first element.'}), | |
| 1490 Diagnostic.INFO); | |
| 1491 compiler.reportMessage( | |
| 1492 compiler.spanFromSpannable(ambiguous.newElement), | |
| 1493 MessageKind.GENERIC.error( | |
| 1494 {'text': 'Note: this is the location of the second element.'}), | |
| 1495 Diagnostic.INFO); | |
| 1496 } | |
| 1478 } else if (!element.impliesType()) { | 1497 } else if (!element.impliesType()) { |
| 1479 type = reportFailureAndCreateType( | 1498 type = reportFailureAndCreateType( |
| 1480 MessageKind.NOT_A_TYPE, {'node': node.typeName}); | 1499 MessageKind.NOT_A_TYPE, {'node': node.typeName}); |
| 1481 } else { | 1500 } else { |
| 1482 if (identical(element, compiler.types.voidType.element) || | 1501 if (identical(element, compiler.types.voidType.element) || |
| 1483 identical(element, compiler.types.dynamicType.element)) { | 1502 identical(element, compiler.types.dynamicType.element)) { |
| 1484 type = checkNoTypeArguments(element.computeType(compiler)); | 1503 type = checkNoTypeArguments(element.computeType(compiler)); |
| 1485 } else if (element.isClass()) { | 1504 } else if (element.isClass()) { |
| 1486 ClassElement cls = element; | 1505 ClassElement cls = element; |
| 1487 compiler.resolver._ensureClassWillBeResolved(cls); | 1506 compiler.resolver._ensureClassWillBeResolved(cls); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1648 if (!inInstanceContext && result.isInstanceMember()) { | 1667 if (!inInstanceContext && result.isInstanceMember()) { |
| 1649 compiler.reportErrorCode( | 1668 compiler.reportErrorCode( |
| 1650 node, MessageKind.NO_INSTANCE_AVAILABLE, {'name': name}); | 1669 node, MessageKind.NO_INSTANCE_AVAILABLE, {'name': name}); |
| 1651 return new ErroneousElementX(MessageKind.NO_INSTANCE_AVAILABLE, | 1670 return new ErroneousElementX(MessageKind.NO_INSTANCE_AVAILABLE, |
| 1652 {'name': name}, | 1671 {'name': name}, |
| 1653 name, enclosingElement); | 1672 name, enclosingElement); |
| 1654 } else if (result.isAmbiguous()) { | 1673 } else if (result.isAmbiguous()) { |
| 1655 AmbiguousElement ambiguous = result; | 1674 AmbiguousElement ambiguous = result; |
| 1656 compiler.reportErrorCode( | 1675 compiler.reportErrorCode( |
| 1657 node, ambiguous.messageKind, ambiguous.messageArguments); | 1676 node, ambiguous.messageKind, ambiguous.messageArguments); |
| 1677 if (ambiguous.existingElement == ambiguous.newElement) { | |
| 1678 compiler.reportMessage( | |
| 1679 compiler.spanFromSpannable(ambiguous.existingElement), | |
| 1680 MessageKind.GENERIC.error( | |
| 1681 {'text': 'Giladism: you cannot refer to the same element ' | |
| 1682 'through different imports.'}), | |
| 1683 Diagnostic.INFO); | |
| 1684 } else { | |
| 1685 compiler.reportMessage( | |
| 1686 compiler.spanFromSpannable(ambiguous.existingElement), | |
| 1687 MessageKind.GENERIC.error( | |
| 1688 {'text': 'Note: this is the location of the first element.'}), | |
| 1689 Diagnostic.INFO); | |
| 1690 compiler.reportMessage( | |
| 1691 compiler.spanFromSpannable(ambiguous.newElement), | |
| 1692 MessageKind.GENERIC.error( | |
| 1693 {'text': | |
| 1694 'Note: this is the location of the second element.'}), | |
| 1695 Diagnostic.INFO); | |
| 1696 } | |
| 1658 return new ErroneousElementX(ambiguous.messageKind, | 1697 return new ErroneousElementX(ambiguous.messageKind, |
| 1659 ambiguous.messageArguments, | 1698 ambiguous.messageArguments, |
| 1660 name, enclosingElement); | 1699 name, enclosingElement); |
| 1661 } | 1700 } |
| 1662 } | 1701 } |
| 1663 return result; | 1702 return result; |
| 1664 } | 1703 } |
| 1665 | 1704 |
| 1666 // Create, or reuse an already created, statement element for a statement. | 1705 // Create, or reuse an already created, statement element for a statement. |
| 1667 TargetElement getOrCreateTargetElement(Node statement) { | 1706 TargetElement getOrCreateTargetElement(Node statement) { |
| (...skipping 2208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3876 return e; | 3915 return e; |
| 3877 } | 3916 } |
| 3878 | 3917 |
| 3879 /// Assumed to be called by [resolveRedirectingFactory]. | 3918 /// Assumed to be called by [resolveRedirectingFactory]. |
| 3880 Element visitReturn(Return node) { | 3919 Element visitReturn(Return node) { |
| 3881 Node expression = node.expression; | 3920 Node expression = node.expression; |
| 3882 return finishConstructorReference(visit(expression), | 3921 return finishConstructorReference(visit(expression), |
| 3883 expression, expression); | 3922 expression, expression); |
| 3884 } | 3923 } |
| 3885 } | 3924 } |
| OLD | NEW |