Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: lib/compiler/implementation/tree/nodes.dart

Issue 10990060: Added support for exports and re-exports. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed redundant check. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 abstract class Visitor<R> { 5 abstract class Visitor<R> {
6 R visitBlock(Block node); 6 R visitBlock(Block node);
7 R visitBreakStatement(BreakStatement node); 7 R visitBreakStatement(BreakStatement node);
8 R visitCascade(Cascade node); 8 R visitCascade(Cascade node);
9 R visitCascadeReceiver(CascadeReceiver node); 9 R visitCascadeReceiver(CascadeReceiver node);
10 R visitCaseMatch(CaseMatch node); 10 R visitCaseMatch(CaseMatch node);
(...skipping 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 1635
1636 accept(Visitor visitor) => visitor.visitLibraryName(this); 1636 accept(Visitor visitor) => visitor.visitLibraryName(this);
1637 1637
1638 visitChildren(Visitor visitor) => name.accept(visitor); 1638 visitChildren(Visitor visitor) => name.accept(visitor);
1639 1639
1640 Token getBeginToken() => libraryKeyword; 1640 Token getBeginToken() => libraryKeyword;
1641 1641
1642 Token getEndToken() => name.getEndToken().next; 1642 Token getEndToken() => name.getEndToken().next;
1643 } 1643 }
1644 1644
1645 class Import extends LibraryTag { 1645 abstract class ImportExport extends LibraryTag {
Lasse Reichstein Nielsen 2012/09/28 07:45:36 Call it LibraryDependency (or something better if
Johnni Winther 2012/10/09 09:47:10 Done.
1646 final LiteralString uri; 1646 final LiteralString uri;
1647 final Identifier prefix;
1648 final NodeList combinators; 1647 final NodeList combinators;
1649 1648
1649 ImportExport(this.uri, this.combinators);
1650 }
1651
1652 class Import extends ImportExport {
Lasse Reichstein Nielsen 2012/09/28 07:45:36 Comment to the effect that an Import is dependency
Johnni Winther 2012/10/09 09:47:10 Done.
1653 final Identifier prefix;
1650 final Token importKeyword; 1654 final Token importKeyword;
1651 1655
1652 Import(this.importKeyword, this.uri, this.prefix, this.combinators); 1656 Import(this.importKeyword, LiteralString uri,
1657 this.prefix, NodeList combinators)
1658 : super(uri, combinators);
1653 1659
1654 bool get isImport => true; 1660 bool get isImport => true;
1655 1661
1656 Import asImport() => this; 1662 Import asImport() => this;
1657 1663
1658 accept(Visitor visitor) => visitor.visitImport(this); 1664 accept(Visitor visitor) => visitor.visitImport(this);
1659 1665
1660 visitChildren(Visitor visitor) { 1666 visitChildren(Visitor visitor) {
1661 uri.accept(visitor); 1667 uri.accept(visitor);
1662 if (prefix !== null) prefix.accept(visitor); 1668 if (prefix !== null) prefix.accept(visitor);
1663 if (combinators !== null) combinators.accept(visitor); 1669 if (combinators !== null) combinators.accept(visitor);
1664 } 1670 }
1665 1671
1666 Token getBeginToken() => importKeyword; 1672 Token getBeginToken() => importKeyword;
1667 1673
1668 Token getEndToken() { 1674 Token getEndToken() {
1669 if (combinators !== null) return combinators.getEndToken().next; 1675 if (combinators !== null) return combinators.getEndToken().next;
1670 if (prefix !== null) return prefix.getEndToken().next; 1676 if (prefix !== null) return prefix.getEndToken().next;
1671 return uri.getEndToken().next; 1677 return uri.getEndToken().next;
1672 } 1678 }
1673 } 1679 }
1674 1680
1675 class Export extends LibraryTag { 1681 class Export extends ImportExport {
Lasse Reichstein Nielsen 2012/09/28 07:45:36 And a comment too, describing what an export is re
Johnni Winther 2012/10/09 09:47:10 Done.
1676 final LiteralString uri;
1677 final NodeList combinators;
1678
1679 final Token exportKeyword; 1682 final Token exportKeyword;
1680 1683
1681 Export(this.exportKeyword, this.uri, this.combinators); 1684 Export(this.exportKeyword, LiteralString uri, NodeList combinators)
1685 : super(uri, combinators);
1682 1686
1683 bool get isExport => true; 1687 bool get isExport => true;
1684 1688
1685 Export asExport() => this; 1689 Export asExport() => this;
1686 1690
1687 accept(Visitor visitor) => visitor.visitExport(this); 1691 accept(Visitor visitor) => visitor.visitExport(this);
1688 1692
1689 visitChildren(Visitor visitor) { 1693 visitChildren(Visitor visitor) {
1690 uri.accept(visitor); 1694 uri.accept(visitor);
1691 if (combinators !== null) combinators.accept(visitor); 1695 if (combinators !== null) combinators.accept(visitor);
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1893 * argument). 1897 * argument).
1894 * 1898 *
1895 * TODO(ahe): This method is controversial, the team needs to discuss 1899 * TODO(ahe): This method is controversial, the team needs to discuss
1896 * if top-level methods are acceptable and what naming conventions to 1900 * if top-level methods are acceptable and what naming conventions to
1897 * use. 1901 * use.
1898 */ 1902 */
1899 initializerDo(Node node, f(Node node)) { 1903 initializerDo(Node node, f(Node node)) {
1900 SendSet send = node.asSendSet(); 1904 SendSet send = node.asSendSet();
1901 if (send !== null) return f(send.arguments.head); 1905 if (send !== null) return f(send.arguments.head);
1902 } 1906 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698