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

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

Issue 12033003: Deferred (aka lazy) loading of static functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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 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 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after
1708 return new LibraryName(tag.token, argument); 1708 return new LibraryName(tag.token, argument);
1709 } else if (isSource()) { 1709 } else if (isSource()) {
1710 return new Part(tag.token, argument); 1710 return new Part(tag.token, argument);
1711 } else { 1711 } else {
1712 throw 'Unknown script tag ${tag.token.slowToString()}'; 1712 throw 'Unknown script tag ${tag.token.slowToString()}';
1713 } 1713 }
1714 } 1714 }
1715 } 1715 }
1716 1716
1717 abstract class LibraryTag extends Node { 1717 abstract class LibraryTag extends Node {
1718 final Link<MetadataAnnotation> metadata;
1719
1720 LibraryTag(this.metadata);
1721
1718 bool get isLibraryName => false; 1722 bool get isLibraryName => false;
1719 bool get isImport => false; 1723 bool get isImport => false;
1720 bool get isExport => false; 1724 bool get isExport => false;
1721 bool get isPart => false; 1725 bool get isPart => false;
1722 bool get isPartOf => false; 1726 bool get isPartOf => false;
1723 } 1727 }
1724 1728
1725 class LibraryName extends LibraryTag { 1729 class LibraryName extends LibraryTag {
1726 final Expression name; 1730 final Expression name;
1727 1731
1728 final Token libraryKeyword; 1732 final Token libraryKeyword;
1729 1733
1730 LibraryName(this.libraryKeyword, this.name); 1734 LibraryName(this.libraryKeyword,
1735 this.name,
1736 Link<MetadataAnnotation> metadata)
1737 : super(metadata);
1731 1738
1732 bool get isLibraryName => true; 1739 bool get isLibraryName => true;
1733 1740
1734 LibraryName asLibraryName() => this; 1741 LibraryName asLibraryName() => this;
1735 1742
1736 accept(Visitor visitor) => visitor.visitLibraryName(this); 1743 accept(Visitor visitor) => visitor.visitLibraryName(this);
1737 1744
1738 visitChildren(Visitor visitor) => name.accept(visitor); 1745 visitChildren(Visitor visitor) => name.accept(visitor);
1739 1746
1740 Token getBeginToken() => libraryKeyword; 1747 Token getBeginToken() => libraryKeyword;
1741 1748
1742 Token getEndToken() => name.getEndToken().next; 1749 Token getEndToken() => name.getEndToken().next;
1743 } 1750 }
1744 1751
1745 /** 1752 /**
1746 * This tag describes a dependency between one library and the exported 1753 * This tag describes a dependency between one library and the exported
1747 * identifiers of another library. The other library is specified by the [uri]. 1754 * identifiers of another library. The other library is specified by the [uri].
1748 * Combinators filter away some identifiers from the other library. 1755 * Combinators filter away some identifiers from the other library.
1749 */ 1756 */
1750 abstract class LibraryDependency extends LibraryTag { 1757 abstract class LibraryDependency extends LibraryTag {
1751 final StringNode uri; 1758 final StringNode uri;
1752 final NodeList combinators; 1759 final NodeList combinators;
1753 1760
1754 LibraryDependency(this.uri, this.combinators); 1761 LibraryDependency(this.uri,
1762 this.combinators,
1763 Link<MetadataAnnotation> metadata)
1764 : super(metadata);
1755 } 1765 }
1756 1766
1757 /** 1767 /**
1758 * An [:import:] library tag. 1768 * An [:import:] library tag.
1759 * 1769 *
1760 * An import tag is dependency on another library where the exported identifiers 1770 * An import tag is dependency on another library where the exported identifiers
1761 * are put into the import scope of the importing library. The import scope is 1771 * are put into the import scope of the importing library. The import scope is
1762 * only visible inside the library. 1772 * only visible inside the library.
1763 */ 1773 */
1764 class Import extends LibraryDependency { 1774 class Import extends LibraryDependency {
1765 final Identifier prefix; 1775 final Identifier prefix;
1766 final Token importKeyword; 1776 final Token importKeyword;
1767 1777
1768 Import(this.importKeyword, StringNode uri, 1778 Import(this.importKeyword, StringNode uri,
1769 this.prefix, NodeList combinators) 1779 this.prefix, NodeList combinators,
1770 : super(uri, combinators); 1780 Link<MetadataAnnotation> metadata)
1781 : super(uri, combinators, metadata);
1771 1782
1772 bool get isImport => true; 1783 bool get isImport => true;
1773 1784
1774 Import asImport() => this; 1785 Import asImport() => this;
1775 1786
1776 Token get asKeyword => prefix == null ? null : uri.getEndToken().next; 1787 Token get asKeyword => prefix == null ? null : uri.getEndToken().next;
1777 1788
1778 accept(Visitor visitor) => visitor.visitImport(this); 1789 accept(Visitor visitor) => visitor.visitImport(this);
1779 1790
1780 visitChildren(Visitor visitor) { 1791 visitChildren(Visitor visitor) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1822 if (combinators != null) return combinators.getEndToken().next; 1833 if (combinators != null) return combinators.getEndToken().next;
1823 return uri.getEndToken().next; 1834 return uri.getEndToken().next;
1824 } 1835 }
1825 } 1836 }
1826 1837
1827 class Part extends LibraryTag { 1838 class Part extends LibraryTag {
1828 final StringNode uri; 1839 final StringNode uri;
1829 1840
1830 final Token partKeyword; 1841 final Token partKeyword;
1831 1842
1832 Part(this.partKeyword, this.uri); 1843 Part(this.partKeyword, this.uri, Link<MetadataAnnotation> metadata)
1844 : super(metadata);
1833 1845
1834 bool get isPart => true; 1846 bool get isPart => true;
1835 1847
1836 Part asPart() => this; 1848 Part asPart() => this;
1837 1849
1838 accept(Visitor visitor) => visitor.visitPart(this); 1850 accept(Visitor visitor) => visitor.visitPart(this);
1839 1851
1840 visitChildren(Visitor visitor) => uri.accept(visitor); 1852 visitChildren(Visitor visitor) => uri.accept(visitor);
1841 1853
1842 Token getBeginToken() => partKeyword; 1854 Token getBeginToken() => partKeyword;
1843 1855
1844 Token getEndToken() => uri.getEndToken().next; 1856 Token getEndToken() => uri.getEndToken().next;
1845 } 1857 }
1846 1858
1847 class PartOf extends Node { 1859 class PartOf extends Node {
1848 final Expression name; 1860 final Expression name;
1849 1861
1850 final Token partKeyword; 1862 final Token partKeyword;
1851 1863
1852 PartOf(this.partKeyword, this.name); 1864 final Link<MetadataAnnotation> metadata;
1865
1866 PartOf(this.partKeyword, this.name, this.metadata);
1853 1867
1854 Token get ofKeyword => partKeyword.next; 1868 Token get ofKeyword => partKeyword.next;
1855 1869
1856 bool get isPartOf => true; 1870 bool get isPartOf => true;
1857 1871
1858 PartOf asPartOf() => this; 1872 PartOf asPartOf() => this;
1859 1873
1860 accept(Visitor visitor) => visitor.visitPartOf(this); 1874 accept(Visitor visitor) => visitor.visitPartOf(this);
1861 1875
1862 visitChildren(Visitor visitor) => name.accept(visitor); 1876 visitChildren(Visitor visitor) => name.accept(visitor);
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
2062 * argument). 2076 * argument).
2063 * 2077 *
2064 * TODO(ahe): This method is controversial, the team needs to discuss 2078 * TODO(ahe): This method is controversial, the team needs to discuss
2065 * if top-level methods are acceptable and what naming conventions to 2079 * if top-level methods are acceptable and what naming conventions to
2066 * use. 2080 * use.
2067 */ 2081 */
2068 initializerDo(Node node, f(Node node)) { 2082 initializerDo(Node node, f(Node node)) {
2069 SendSet send = node.asSendSet(); 2083 SendSet send = node.asSendSet();
2070 if (send != null) return f(send.arguments.head); 2084 if (send != null) return f(send.arguments.head);
2071 } 2085 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698