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 tree; | 5 part of tree; |
6 | 6 |
7 abstract class Visitor<R> { | 7 abstract class Visitor<R> { |
8 const Visitor(); | 8 const Visitor(); |
9 | 9 |
10 R visitNode(Node node); | 10 R visitNode(Node node); |
(...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1677 | 1677 |
1678 Token getEndToken() => name.getEndToken().next; | 1678 Token getEndToken() => name.getEndToken().next; |
1679 } | 1679 } |
1680 | 1680 |
1681 /** | 1681 /** |
1682 * This tag describes a dependency between one library and the exported | 1682 * This tag describes a dependency between one library and the exported |
1683 * identifiers of another library. The other library is specified by the [uri]. | 1683 * identifiers of another library. The other library is specified by the [uri]. |
1684 * Combinators filter away some identifiers from the other library. | 1684 * Combinators filter away some identifiers from the other library. |
1685 */ | 1685 */ |
1686 abstract class LibraryDependency extends LibraryTag { | 1686 abstract class LibraryDependency extends LibraryTag { |
1687 final LiteralString uri; | 1687 final StringNode uri; |
1688 final NodeList combinators; | 1688 final NodeList combinators; |
1689 | 1689 |
1690 LibraryDependency(this.uri, this.combinators); | 1690 LibraryDependency(this.uri, this.combinators); |
1691 } | 1691 } |
1692 | 1692 |
1693 /** | 1693 /** |
1694 * An [:import:] library tag. | 1694 * An [:import:] library tag. |
1695 * | 1695 * |
1696 * An import tag is dependency on another library where the exported identifiers | 1696 * An import tag is dependency on another library where the exported identifiers |
1697 * are put into the import scope of the importing library. The import scope is | 1697 * are put into the import scope of the importing library. The import scope is |
1698 * only visible inside the library. | 1698 * only visible inside the library. |
1699 */ | 1699 */ |
1700 class Import extends LibraryDependency { | 1700 class Import extends LibraryDependency { |
1701 final Identifier prefix; | 1701 final Identifier prefix; |
1702 final Token importKeyword; | 1702 final Token importKeyword; |
1703 | 1703 |
1704 Import(this.importKeyword, LiteralString uri, | 1704 Import(this.importKeyword, StringNode uri, |
1705 this.prefix, NodeList combinators) | 1705 this.prefix, NodeList combinators) |
1706 : super(uri, combinators); | 1706 : super(uri, combinators); |
1707 | 1707 |
1708 bool get isImport => true; | 1708 bool get isImport => true; |
1709 | 1709 |
1710 Import asImport() => this; | 1710 Import asImport() => this; |
1711 | 1711 |
1712 Token get asKeyword => prefix == null ? null : uri.getEndToken().next; | 1712 Token get asKeyword => prefix == null ? null : uri.getEndToken().next; |
1713 | 1713 |
1714 accept(Visitor visitor) => visitor.visitImport(this); | 1714 accept(Visitor visitor) => visitor.visitImport(this); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1754 | 1754 |
1755 Token getBeginToken() => exportKeyword; | 1755 Token getBeginToken() => exportKeyword; |
1756 | 1756 |
1757 Token getEndToken() { | 1757 Token getEndToken() { |
1758 if (combinators != null) return combinators.getEndToken().next; | 1758 if (combinators != null) return combinators.getEndToken().next; |
1759 return uri.getEndToken().next; | 1759 return uri.getEndToken().next; |
1760 } | 1760 } |
1761 } | 1761 } |
1762 | 1762 |
1763 class Part extends LibraryTag { | 1763 class Part extends LibraryTag { |
1764 final LiteralString uri; | 1764 final StringNode uri; |
1765 | 1765 |
1766 final Token partKeyword; | 1766 final Token partKeyword; |
1767 | 1767 |
1768 Part(this.partKeyword, this.uri); | 1768 Part(this.partKeyword, this.uri); |
1769 | 1769 |
1770 bool get isPart => true; | 1770 bool get isPart => true; |
1771 | 1771 |
1772 Part asPart() => this; | 1772 Part asPart() => this; |
1773 | 1773 |
1774 accept(Visitor visitor) => visitor.visitPart(this); | 1774 accept(Visitor visitor) => visitor.visitPart(this); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1998 * argument). | 1998 * argument). |
1999 * | 1999 * |
2000 * TODO(ahe): This method is controversial, the team needs to discuss | 2000 * TODO(ahe): This method is controversial, the team needs to discuss |
2001 * if top-level methods are acceptable and what naming conventions to | 2001 * if top-level methods are acceptable and what naming conventions to |
2002 * use. | 2002 * use. |
2003 */ | 2003 */ |
2004 initializerDo(Node node, f(Node node)) { | 2004 initializerDo(Node node, f(Node node)) { |
2005 SendSet send = node.asSendSet(); | 2005 SendSet send = node.asSendSet(); |
2006 if (send != null) return f(send.arguments.head); | 2006 if (send != null) return f(send.arguments.head); |
2007 } | 2007 } |
OLD | NEW |