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

Side by Side Diff: pkg/compiler/lib/src/elements/modelx.dart

Issue 1132783002: Add Accessor, Getter, and Setter elements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 5 years, 7 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
« no previous file with comments | « pkg/compiler/lib/src/elements/elements.dart ('k') | pkg/compiler/lib/src/elements/visitor.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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.modelx; 5 library elements.modelx;
6 6
7 import 'elements.dart'; 7 import 'elements.dart';
8 import '../constants/expressions.dart'; 8 import '../constants/expressions.dart';
9 import '../constants/constructors.dart'; 9 import '../constants/constructors.dart';
10 import '../helpers/helpers.dart'; // Included for debug helpers. 10 import '../helpers/helpers.dart'; // Included for debug helpers.
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 while (!element.isCompilationUnit) { 164 while (!element.isCompilationUnit) {
165 element = element.enclosingElement; 165 element = element.enclosingElement;
166 } 166 }
167 return element; 167 return element;
168 } 168 }
169 169
170 LibraryElement get library => enclosingElement.library; 170 LibraryElement get library => enclosingElement.library;
171 171
172 Name get memberName => new Name(name, library); 172 Name get memberName => new Name(name, library);
173 173
174 LibraryElement get implementationLibrary { 174 LibraryElementX get implementationLibrary {
175 Element element = this; 175 Element element = this;
176 while (!identical(element.kind, ElementKind.LIBRARY)) { 176 while (!identical(element.kind, ElementKind.LIBRARY)) {
177 element = element.enclosingElement; 177 element = element.enclosingElement;
178 } 178 }
179 return element; 179 return element;
180 } 180 }
181 181
182 ClassElement get enclosingClass { 182 ClassElement get enclosingClass {
183 for (Element e = this; e != null; e = e.enclosingElement) { 183 for (Element e = this; e != null; e = e.enclosingElement) {
184 if (e.isClass) return e; 184 if (e.isClass) return e;
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 } 422 }
423 423
424 set nestedClosures(_) { 424 set nestedClosures(_) {
425 throw new UnsupportedError("nestedClosures="); 425 throw new UnsupportedError("nestedClosures=");
426 } 426 }
427 427
428 set redirectionDeferredPrefix(_) { 428 set redirectionDeferredPrefix(_) {
429 throw new UnsupportedError("redirectionDeferredPrefix="); 429 throw new UnsupportedError("redirectionDeferredPrefix=");
430 } 430 }
431 431
432 bool get hasNoBody => false;
433
434 bool get _hasNoBody => false;
435
436 void set effectiveTarget(_) { 432 void set effectiveTarget(_) {
437 throw new UnsupportedError("effectiveTarget="); 433 throw new UnsupportedError("effectiveTarget=");
438 } 434 }
439 } 435 }
440 436
441 /// A message attached to a [WarnOnUseElementX]. 437 /// A message attached to a [WarnOnUseElementX].
442 class WrappedMessage { 438 class WrappedMessage {
443 /// The message position. If [:null:] the position of the reference to the 439 /// The message position. If [:null:] the position of the reference to the
444 /// [WarnOnUseElementX] is used. 440 /// [WarnOnUseElementX] is used.
445 final Spannable spannable; 441 final Spannable spannable;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 * and a setter. 612 * and a setter.
617 * 613 *
618 * The abstract field is added once, for the first getter or setter, and 614 * The abstract field is added once, for the first getter or setter, and
619 * reused if the other one is also added. 615 * reused if the other one is also added.
620 * The abstract field should not be treated as a proper member of the 616 * The abstract field should not be treated as a proper member of the
621 * container, it's simply a way to return two results for one lookup. 617 * container, it's simply a way to return two results for one lookup.
622 * That is, the getter or setter does not have the abstract field as enclosing 618 * That is, the getter or setter does not have the abstract field as enclosing
623 * element, they are enclosed by the class or compilation unit, as is the 619 * element, they are enclosed by the class or compilation unit, as is the
624 * abstract field. 620 * abstract field.
625 */ 621 */
626 void addAccessor(FunctionElementX accessor, 622 void addAccessor(AccessorElementX accessor,
627 Element existing, 623 Element existing,
628 DiagnosticListener listener) { 624 DiagnosticListener listener) {
629 void reportError(Element other) { 625 void reportError(Element other) {
630 listener.reportError(accessor, 626 listener.reportError(accessor,
631 MessageKind.DUPLICATE_DEFINITION, 627 MessageKind.DUPLICATE_DEFINITION,
632 {'name': accessor.name}); 628 {'name': accessor.name});
633 listener.reportInfo( 629 listener.reportInfo(
634 other, MessageKind.EXISTING_DEFINITION, {'name': accessor.name}); 630 other, MessageKind.EXISTING_DEFINITION, {'name': accessor.name});
635 631
636 contents[accessor.name] = new DuplicatedElementX( 632 contents[accessor.name] = new DuplicatedElementX(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 } 670 }
675 } 671 }
676 } 672 }
677 673
678 class CompilationUnitElementX extends ElementX 674 class CompilationUnitElementX extends ElementX
679 implements CompilationUnitElement { 675 implements CompilationUnitElement {
680 final Script script; 676 final Script script;
681 PartOf partTag; 677 PartOf partTag;
682 Link<Element> localMembers = const Link<Element>(); 678 Link<Element> localMembers = const Link<Element>();
683 679
684 CompilationUnitElementX(Script script, LibraryElement library) 680 CompilationUnitElementX(Script script, LibraryElementX library)
685 : this.script = script, 681 : this.script = script,
686 super(script.name, 682 super(script.name,
687 ElementKind.COMPILATION_UNIT, 683 ElementKind.COMPILATION_UNIT,
688 library) { 684 library) {
689 library.addCompilationUnit(this); 685 library.addCompilationUnit(this);
690 } 686 }
691 687
688 @override
689 LibraryElementX get library => enclosingElement.declaration;
690
692 void forEachLocalMember(f(Element element)) { 691 void forEachLocalMember(f(Element element)) {
693 localMembers.forEach(f); 692 localMembers.forEach(f);
694 } 693 }
695 694
696 void addMember(Element element, DiagnosticListener listener) { 695 void addMember(Element element, DiagnosticListener listener) {
697 // Keep a list of top level members. 696 // Keep a list of top level members.
698 localMembers = localMembers.prepend(element); 697 localMembers = localMembers.prepend(element);
699 // Provide the member to the library to build scope. 698 // Provide the member to the library to build scope.
700 if (enclosingElement.isPatch) { 699 if (enclosingElement.isPatch) {
701 implementationLibrary.addMember(element, listener); 700 implementationLibrary.addMember(element, listener);
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 } 932 }
934 933
935 Iterable<LibraryTag> get tags { 934 Iterable<LibraryTag> get tags {
936 if (tagsCache == null) { 935 if (tagsCache == null) {
937 tagsCache = tagsBuilder.toList(); 936 tagsCache = tagsBuilder.toList();
938 tagsBuilder = null; 937 tagsBuilder = null;
939 } 938 }
940 return tagsCache; 939 return tagsCache;
941 } 940 }
942 941
942 /// Record which element an import or export tag resolved to.
943 void recordResolvedTag(LibraryDependency tag, LibraryElement library) { 943 void recordResolvedTag(LibraryDependency tag, LibraryElement library) {
944 assert(tagMapping[tag] == null); 944 assert(tagMapping[tag] == null);
945 tagMapping[tag] = library; 945 tagMapping[tag] = library;
946 } 946 }
947 947
948 LibraryElement getLibraryFromTag(LibraryDependency tag) => tagMapping[tag]; 948 LibraryElement getLibraryFromTag(LibraryDependency tag) => tagMapping[tag];
949 949
950 /** 950 /**
951 * Adds [element] to the import scope of this library. 951 * Adds [element] to the import scope of this library.
952 * 952 *
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
1679 MemberElement get memberContext => enclosingElement; 1679 MemberElement get memberContext => enclosingElement;
1680 1680
1681 bool get isLocal => false; 1681 bool get isLocal => false;
1682 1682
1683 bool get isErroneous => true; 1683 bool get isErroneous => true;
1684 1684
1685 DynamicType get type => const DynamicType(); 1685 DynamicType get type => const DynamicType();
1686 } 1686 }
1687 1687
1688 class AbstractFieldElementX extends ElementX implements AbstractFieldElement { 1688 class AbstractFieldElementX extends ElementX implements AbstractFieldElement {
1689 FunctionElementX getter; 1689 GetterElementX getter;
1690 FunctionElementX setter; 1690 SetterElementX setter;
1691 1691
1692 AbstractFieldElementX(String name, Element enclosing) 1692 AbstractFieldElementX(String name, Element enclosing)
1693 : super(name, ElementKind.ABSTRACT_FIELD, enclosing); 1693 : super(name, ElementKind.ABSTRACT_FIELD, enclosing);
1694 1694
1695 DartType computeType(Compiler compiler) { 1695 DartType computeType(Compiler compiler) {
1696 throw "internal error: AbstractFieldElement has no type"; 1696 throw "internal error: AbstractFieldElement has no type";
1697 } 1697 }
1698 1698
1699 Node parseNode(DiagnosticListener listener) { 1699 Node parseNode(DiagnosticListener listener) {
1700 throw "internal error: AbstractFieldElement has no node"; 1700 throw "internal error: AbstractFieldElement has no node";
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1838 abstract class BaseFunctionElementX 1838 abstract class BaseFunctionElementX
1839 extends ElementX with PatchMixin<FunctionElement>, AstElementMixin 1839 extends ElementX with PatchMixin<FunctionElement>, AstElementMixin
1840 implements FunctionElement { 1840 implements FunctionElement {
1841 DartType typeCache; 1841 DartType typeCache;
1842 final Modifiers modifiers; 1842 final Modifiers modifiers;
1843 1843
1844 List<FunctionElement> nestedClosures = new List<FunctionElement>(); 1844 List<FunctionElement> nestedClosures = new List<FunctionElement>();
1845 1845
1846 FunctionSignature functionSignatureCache; 1846 FunctionSignature functionSignatureCache;
1847 1847
1848 final bool _hasNoBody;
1849
1850 AbstractFieldElement abstractField;
1851
1852 AsyncMarker asyncMarker = AsyncMarker.SYNC; 1848 AsyncMarker asyncMarker = AsyncMarker.SYNC;
1853 1849
1854 BaseFunctionElementX(String name, 1850 BaseFunctionElementX(String name,
1855 ElementKind kind, 1851 ElementKind kind,
1856 Modifiers this.modifiers, 1852 Modifiers this.modifiers,
1857 Element enclosing, 1853 Element enclosing)
1858 bool hasNoBody) 1854 : super(name, kind, enclosing) {
1859 : super(name, kind, enclosing),
1860 _hasNoBody = hasNoBody {
1861 assert(modifiers != null); 1855 assert(modifiers != null);
1862 } 1856 }
1863 1857
1864 bool get isExternal => modifiers.isExternal; 1858 bool get isExternal => modifiers.isExternal;
1865 1859
1866 bool get hasNoBody => _hasNoBody;
1867
1868 bool get isInstanceMember { 1860 bool get isInstanceMember {
1869 return isClassMember 1861 return isClassMember
1870 && !isConstructor 1862 && !isConstructor
1871 && !isStatic; 1863 && !isStatic;
1872 } 1864 }
1873 1865
1874 bool get hasFunctionSignature => functionSignatureCache != null; 1866 bool get hasFunctionSignature => functionSignatureCache != null;
1875 1867
1876 FunctionSignature computeSignature(Compiler compiler) { 1868 FunctionSignature computeSignature(Compiler compiler) {
1877 if (functionSignatureCache != null) return functionSignatureCache; 1869 if (functionSignatureCache != null) return functionSignatureCache;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1912 String toString() { 1904 String toString() {
1913 if (isPatch) { 1905 if (isPatch) {
1914 return 'patch ${super.toString()}'; 1906 return 'patch ${super.toString()}';
1915 } else if (isPatched) { 1907 } else if (isPatched) {
1916 return 'origin ${super.toString()}'; 1908 return 'origin ${super.toString()}';
1917 } else { 1909 } else {
1918 return super.toString(); 1910 return super.toString();
1919 } 1911 }
1920 } 1912 }
1921 1913
1922 bool get isAbstract { 1914 bool get isAbstract => false;
1923 return !modifiers.isExternal &&
1924 (isFunction || isAccessor) &&
1925 _hasNoBody;
1926 }
1927 1915
1928 accept(ElementVisitor visitor, arg) { 1916 accept(ElementVisitor visitor, arg) {
1929 return visitor.visitFunctionElement(this, arg); 1917 return visitor.visitFunctionElement(this, arg);
1930 } 1918 }
1931 1919
1932 // A function is defined by the implementation element. 1920 // A function is defined by the implementation element.
1933 AstElement get definingElement => implementation; 1921 AstElement get definingElement => implementation;
1934 } 1922 }
1935 1923
1936 abstract class FunctionElementX extends BaseFunctionElementX 1924 abstract class FunctionElementX extends BaseFunctionElementX
1937 with AnalyzableElementX implements MethodElement { 1925 with AnalyzableElementX implements MethodElement {
1926
1938 FunctionElementX(String name, 1927 FunctionElementX(String name,
1939 ElementKind kind, 1928 ElementKind kind,
1940 Modifiers modifiers, 1929 Modifiers modifiers,
1941 Element enclosing, 1930 Element enclosing)
1942 bool hasNoBody) 1931 : super(name, kind, modifiers, enclosing);
1943 : super(name, kind, modifiers, enclosing, hasNoBody);
1944 1932
1945 MemberElement get memberContext => this; 1933 MemberElement get memberContext => this;
1946 1934
1947 void reuseElement() { 1935 void reuseElement() {
1948 super.reuseElement(); 1936 super.reuseElement();
1949 nestedClosures.clear(); 1937 nestedClosures.clear();
1950 functionSignatureCache = null; 1938 functionSignatureCache = null;
1951 typeCache = null; 1939 typeCache = null;
1952 } 1940 }
1953 } 1941 }
1954 1942
1943 abstract class MethodElementX extends FunctionElementX {
1944 final bool hasBody;
1945
1946 MethodElementX(String name,
1947 ElementKind kind,
1948 Modifiers modifiers,
1949 Element enclosing,
1950 // TODO(15101): Make this a named parameter.
1951 this.hasBody)
1952 : super(name, kind, modifiers, enclosing);
1953
1954 @override
1955 bool get isAbstract {
1956 return !modifiers.isExternal && !hasBody;
1957 }
1958 }
1959
1960 abstract class AccessorElementX extends MethodElementX
1961 implements AccessorElement {
1962 AbstractFieldElement abstractField;
1963
1964 AccessorElementX(String name,
1965 ElementKind kind,
1966 Modifiers modifiers,
1967 Element enclosing,
1968 bool hasBody)
1969 : super(name, kind, modifiers, enclosing, hasBody);
1970 }
1971
1972 abstract class GetterElementX extends AccessorElementX
1973 implements GetterElement {
1974
1975 GetterElementX(String name,
1976 Modifiers modifiers,
1977 Element enclosing,
1978 bool hasBody)
1979 : super(name, ElementKind.GETTER, modifiers, enclosing, hasBody);
1980 }
1981
1982 abstract class SetterElementX extends AccessorElementX
1983 implements SetterElement {
1984
1985 SetterElementX(String name,
1986 Modifiers modifiers,
1987 Element enclosing,
1988 bool hasBody)
1989 : super(name, ElementKind.SETTER, modifiers, enclosing, hasBody);
1990 }
1991
1955 class LocalFunctionElementX extends BaseFunctionElementX 1992 class LocalFunctionElementX extends BaseFunctionElementX
1956 implements LocalFunctionElement { 1993 implements LocalFunctionElement {
1957 final FunctionExpression node; 1994 final FunctionExpression node;
1958 1995
1959 LocalFunctionElementX(String name, 1996 LocalFunctionElementX(String name,
1960 FunctionExpression this.node, 1997 FunctionExpression this.node,
1961 ElementKind kind, 1998 ElementKind kind,
1962 Modifiers modifiers, 1999 Modifiers modifiers,
1963 ExecutableElement enclosing) 2000 ExecutableElement enclosing)
1964 : super(name, kind, modifiers, enclosing, false); 2001 : super(name, kind, modifiers, enclosing);
1965 2002
1966 ExecutableElement get executableContext => enclosingElement; 2003 ExecutableElement get executableContext => enclosingElement;
1967 2004
1968 MemberElement get memberContext => executableContext.memberContext; 2005 MemberElement get memberContext => executableContext.memberContext;
1969 2006
1970 bool get hasNode => true; 2007 bool get hasNode => true;
1971 2008
1972 FunctionExpression parseNode(DiagnosticListener listener) => node; 2009 FunctionExpression parseNode(DiagnosticListener listener) => node;
1973 2010
1974 Token get position { 2011 Token get position {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2008 } 2045 }
2009 2046
2010 abstract class ConstructorElementX extends FunctionElementX 2047 abstract class ConstructorElementX extends FunctionElementX
2011 with ConstantConstructorMixin implements ConstructorElement { 2048 with ConstantConstructorMixin implements ConstructorElement {
2012 bool isRedirectingGenerative = false; 2049 bool isRedirectingGenerative = false;
2013 2050
2014 ConstructorElementX(String name, 2051 ConstructorElementX(String name,
2015 ElementKind kind, 2052 ElementKind kind,
2016 Modifiers modifiers, 2053 Modifiers modifiers,
2017 Element enclosing) 2054 Element enclosing)
2018 : super(name, kind, modifiers, enclosing, false); 2055 : super(name, kind, modifiers, enclosing);
2019 2056
2020 FunctionElement immediateRedirectionTarget; 2057 FunctionElement immediateRedirectionTarget;
2021 PrefixElement redirectionDeferredPrefix; 2058 PrefixElement redirectionDeferredPrefix;
2022 2059
2023 bool get isRedirectingFactory => immediateRedirectionTarget != null; 2060 bool get isRedirectingFactory => immediateRedirectionTarget != null;
2024 2061
2025 // TODO(johnniwinther): This should also return true for cyclic redirecting 2062 // TODO(johnniwinther): This should also return true for cyclic redirecting
2026 // generative constructors. 2063 // generative constructors.
2027 bool get isCyclicRedirection => effectiveTarget.isRedirectingFactory; 2064 bool get isCyclicRedirection => effectiveTarget.isRedirectingFactory;
2028 2065
(...skipping 15 matching lines...) Expand all
2044 } 2081 }
2045 2082
2046 InterfaceType computeEffectiveTargetType(InterfaceType newType) { 2083 InterfaceType computeEffectiveTargetType(InterfaceType newType) {
2047 if (!isRedirectingFactory) return newType; 2084 if (!isRedirectingFactory) return newType;
2048 assert(invariant(this, effectiveTargetType != null, 2085 assert(invariant(this, effectiveTargetType != null,
2049 message: 'Redirection target type has not yet been computed for ' 2086 message: 'Redirection target type has not yet been computed for '
2050 '$this.')); 2087 '$this.'));
2051 return effectiveTargetType.substByContext(newType); 2088 return effectiveTargetType.substByContext(newType);
2052 } 2089 }
2053 2090
2091 accept(ElementVisitor visitor, arg) {
2092 return visitor.visitConstructorElement(this, arg);
2093 }
2094
2054 ConstructorElement get definingConstructor => null; 2095 ConstructorElement get definingConstructor => null;
2055 2096
2056 ClassElement get enclosingClass => enclosingElement; 2097 ClassElement get enclosingClass => enclosingElement;
2057 } 2098 }
2058 2099
2059 class DeferredLoaderGetterElementX extends FunctionElementX { 2100 class DeferredLoaderGetterElementX extends GetterElementX
2101 implements GetterElement {
2060 final PrefixElement prefix; 2102 final PrefixElement prefix;
2061 2103
2062 DeferredLoaderGetterElementX(PrefixElement prefix) 2104 DeferredLoaderGetterElementX(PrefixElement prefix)
2063 : this.prefix = prefix, 2105 : this.prefix = prefix,
2064 super("loadLibrary", 2106 super("loadLibrary",
2065 ElementKind.FUNCTION,
2066 Modifiers.EMPTY, 2107 Modifiers.EMPTY,
2067 prefix, true); 2108 prefix,
2109 false);
2068 2110
2069 FunctionSignature computeSignature(Compiler compiler) { 2111 FunctionSignature computeSignature(Compiler compiler) {
2070 if (functionSignatureCache != null) return functionSignature; 2112 if (functionSignatureCache != null) return functionSignature;
2071 compiler.withCurrentElement(this, () { 2113 compiler.withCurrentElement(this, () {
2072 DartType inner = new FunctionType(this); 2114 DartType inner = new FunctionType(this);
2073 functionSignatureCache = new FunctionSignatureX(type: inner); 2115 functionSignatureCache = new FunctionSignatureX(type: inner);
2074 }); 2116 });
2075 return functionSignatureCache; 2117 return functionSignatureCache;
2076 } 2118 }
2077 2119
2078 bool get isClassMember => false; 2120 bool get isClassMember => false;
2079 2121
2080 bool isForeign(Backend backend) => true; 2122 bool isForeign(Backend backend) => true;
2081 2123
2082 bool get isSynthesized => true; 2124 bool get isSynthesized => true;
2083 2125
2084 bool get isFunction => false;
2085
2086 bool get isDeferredLoaderGetter => true; 2126 bool get isDeferredLoaderGetter => true;
2087 2127
2088 bool get isGetter => true;
2089
2090 bool get isTopLevel => true; 2128 bool get isTopLevel => true;
2091 // By having position null, the enclosing elements location is printed in 2129 // By having position null, the enclosing elements location is printed in
2092 // error messages. 2130 // error messages.
2093 Token get position => null; 2131 Token get position => null;
2094 2132
2095 FunctionExpression parseNode(DiagnosticListener listener) => null; 2133 FunctionExpression parseNode(DiagnosticListener listener) => null;
2096 2134
2097 bool get hasNode => false; 2135 bool get hasNode => false;
2098 2136
2099 FunctionExpression get node => null; 2137 FunctionExpression get node => null;
2138
2139 @override
2140 SetterElement get setter => null;
2100 } 2141 }
2101 2142
2102 class ConstructorBodyElementX extends BaseFunctionElementX 2143 class ConstructorBodyElementX extends BaseFunctionElementX
2103 implements ConstructorBodyElement { 2144 implements ConstructorBodyElement {
2104 ConstructorElement constructor; 2145 ConstructorElementX constructor;
2105 2146
2106 ConstructorBodyElementX(FunctionElement constructor) 2147 ConstructorBodyElementX(ConstructorElementX constructor)
2107 : this.constructor = constructor, 2148 : this.constructor = constructor,
2108 super(constructor.name, 2149 super(constructor.name,
2109 ElementKind.GENERATIVE_CONSTRUCTOR_BODY, 2150 ElementKind.GENERATIVE_CONSTRUCTOR_BODY,
2110 Modifiers.EMPTY, 2151 Modifiers.EMPTY,
2111 constructor.enclosingElement, false) { 2152 constructor.enclosingElement) {
2112 functionSignatureCache = constructor.functionSignature; 2153 functionSignatureCache = constructor.functionSignature;
2113 } 2154 }
2114 2155
2115 bool get hasNode => constructor.hasNode; 2156 bool get hasNode => constructor.hasNode;
2116 2157
2117 FunctionExpression get node => constructor.node; 2158 FunctionExpression get node => constructor.node;
2118 2159
2119 Link<MetadataAnnotation> get metadata => constructor.metadata; 2160 Link<MetadataAnnotation> get metadata => constructor.metadata;
2120 2161
2121 bool get isInstanceMember => true; 2162 bool get isInstanceMember => true;
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
2839 modifiers, 2880 modifiers,
2840 enumClass); 2881 enumClass);
2841 2882
2842 @override 2883 @override
2843 bool get hasNode => true; 2884 bool get hasNode => true;
2844 2885
2845 @override 2886 @override
2846 FunctionExpression parseNode(Compiler compiler) => node; 2887 FunctionExpression parseNode(Compiler compiler) => node;
2847 } 2888 }
2848 2889
2849 class EnumMethodElementX extends FunctionElementX { 2890 class EnumMethodElementX extends MethodElementX {
2850 final FunctionExpression node; 2891 final FunctionExpression node;
2851 2892
2852 EnumMethodElementX(String name, 2893 EnumMethodElementX(String name,
2853 EnumClassElementX enumClass, 2894 EnumClassElementX enumClass,
2854 Modifiers modifiers, 2895 Modifiers modifiers,
2855 this.node) 2896 this.node)
2856 : super(name, 2897 : super(name, ElementKind.FUNCTION, modifiers, enumClass, true);
2857 ElementKind.FUNCTION,
2858 modifiers,
2859 enumClass,
2860 false);
2861 2898
2862 @override 2899 @override
2863 bool get hasNode => true; 2900 bool get hasNode => true;
2864 2901
2865 @override 2902 @override
2866 FunctionExpression parseNode(Compiler compiler) => node; 2903 FunctionExpression parseNode(Compiler compiler) => node;
2867 } 2904 }
2868 2905
2869 class EnumFormalElementX extends InitializingFormalElementX { 2906 class EnumFormalElementX extends InitializingFormalElementX {
2870 EnumFormalElementX(ConstructorElement constructor, 2907 EnumFormalElementX(ConstructorElement constructor,
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
3188 AstElement get definingElement; 3225 AstElement get definingElement;
3189 3226
3190 bool get hasResolvedAst => definingElement.hasTreeElements; 3227 bool get hasResolvedAst => definingElement.hasTreeElements;
3191 3228
3192 ResolvedAst get resolvedAst { 3229 ResolvedAst get resolvedAst {
3193 return new ResolvedAst(declaration, 3230 return new ResolvedAst(declaration,
3194 definingElement.node, definingElement.treeElements); 3231 definingElement.node, definingElement.treeElements);
3195 } 3232 }
3196 3233
3197 } 3234 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/elements/elements.dart ('k') | pkg/compiler/lib/src/elements/visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698