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

Side by Side Diff: pkg/compiler/lib/src/tree/nodes.dart

Issue 1302333006: Support metadata on patches. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Remove partial renaming Created 5 years, 3 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
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 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after
1890 } 1890 }
1891 1891
1892 Token getBeginToken() => labels.getBeginToken(); 1892 Token getBeginToken() => labels.getBeginToken();
1893 1893
1894 Token getEndToken() => statement.getEndToken(); 1894 Token getEndToken() => statement.getEndToken();
1895 1895
1896 bool isValidContinueTarget() => statement.isValidContinueTarget(); 1896 bool isValidContinueTarget() => statement.isValidContinueTarget();
1897 } 1897 }
1898 1898
1899 abstract class LibraryTag extends Node { 1899 abstract class LibraryTag extends Node {
1900 final Link<MetadataAnnotation> metadata; 1900 final List<MetadataAnnotation> metadata;
1901 1901
1902 LibraryTag(this.metadata); 1902 LibraryTag(this.metadata);
1903 1903
1904 bool get isLibraryName => false; 1904 bool get isLibraryName => false;
1905 bool get isImport => false; 1905 bool get isImport => false;
1906 bool get isExport => false; 1906 bool get isExport => false;
1907 bool get isPart => false; 1907 bool get isPart => false;
1908 bool get isPartOf => false; 1908 bool get isPartOf => false;
1909 } 1909 }
1910 1910
1911 class LibraryName extends LibraryTag { 1911 class LibraryName extends LibraryTag {
1912 final Expression name; 1912 final Expression name;
1913 1913
1914 final Token libraryKeyword; 1914 final Token libraryKeyword;
1915 1915
1916 LibraryName(this.libraryKeyword, 1916 LibraryName(this.libraryKeyword,
1917 this.name, 1917 this.name,
1918 Link<MetadataAnnotation> metadata) 1918 List<MetadataAnnotation> metadata)
1919 : super(metadata); 1919 : super(metadata);
1920 1920
1921 bool get isLibraryName => true; 1921 bool get isLibraryName => true;
1922 1922
1923 LibraryName asLibraryName() => this; 1923 LibraryName asLibraryName() => this;
1924 1924
1925 accept(Visitor visitor) => visitor.visitLibraryName(this); 1925 accept(Visitor visitor) => visitor.visitLibraryName(this);
1926 1926
1927 visitChildren(Visitor visitor) => name.accept(visitor); 1927 visitChildren(Visitor visitor) => name.accept(visitor);
1928 1928
1929 Token getBeginToken() => libraryKeyword; 1929 Token getBeginToken() => libraryKeyword;
1930 1930
1931 Token getEndToken() => name.getEndToken().next; 1931 Token getEndToken() => name.getEndToken().next;
1932 } 1932 }
1933 1933
1934 /** 1934 /**
1935 * This tag describes a dependency between one library and the exported 1935 * This tag describes a dependency between one library and the exported
1936 * identifiers of another library. The other library is specified by the [uri]. 1936 * identifiers of another library. The other library is specified by the [uri].
1937 * Combinators filter away some identifiers from the other library. 1937 * Combinators filter away some identifiers from the other library.
1938 */ 1938 */
1939 abstract class LibraryDependency extends LibraryTag { 1939 abstract class LibraryDependency extends LibraryTag {
1940 final StringNode uri; 1940 final StringNode uri;
1941 final NodeList combinators; 1941 final NodeList combinators;
1942 1942
1943 LibraryDependency(this.uri, 1943 LibraryDependency(this.uri,
1944 this.combinators, 1944 this.combinators,
1945 Link<MetadataAnnotation> metadata) 1945 List<MetadataAnnotation> metadata)
1946 : super(metadata); 1946 : super(metadata);
1947 1947
1948 LibraryDependency asLibraryDependency() => this; 1948 LibraryDependency asLibraryDependency() => this;
1949 } 1949 }
1950 1950
1951 /** 1951 /**
1952 * An [:import:] library tag. 1952 * An [:import:] library tag.
1953 * 1953 *
1954 * An import tag is dependency on another library where the exported identifiers 1954 * An import tag is dependency on another library where the exported identifiers
1955 * are put into the import scope of the importing library. The import scope is 1955 * are put into the import scope of the importing library. The import scope is
1956 * only visible inside the library. 1956 * only visible inside the library.
1957 */ 1957 */
1958 class Import extends LibraryDependency { 1958 class Import extends LibraryDependency {
1959 final Identifier prefix; 1959 final Identifier prefix;
1960 final Token importKeyword; 1960 final Token importKeyword;
1961 final bool isDeferred; 1961 final bool isDeferred;
1962 1962
1963 Import(this.importKeyword, StringNode uri, 1963 Import(this.importKeyword, StringNode uri,
1964 this.prefix, NodeList combinators, 1964 this.prefix, NodeList combinators,
1965 Link<MetadataAnnotation> metadata, 1965 List<MetadataAnnotation> metadata,
1966 {this.isDeferred}) 1966 {this.isDeferred})
1967 : super(uri, combinators, metadata); 1967 : super(uri, combinators, metadata);
1968 1968
1969 bool get isImport => true; 1969 bool get isImport => true;
1970 1970
1971 Import asImport() => this; 1971 Import asImport() => this;
1972 1972
1973 accept(Visitor visitor) => visitor.visitImport(this); 1973 accept(Visitor visitor) => visitor.visitImport(this);
1974 1974
1975 visitChildren(Visitor visitor) { 1975 visitChildren(Visitor visitor) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2020 * An export tag is dependency on another library where the exported identifiers 2020 * An export tag is dependency on another library where the exported identifiers
2021 * are put into the export scope of the exporting library. The export scope is 2021 * are put into the export scope of the exporting library. The export scope is
2022 * not visible inside the library. 2022 * not visible inside the library.
2023 */ 2023 */
2024 class Export extends LibraryDependency { 2024 class Export extends LibraryDependency {
2025 final Token exportKeyword; 2025 final Token exportKeyword;
2026 2026
2027 Export(this.exportKeyword, 2027 Export(this.exportKeyword,
2028 StringNode uri, 2028 StringNode uri,
2029 NodeList combinators, 2029 NodeList combinators,
2030 Link<MetadataAnnotation> metadata) 2030 List<MetadataAnnotation> metadata)
2031 : super(uri, combinators, metadata); 2031 : super(uri, combinators, metadata);
2032 2032
2033 bool get isExport => true; 2033 bool get isExport => true;
2034 2034
2035 Export asExport() => this; 2035 Export asExport() => this;
2036 2036
2037 accept(Visitor visitor) => visitor.visitExport(this); 2037 accept(Visitor visitor) => visitor.visitExport(this);
2038 2038
2039 visitChildren(Visitor visitor) { 2039 visitChildren(Visitor visitor) {
2040 uri.accept(visitor); 2040 uri.accept(visitor);
2041 if (combinators != null) combinators.accept(visitor); 2041 if (combinators != null) combinators.accept(visitor);
2042 } 2042 }
2043 2043
2044 Token getBeginToken() => exportKeyword; 2044 Token getBeginToken() => exportKeyword;
2045 2045
2046 Token getEndToken() { 2046 Token getEndToken() {
2047 if (combinators != null) return combinators.getEndToken().next; 2047 if (combinators != null) return combinators.getEndToken().next;
2048 return uri.getEndToken().next; 2048 return uri.getEndToken().next;
2049 } 2049 }
2050 } 2050 }
2051 2051
2052 class Part extends LibraryTag { 2052 class Part extends LibraryTag {
2053 final StringNode uri; 2053 final StringNode uri;
2054 2054
2055 final Token partKeyword; 2055 final Token partKeyword;
2056 2056
2057 Part(this.partKeyword, this.uri, Link<MetadataAnnotation> metadata) 2057 Part(this.partKeyword, this.uri, List<MetadataAnnotation> metadata)
2058 : super(metadata); 2058 : super(metadata);
2059 2059
2060 bool get isPart => true; 2060 bool get isPart => true;
2061 2061
2062 Part asPart() => this; 2062 Part asPart() => this;
2063 2063
2064 accept(Visitor visitor) => visitor.visitPart(this); 2064 accept(Visitor visitor) => visitor.visitPart(this);
2065 2065
2066 visitChildren(Visitor visitor) => uri.accept(visitor); 2066 visitChildren(Visitor visitor) => uri.accept(visitor);
2067 2067
2068 Token getBeginToken() => partKeyword; 2068 Token getBeginToken() => partKeyword;
2069 2069
2070 Token getEndToken() => uri.getEndToken().next; 2070 Token getEndToken() => uri.getEndToken().next;
2071 } 2071 }
2072 2072
2073 class PartOf extends Node { 2073 class PartOf extends Node {
2074 final Expression name; 2074 final Expression name;
2075 2075
2076 final Token partKeyword; 2076 final Token partKeyword;
2077 2077
2078 final Link<MetadataAnnotation> metadata; 2078 final List<MetadataAnnotation> metadata;
2079 2079
2080 PartOf(this.partKeyword, this.name, this.metadata); 2080 PartOf(this.partKeyword, this.name, this.metadata);
2081 2081
2082 Token get ofKeyword => partKeyword.next; 2082 Token get ofKeyword => partKeyword.next;
2083 2083
2084 bool get isPartOf => true; 2084 bool get isPartOf => true;
2085 2085
2086 PartOf asPartOf() => this; 2086 PartOf asPartOf() => this;
2087 2087
2088 accept(Visitor visitor) => visitor.visitPartOf(this); 2088 accept(Visitor visitor) => visitor.visitPartOf(this);
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
2347 2347
2348 // VariableDefinitions. 2348 // VariableDefinitions.
2349 get metadata => null; 2349 get metadata => null;
2350 get type => null; 2350 get type => null;
2351 2351
2352 // Typedef. 2352 // Typedef.
2353 get typeParameters => null; 2353 get typeParameters => null;
2354 get formals => null; 2354 get formals => null;
2355 get typedefKeyword => null; 2355 get typedefKeyword => null;
2356 } 2356 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698