OLD | NEW |
---|---|
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 Loading... | |
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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
414 } | 414 } |
415 | 415 |
416 get nestedClosures { | 416 get nestedClosures { |
417 throw new UnsupportedError("nestedClosures"); | 417 throw new UnsupportedError("nestedClosures"); |
418 } | 418 } |
419 | 419 |
420 set nestedClosures(_) { | 420 set nestedClosures(_) { |
421 throw new UnsupportedError("nestedClosures="); | 421 throw new UnsupportedError("nestedClosures="); |
422 } | 422 } |
423 | 423 |
424 bool get hasNoBody => false; | 424 bool get hasBody => true; |
sigurdm
2015/05/08 11:20:48
Does not seem like the right abstraction.
Add TODO
Johnni Winther
2015/05/11 14:06:59
Removed.
| |
425 | |
426 bool get _hasNoBody => false; | |
sigurdm
2015/05/08 11:20:48
Beautiful!
| |
427 | 425 |
428 void set effectiveTarget(_) { | 426 void set effectiveTarget(_) { |
429 throw new UnsupportedError("effectiveTarget="); | 427 throw new UnsupportedError("effectiveTarget="); |
430 } | 428 } |
431 } | 429 } |
432 | 430 |
433 /// A message attached to a [WarnOnUseElementX]. | 431 /// A message attached to a [WarnOnUseElementX]. |
434 class WrappedMessage { | 432 class WrappedMessage { |
435 /// The message position. If [:null:] the position of the reference to the | 433 /// The message position. If [:null:] the position of the reference to the |
436 /// [WarnOnUseElementX] is used. | 434 /// [WarnOnUseElementX] is used. |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
608 * and a setter. | 606 * and a setter. |
609 * | 607 * |
610 * The abstract field is added once, for the first getter or setter, and | 608 * The abstract field is added once, for the first getter or setter, and |
611 * reused if the other one is also added. | 609 * reused if the other one is also added. |
612 * The abstract field should not be treated as a proper member of the | 610 * The abstract field should not be treated as a proper member of the |
613 * container, it's simply a way to return two results for one lookup. | 611 * container, it's simply a way to return two results for one lookup. |
614 * That is, the getter or setter does not have the abstract field as enclosing | 612 * That is, the getter or setter does not have the abstract field as enclosing |
615 * element, they are enclosed by the class or compilation unit, as is the | 613 * element, they are enclosed by the class or compilation unit, as is the |
616 * abstract field. | 614 * abstract field. |
617 */ | 615 */ |
618 void addAccessor(FunctionElementX accessor, | 616 void addAccessor(AccessorElementX accessor, |
619 Element existing, | 617 Element existing, |
620 DiagnosticListener listener) { | 618 DiagnosticListener listener) { |
621 void reportError(Element other) { | 619 void reportError(Element other) { |
622 listener.reportError(accessor, | 620 listener.reportError(accessor, |
623 MessageKind.DUPLICATE_DEFINITION, | 621 MessageKind.DUPLICATE_DEFINITION, |
624 {'name': accessor.name}); | 622 {'name': accessor.name}); |
625 listener.reportInfo( | 623 listener.reportInfo( |
626 other, MessageKind.EXISTING_DEFINITION, {'name': accessor.name}); | 624 other, MessageKind.EXISTING_DEFINITION, {'name': accessor.name}); |
627 | 625 |
628 contents[accessor.name] = new DuplicatedElementX( | 626 contents[accessor.name] = new DuplicatedElementX( |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
666 } | 664 } |
667 } | 665 } |
668 } | 666 } |
669 | 667 |
670 class CompilationUnitElementX extends ElementX | 668 class CompilationUnitElementX extends ElementX |
671 implements CompilationUnitElement { | 669 implements CompilationUnitElement { |
672 final Script script; | 670 final Script script; |
673 PartOf partTag; | 671 PartOf partTag; |
674 Link<Element> localMembers = const Link<Element>(); | 672 Link<Element> localMembers = const Link<Element>(); |
675 | 673 |
676 CompilationUnitElementX(Script script, LibraryElement library) | 674 CompilationUnitElementX(Script script, LibraryElementX library) |
677 : this.script = script, | 675 : this.script = script, |
678 super(script.name, | 676 super(script.name, |
679 ElementKind.COMPILATION_UNIT, | 677 ElementKind.COMPILATION_UNIT, |
680 library) { | 678 library) { |
681 library.addCompilationUnit(this); | 679 library.addCompilationUnit(this); |
682 } | 680 } |
683 | 681 |
682 @override | |
683 LibraryElementX get library => enclosingElement.declaration; | |
684 | |
684 void forEachLocalMember(f(Element element)) { | 685 void forEachLocalMember(f(Element element)) { |
685 localMembers.forEach(f); | 686 localMembers.forEach(f); |
686 } | 687 } |
687 | 688 |
688 void addMember(Element element, DiagnosticListener listener) { | 689 void addMember(Element element, DiagnosticListener listener) { |
689 // Keep a list of top level members. | 690 // Keep a list of top level members. |
690 localMembers = localMembers.prepend(element); | 691 localMembers = localMembers.prepend(element); |
691 // Provide the member to the library to build scope. | 692 // Provide the member to the library to build scope. |
692 if (enclosingElement.isPatch) { | 693 if (enclosingElement.isPatch) { |
693 implementationLibrary.addMember(element, listener); | 694 implementationLibrary.addMember(element, listener); |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
925 } | 926 } |
926 | 927 |
927 Iterable<LibraryTag> get tags { | 928 Iterable<LibraryTag> get tags { |
928 if (tagsCache == null) { | 929 if (tagsCache == null) { |
929 tagsCache = tagsBuilder.toList(); | 930 tagsCache = tagsBuilder.toList(); |
930 tagsBuilder = null; | 931 tagsBuilder = null; |
931 } | 932 } |
932 return tagsCache; | 933 return tagsCache; |
933 } | 934 } |
934 | 935 |
936 /// Record which element an import or export tag resolved to. | |
935 void recordResolvedTag(LibraryDependency tag, LibraryElement library) { | 937 void recordResolvedTag(LibraryDependency tag, LibraryElement library) { |
936 assert(tagMapping[tag] == null); | 938 assert(tagMapping[tag] == null); |
937 tagMapping[tag] = library; | 939 tagMapping[tag] = library; |
938 } | 940 } |
939 | 941 |
940 LibraryElement getLibraryFromTag(LibraryDependency tag) => tagMapping[tag]; | 942 LibraryElement getLibraryFromTag(LibraryDependency tag) => tagMapping[tag]; |
941 | 943 |
942 /** | 944 /** |
943 * Adds [element] to the import scope of this library. | 945 * Adds [element] to the import scope of this library. |
944 * | 946 * |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1671 MemberElement get memberContext => enclosingElement; | 1673 MemberElement get memberContext => enclosingElement; |
1672 | 1674 |
1673 bool get isLocal => false; | 1675 bool get isLocal => false; |
1674 | 1676 |
1675 bool get isErroneous => true; | 1677 bool get isErroneous => true; |
1676 | 1678 |
1677 DynamicType get type => const DynamicType(); | 1679 DynamicType get type => const DynamicType(); |
1678 } | 1680 } |
1679 | 1681 |
1680 class AbstractFieldElementX extends ElementX implements AbstractFieldElement { | 1682 class AbstractFieldElementX extends ElementX implements AbstractFieldElement { |
1681 FunctionElementX getter; | 1683 MethodElementX getter; |
sigurdm
2015/05/08 11:20:48
Could you even say:
GetterElementX getter;
?
Johnni Winther
2015/05/11 14:06:59
Done.
| |
1682 FunctionElementX setter; | 1684 MethodElementX setter; |
1683 | 1685 |
1684 AbstractFieldElementX(String name, Element enclosing) | 1686 AbstractFieldElementX(String name, Element enclosing) |
1685 : super(name, ElementKind.ABSTRACT_FIELD, enclosing); | 1687 : super(name, ElementKind.ABSTRACT_FIELD, enclosing); |
1686 | 1688 |
1687 DartType computeType(Compiler compiler) { | 1689 DartType computeType(Compiler compiler) { |
1688 throw "internal error: AbstractFieldElement has no type"; | 1690 throw "internal error: AbstractFieldElement has no type"; |
1689 } | 1691 } |
1690 | 1692 |
1691 Node parseNode(DiagnosticListener listener) { | 1693 Node parseNode(DiagnosticListener listener) { |
1692 throw "internal error: AbstractFieldElement has no node"; | 1694 throw "internal error: AbstractFieldElement has no node"; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1830 abstract class BaseFunctionElementX | 1832 abstract class BaseFunctionElementX |
1831 extends ElementX with PatchMixin<FunctionElement>, AstElementMixin | 1833 extends ElementX with PatchMixin<FunctionElement>, AstElementMixin |
1832 implements FunctionElement { | 1834 implements FunctionElement { |
1833 DartType typeCache; | 1835 DartType typeCache; |
1834 final Modifiers modifiers; | 1836 final Modifiers modifiers; |
1835 | 1837 |
1836 List<FunctionElement> nestedClosures = new List<FunctionElement>(); | 1838 List<FunctionElement> nestedClosures = new List<FunctionElement>(); |
1837 | 1839 |
1838 FunctionSignature functionSignatureCache; | 1840 FunctionSignature functionSignatureCache; |
1839 | 1841 |
1840 final bool _hasNoBody; | |
1841 | |
1842 AbstractFieldElement abstractField; | |
1843 | |
1844 AsyncMarker asyncMarker = AsyncMarker.SYNC; | 1842 AsyncMarker asyncMarker = AsyncMarker.SYNC; |
1845 | 1843 |
1846 BaseFunctionElementX(String name, | 1844 BaseFunctionElementX(String name, |
1847 ElementKind kind, | 1845 ElementKind kind, |
1848 Modifiers this.modifiers, | 1846 Modifiers this.modifiers, |
1849 Element enclosing, | 1847 Element enclosing) |
1850 bool hasNoBody) | 1848 : super(name, kind, enclosing) { |
1851 : super(name, kind, enclosing), | |
1852 _hasNoBody = hasNoBody { | |
1853 assert(modifiers != null); | 1849 assert(modifiers != null); |
1854 } | 1850 } |
1855 | 1851 |
1856 bool get isExternal => modifiers.isExternal; | 1852 bool get isExternal => modifiers.isExternal; |
1857 | 1853 |
1858 bool get hasNoBody => _hasNoBody; | |
1859 | |
1860 bool get isInstanceMember { | 1854 bool get isInstanceMember { |
1861 return isClassMember | 1855 return isClassMember |
1862 && !isConstructor | 1856 && !isConstructor |
1863 && !isStatic; | 1857 && !isStatic; |
1864 } | 1858 } |
1865 | 1859 |
1866 bool get hasFunctionSignature => functionSignatureCache != null; | 1860 bool get hasFunctionSignature => functionSignatureCache != null; |
1867 | 1861 |
1868 FunctionSignature computeSignature(Compiler compiler) { | 1862 FunctionSignature computeSignature(Compiler compiler) { |
1869 if (functionSignatureCache != null) return functionSignatureCache; | 1863 if (functionSignatureCache != null) return functionSignatureCache; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1904 String toString() { | 1898 String toString() { |
1905 if (isPatch) { | 1899 if (isPatch) { |
1906 return 'patch ${super.toString()}'; | 1900 return 'patch ${super.toString()}'; |
1907 } else if (isPatched) { | 1901 } else if (isPatched) { |
1908 return 'origin ${super.toString()}'; | 1902 return 'origin ${super.toString()}'; |
1909 } else { | 1903 } else { |
1910 return super.toString(); | 1904 return super.toString(); |
1911 } | 1905 } |
1912 } | 1906 } |
1913 | 1907 |
1914 bool get isAbstract { | 1908 bool get isAbstract => false; |
1915 return !modifiers.isExternal && | |
1916 (isFunction || isAccessor) && | |
1917 _hasNoBody; | |
1918 } | |
1919 | 1909 |
1920 accept(ElementVisitor visitor, arg) { | 1910 accept(ElementVisitor visitor, arg) { |
1921 return visitor.visitFunctionElement(this, arg); | 1911 return visitor.visitFunctionElement(this, arg); |
1922 } | 1912 } |
1923 | 1913 |
1924 // A function is defined by the implementation element. | 1914 // A function is defined by the implementation element. |
1925 AstElement get definingElement => implementation; | 1915 AstElement get definingElement => implementation; |
1926 } | 1916 } |
1927 | 1917 |
1928 abstract class FunctionElementX extends BaseFunctionElementX | 1918 abstract class FunctionElementX extends BaseFunctionElementX |
1929 with AnalyzableElementX implements MethodElement { | 1919 with AnalyzableElementX implements MethodElement { |
1920 | |
1930 FunctionElementX(String name, | 1921 FunctionElementX(String name, |
1931 ElementKind kind, | 1922 ElementKind kind, |
1932 Modifiers modifiers, | 1923 Modifiers modifiers, |
1933 Element enclosing, | 1924 Element enclosing) |
1934 bool hasNoBody) | 1925 : super(name, kind, modifiers, enclosing); |
1935 : super(name, kind, modifiers, enclosing, hasNoBody); | |
1936 | 1926 |
1937 MemberElement get memberContext => this; | 1927 MemberElement get memberContext => this; |
1938 | 1928 |
1939 void reuseElement() { | 1929 void reuseElement() { |
1940 super.reuseElement(); | 1930 super.reuseElement(); |
1941 nestedClosures.clear(); | 1931 nestedClosures.clear(); |
1942 functionSignatureCache = null; | 1932 functionSignatureCache = null; |
1943 typeCache = null; | 1933 typeCache = null; |
1944 } | 1934 } |
1945 } | 1935 } |
1946 | 1936 |
1937 abstract class MethodElementX extends FunctionElementX { | |
1938 final bool hasBody; | |
1939 | |
1940 MethodElementX(String name, | |
1941 ElementKind kind, | |
1942 Modifiers modifiers, | |
1943 Element enclosing, | |
1944 // TODO(15101): Make this a named parameter. | |
1945 this.hasBody) | |
1946 : super(name, kind, modifiers, enclosing); | |
1947 | |
1948 @override | |
1949 bool get isAbstract { | |
1950 return !modifiers.isExternal && !hasBody; | |
1951 } | |
1952 } | |
1953 | |
1954 abstract class AccessorElementX extends MethodElementX | |
1955 implements AccessorElement { | |
1956 AbstractFieldElement abstractField; | |
1957 | |
1958 AccessorElementX(String name, | |
1959 ElementKind kind, | |
1960 Modifiers modifiers, | |
1961 Element enclosing, | |
1962 bool hasBody) | |
1963 : super(name, kind, modifiers, enclosing, hasBody); | |
1964 } | |
1965 | |
1966 abstract class GetterElementX extends AccessorElementX | |
1967 implements GetterElement { | |
1968 | |
1969 GetterElementX(String name, | |
1970 Modifiers modifiers, | |
1971 Element enclosing, | |
1972 bool hasBody) | |
1973 : super(name, ElementKind.GETTER, modifiers, enclosing, hasBody); | |
1974 } | |
1975 | |
1976 abstract class SetterElementX extends AccessorElementX | |
1977 implements SetterElement { | |
1978 | |
1979 SetterElementX(String name, | |
1980 Modifiers modifiers, | |
1981 Element enclosing, | |
1982 bool hasBody) | |
1983 : super(name, ElementKind.SETTER, modifiers, enclosing, hasBody); | |
1984 } | |
1985 | |
1947 class LocalFunctionElementX extends BaseFunctionElementX | 1986 class LocalFunctionElementX extends BaseFunctionElementX |
1948 implements LocalFunctionElement { | 1987 implements LocalFunctionElement { |
1949 final FunctionExpression node; | 1988 final FunctionExpression node; |
1950 | 1989 |
1951 LocalFunctionElementX(String name, | 1990 LocalFunctionElementX(String name, |
1952 FunctionExpression this.node, | 1991 FunctionExpression this.node, |
1953 ElementKind kind, | 1992 ElementKind kind, |
1954 Modifiers modifiers, | 1993 Modifiers modifiers, |
1955 ExecutableElement enclosing) | 1994 ExecutableElement enclosing) |
1956 : super(name, kind, modifiers, enclosing, false); | 1995 : super(name, kind, modifiers, enclosing); |
1957 | 1996 |
1958 ExecutableElement get executableContext => enclosingElement; | 1997 ExecutableElement get executableContext => enclosingElement; |
1959 | 1998 |
1960 MemberElement get memberContext => executableContext.memberContext; | 1999 MemberElement get memberContext => executableContext.memberContext; |
1961 | 2000 |
1962 bool get hasNode => true; | 2001 bool get hasNode => true; |
1963 | 2002 |
1964 FunctionExpression parseNode(DiagnosticListener listener) => node; | 2003 FunctionExpression parseNode(DiagnosticListener listener) => node; |
1965 | 2004 |
1966 Token get position { | 2005 Token get position { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2000 } | 2039 } |
2001 | 2040 |
2002 abstract class ConstructorElementX extends FunctionElementX | 2041 abstract class ConstructorElementX extends FunctionElementX |
2003 with ConstantConstructorMixin implements ConstructorElement { | 2042 with ConstantConstructorMixin implements ConstructorElement { |
2004 bool isRedirectingGenerative = false; | 2043 bool isRedirectingGenerative = false; |
2005 | 2044 |
2006 ConstructorElementX(String name, | 2045 ConstructorElementX(String name, |
2007 ElementKind kind, | 2046 ElementKind kind, |
2008 Modifiers modifiers, | 2047 Modifiers modifiers, |
2009 Element enclosing) | 2048 Element enclosing) |
2010 : super(name, kind, modifiers, enclosing, false); | 2049 : super(name, kind, modifiers, enclosing); |
2011 | 2050 |
2012 FunctionElement immediateRedirectionTarget; | 2051 FunctionElement immediateRedirectionTarget; |
2013 | 2052 |
2014 bool get isRedirectingFactory => immediateRedirectionTarget != null; | 2053 bool get isRedirectingFactory => immediateRedirectionTarget != null; |
2015 | 2054 |
2016 /// This field is set by the post process queue when checking for cycles. | 2055 /// This field is set by the post process queue when checking for cycles. |
2017 ConstructorElement internalEffectiveTarget; | 2056 ConstructorElement internalEffectiveTarget; |
2018 DartType effectiveTargetType; | 2057 DartType effectiveTargetType; |
2019 | 2058 |
2020 void set effectiveTarget(ConstructorElement constructor) { | 2059 void set effectiveTarget(ConstructorElement constructor) { |
(...skipping 10 matching lines...) Expand all Loading... | |
2031 } | 2070 } |
2032 | 2071 |
2033 InterfaceType computeEffectiveTargetType(InterfaceType newType) { | 2072 InterfaceType computeEffectiveTargetType(InterfaceType newType) { |
2034 if (!isRedirectingFactory) return newType; | 2073 if (!isRedirectingFactory) return newType; |
2035 assert(invariant(this, effectiveTargetType != null, | 2074 assert(invariant(this, effectiveTargetType != null, |
2036 message: 'Redirection target type has not yet been computed for ' | 2075 message: 'Redirection target type has not yet been computed for ' |
2037 '$this.')); | 2076 '$this.')); |
2038 return effectiveTargetType.substByContext(newType); | 2077 return effectiveTargetType.substByContext(newType); |
2039 } | 2078 } |
2040 | 2079 |
2080 accept(ElementVisitor visitor, arg) { | |
2081 return visitor.visitConstructorElement(this, arg); | |
2082 } | |
2083 | |
2041 ConstructorElement get definingConstructor => null; | 2084 ConstructorElement get definingConstructor => null; |
2042 | 2085 |
2043 ClassElement get enclosingClass => enclosingElement; | 2086 ClassElement get enclosingClass => enclosingElement; |
2044 } | 2087 } |
2045 | 2088 |
2046 class DeferredLoaderGetterElementX extends FunctionElementX { | 2089 class DeferredLoaderGetterElementX extends GetterElementX |
2090 implements GetterElement { | |
2047 final PrefixElement prefix; | 2091 final PrefixElement prefix; |
2048 | 2092 |
2049 DeferredLoaderGetterElementX(PrefixElement prefix) | 2093 DeferredLoaderGetterElementX(PrefixElement prefix) |
2050 : this.prefix = prefix, | 2094 : this.prefix = prefix, |
2051 super("loadLibrary", | 2095 super("loadLibrary", |
2052 ElementKind.FUNCTION, | |
2053 Modifiers.EMPTY, | 2096 Modifiers.EMPTY, |
2054 prefix, true); | 2097 prefix, |
2098 false); | |
2055 | 2099 |
2056 FunctionSignature computeSignature(Compiler compiler) { | 2100 FunctionSignature computeSignature(Compiler compiler) { |
2057 if (functionSignatureCache != null) return functionSignature; | 2101 if (functionSignatureCache != null) return functionSignature; |
2058 compiler.withCurrentElement(this, () { | 2102 compiler.withCurrentElement(this, () { |
2059 DartType inner = new FunctionType(this); | 2103 DartType inner = new FunctionType(this); |
2060 functionSignatureCache = new FunctionSignatureX(type: inner); | 2104 functionSignatureCache = new FunctionSignatureX(type: inner); |
2061 }); | 2105 }); |
2062 return functionSignatureCache; | 2106 return functionSignatureCache; |
2063 } | 2107 } |
2064 | 2108 |
2065 bool get isClassMember => false; | 2109 bool get isClassMember => false; |
2066 | 2110 |
2067 bool isForeign(Backend backend) => true; | 2111 bool isForeign(Backend backend) => true; |
2068 | 2112 |
2069 bool get isSynthesized => true; | 2113 bool get isSynthesized => true; |
2070 | 2114 |
2071 bool get isFunction => false; | |
2072 | |
2073 bool get isDeferredLoaderGetter => true; | 2115 bool get isDeferredLoaderGetter => true; |
2074 | 2116 |
2075 bool get isGetter => true; | |
2076 | |
2077 bool get isTopLevel => true; | 2117 bool get isTopLevel => true; |
2078 // By having position null, the enclosing elements location is printed in | 2118 // By having position null, the enclosing elements location is printed in |
2079 // error messages. | 2119 // error messages. |
2080 Token get position => null; | 2120 Token get position => null; |
2081 | 2121 |
2082 FunctionExpression parseNode(DiagnosticListener listener) => null; | 2122 FunctionExpression parseNode(DiagnosticListener listener) => null; |
2083 | 2123 |
2084 bool get hasNode => false; | 2124 bool get hasNode => false; |
2085 | 2125 |
2086 FunctionExpression get node => null; | 2126 FunctionExpression get node => null; |
2127 | |
2128 @override | |
2129 SetterElement get setter => null; | |
2087 } | 2130 } |
2088 | 2131 |
2089 class ConstructorBodyElementX extends BaseFunctionElementX | 2132 class ConstructorBodyElementX extends BaseFunctionElementX |
2090 implements ConstructorBodyElement { | 2133 implements ConstructorBodyElement { |
2091 ConstructorElement constructor; | 2134 ConstructorElementX constructor; |
2092 | 2135 |
2093 ConstructorBodyElementX(FunctionElement constructor) | 2136 ConstructorBodyElementX(ConstructorElementX constructor) |
2094 : this.constructor = constructor, | 2137 : this.constructor = constructor, |
2095 super(constructor.name, | 2138 super(constructor.name, |
2096 ElementKind.GENERATIVE_CONSTRUCTOR_BODY, | 2139 ElementKind.GENERATIVE_CONSTRUCTOR_BODY, |
2097 Modifiers.EMPTY, | 2140 Modifiers.EMPTY, |
2098 constructor.enclosingElement, false) { | 2141 constructor.enclosingElement) { |
2099 functionSignatureCache = constructor.functionSignature; | 2142 functionSignatureCache = constructor.functionSignature; |
2100 } | 2143 } |
2101 | 2144 |
2102 bool get hasNode => constructor.hasNode; | 2145 bool get hasNode => constructor.hasNode; |
2103 | 2146 |
2104 FunctionExpression get node => constructor.node; | 2147 FunctionExpression get node => constructor.node; |
2105 | 2148 |
2106 Link<MetadataAnnotation> get metadata => constructor.metadata; | 2149 Link<MetadataAnnotation> get metadata => constructor.metadata; |
2107 | 2150 |
2108 bool get isInstanceMember => true; | 2151 bool get isInstanceMember => true; |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2826 modifiers, | 2869 modifiers, |
2827 enumClass); | 2870 enumClass); |
2828 | 2871 |
2829 @override | 2872 @override |
2830 bool get hasNode => true; | 2873 bool get hasNode => true; |
2831 | 2874 |
2832 @override | 2875 @override |
2833 FunctionExpression parseNode(Compiler compiler) => node; | 2876 FunctionExpression parseNode(Compiler compiler) => node; |
2834 } | 2877 } |
2835 | 2878 |
2836 class EnumMethodElementX extends FunctionElementX { | 2879 class EnumMethodElementX extends MethodElementX { |
2837 final FunctionExpression node; | 2880 final FunctionExpression node; |
2838 | 2881 |
2839 EnumMethodElementX(String name, | 2882 EnumMethodElementX(String name, |
2840 EnumClassElementX enumClass, | 2883 EnumClassElementX enumClass, |
2841 Modifiers modifiers, | 2884 Modifiers modifiers, |
2842 this.node) | 2885 this.node) |
2843 : super(name, | 2886 : super(name, ElementKind.FUNCTION, modifiers, enumClass, true); |
2844 ElementKind.FUNCTION, | |
2845 modifiers, | |
2846 enumClass, | |
2847 false); | |
2848 | 2887 |
2849 @override | 2888 @override |
2850 bool get hasNode => true; | 2889 bool get hasNode => true; |
2851 | 2890 |
2852 @override | 2891 @override |
2853 FunctionExpression parseNode(Compiler compiler) => node; | 2892 FunctionExpression parseNode(Compiler compiler) => node; |
2854 } | 2893 } |
2855 | 2894 |
2856 class EnumFormalElementX extends InitializingFormalElementX { | 2895 class EnumFormalElementX extends InitializingFormalElementX { |
2857 EnumFormalElementX(ConstructorElement constructor, | 2896 EnumFormalElementX(ConstructorElement constructor, |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3175 AstElement get definingElement; | 3214 AstElement get definingElement; |
3176 | 3215 |
3177 bool get hasResolvedAst => definingElement.hasTreeElements; | 3216 bool get hasResolvedAst => definingElement.hasTreeElements; |
3178 | 3217 |
3179 ResolvedAst get resolvedAst { | 3218 ResolvedAst get resolvedAst { |
3180 return new ResolvedAst(declaration, | 3219 return new ResolvedAst(declaration, |
3181 definingElement.node, definingElement.treeElements); | 3220 definingElement.node, definingElement.treeElements); |
3182 } | 3221 } |
3183 | 3222 |
3184 } | 3223 } |
OLD | NEW |