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 elements; | 5 library elements; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/resolution.dart' show Resolution; | 8 import '../common/resolution.dart' show Resolution; |
9 import '../compiler.dart' show Compiler; | 9 import '../compiler.dart' show Compiler; |
10 import '../constants/constructors.dart'; | 10 import '../constants/constructors.dart'; |
(...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1679 /// For functions and constructors this is the root AST node of the method | 1679 /// For functions and constructors this is the root AST node of the method |
1680 /// body, and for variables this is the root AST node of the initializer, if | 1680 /// body, and for variables this is the root AST node of the initializer, if |
1681 /// available. | 1681 /// available. |
1682 /// | 1682 /// |
1683 /// This only available if [kind] is `ResolvedAstKind.PARSED`. | 1683 /// This only available if [kind] is `ResolvedAstKind.PARSED`. |
1684 Node get body; | 1684 Node get body; |
1685 | 1685 |
1686 /// The [TreeElements] containing the resolution data for [node]. This only | 1686 /// The [TreeElements] containing the resolution data for [node]. This only |
1687 /// available of [kind] is `ResolvedAstKind.PARSED`. | 1687 /// available of [kind] is `ResolvedAstKind.PARSED`. |
1688 TreeElements get elements; | 1688 TreeElements get elements; |
| 1689 |
| 1690 /// Returns the uri for the source file defining [node] and [body]. This |
| 1691 /// only available if [kind] is `ResolvedAstKind.PARSED`. |
| 1692 Uri get sourceUri; |
1689 } | 1693 } |
1690 | 1694 |
1691 /// [ResolvedAst] implementation used for elements whose semantics is defined in | 1695 /// [ResolvedAst] implementation used for elements whose semantics is defined in |
1692 /// terms an AST and a [TreeElements]. | 1696 /// terms an AST and a [TreeElements]. |
1693 class ParsedResolvedAst implements ResolvedAst { | 1697 class ParsedResolvedAst implements ResolvedAst { |
1694 final Element element; | 1698 final Element element; |
1695 final Node node; | 1699 final Node node; |
1696 final Node body; | 1700 final Node body; |
1697 final TreeElements elements; | 1701 final TreeElements elements; |
| 1702 final Uri sourceUri; |
1698 | 1703 |
1699 ParsedResolvedAst(this.element, this.node, this.body, this.elements); | 1704 ParsedResolvedAst( |
| 1705 this.element, this.node, this.body, this.elements, this.sourceUri); |
1700 | 1706 |
1701 ResolvedAstKind get kind => ResolvedAstKind.PARSED; | 1707 ResolvedAstKind get kind => ResolvedAstKind.PARSED; |
1702 | 1708 |
1703 String toString() => '$kind:$element:$node'; | 1709 String toString() => '$kind:$element:$node'; |
1704 } | 1710 } |
1705 | 1711 |
1706 /// [ResolvedAst] implementation used for synthesized elements whose semantics | 1712 /// [ResolvedAst] implementation used for synthesized elements whose semantics |
1707 /// is not defined in terms an AST and a [TreeElements]. | 1713 /// is not defined in terms an AST and a [TreeElements]. |
1708 class SynthesizedResolvedAst implements ResolvedAst { | 1714 class SynthesizedResolvedAst implements ResolvedAst { |
1709 final Element element; | 1715 final Element element; |
1710 final ResolvedAstKind kind; | 1716 final ResolvedAstKind kind; |
1711 | 1717 |
1712 SynthesizedResolvedAst(this.element, this.kind); | 1718 SynthesizedResolvedAst(this.element, this.kind); |
1713 | 1719 |
1714 @override | 1720 @override |
1715 TreeElements get elements { | 1721 TreeElements get elements { |
1716 throw new UnsupportedError('$this does not provide a TreeElements'); | 1722 throw new UnsupportedError('$this does not provide a TreeElements'); |
1717 } | 1723 } |
1718 | 1724 |
1719 @override | 1725 @override |
1720 Node get node { | 1726 Node get node { |
1721 throw new UnsupportedError('$this does not have a root AST node'); | 1727 throw new UnsupportedError('$this does not have a root AST node'); |
1722 } | 1728 } |
1723 | 1729 |
1724 @override | 1730 @override |
1725 Node get body { | 1731 Node get body { |
1726 throw new UnsupportedError('$this does not have a body AST node'); | 1732 throw new UnsupportedError('$this does not have a body AST node'); |
1727 } | 1733 } |
1728 | 1734 |
| 1735 @override |
| 1736 Uri get sourceUri { |
| 1737 throw new UnsupportedError('$this does not have a source URI'); |
| 1738 } |
| 1739 |
1729 String toString() => '$kind:$element'; | 1740 String toString() => '$kind:$element'; |
1730 } | 1741 } |
1731 | 1742 |
1732 /// A [MemberSignature] is a member of an interface. | 1743 /// A [MemberSignature] is a member of an interface. |
1733 /// | 1744 /// |
1734 /// A signature is either a method or a getter or setter, possibly implicitly | 1745 /// A signature is either a method or a getter or setter, possibly implicitly |
1735 /// defined by a field declarations. Fields themselves are not members of an | 1746 /// defined by a field declarations. Fields themselves are not members of an |
1736 /// interface. | 1747 /// interface. |
1737 /// | 1748 /// |
1738 /// A [MemberSignature] may be defined by a member declaration or may be | 1749 /// A [MemberSignature] may be defined by a member declaration or may be |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1801 /// by a field. | 1812 /// by a field. |
1802 bool get isDeclaredByField; | 1813 bool get isDeclaredByField; |
1803 | 1814 |
1804 /// Returns `true` if this member is abstract. | 1815 /// Returns `true` if this member is abstract. |
1805 bool get isAbstract; | 1816 bool get isAbstract; |
1806 | 1817 |
1807 /// If abstract, [implementation] points to the overridden concrete member, | 1818 /// If abstract, [implementation] points to the overridden concrete member, |
1808 /// if any. Otherwise [implementation] points to the member itself. | 1819 /// if any. Otherwise [implementation] points to the member itself. |
1809 Member get implementation; | 1820 Member get implementation; |
1810 } | 1821 } |
OLD | NEW |