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 '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/resolution.dart' show | 8 import '../common/resolution.dart' show |
9 Resolution, | 9 Resolution, |
10 Parsing; | 10 Parsing; |
(...skipping 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2071 return 'patch ${super.toString()}'; | 2071 return 'patch ${super.toString()}'; |
2072 } else if (isPatched) { | 2072 } else if (isPatched) { |
2073 return 'origin ${super.toString()}'; | 2073 return 'origin ${super.toString()}'; |
2074 } else { | 2074 } else { |
2075 return super.toString(); | 2075 return super.toString(); |
2076 } | 2076 } |
2077 } | 2077 } |
2078 | 2078 |
2079 bool get isAbstract => false; | 2079 bool get isAbstract => false; |
2080 | 2080 |
2081 accept(ElementVisitor visitor, arg) { | |
2082 return visitor.visitFunctionElement(this, arg); | |
2083 } | |
2084 | |
2085 // A function is defined by the implementation element. | 2081 // A function is defined by the implementation element. |
2086 AstElement get definingElement => implementation; | 2082 AstElement get definingElement => implementation; |
2087 } | 2083 } |
2088 | 2084 |
2089 abstract class FunctionElementX extends BaseFunctionElementX | 2085 abstract class FunctionElementX extends BaseFunctionElementX |
2090 with AnalyzableElementX implements MethodElement { | 2086 with AnalyzableElementX implements MethodElement { |
2091 | 2087 |
2092 FunctionElementX(String name, | 2088 FunctionElementX(String name, |
2093 ElementKind kind, | 2089 ElementKind kind, |
2094 Modifiers modifiers, | 2090 Modifiers modifiers, |
(...skipping 30 matching lines...) Expand all Loading... |
2125 Modifiers modifiers, | 2121 Modifiers modifiers, |
2126 Element enclosing, | 2122 Element enclosing, |
2127 // TODO(15101): Make this a named parameter. | 2123 // TODO(15101): Make this a named parameter. |
2128 this.hasBody) | 2124 this.hasBody) |
2129 : super(name, kind, modifiers, enclosing); | 2125 : super(name, kind, modifiers, enclosing); |
2130 | 2126 |
2131 @override | 2127 @override |
2132 bool get isAbstract { | 2128 bool get isAbstract { |
2133 return !modifiers.isExternal && !hasBody; | 2129 return !modifiers.isExternal && !hasBody; |
2134 } | 2130 } |
| 2131 |
| 2132 accept(ElementVisitor visitor, arg) { |
| 2133 return visitor.visitMethodElement(this, arg); |
| 2134 } |
2135 } | 2135 } |
2136 | 2136 |
2137 abstract class AccessorElementX extends MethodElementX | 2137 abstract class AccessorElementX extends MethodElementX |
2138 implements AccessorElement { | 2138 implements AccessorElement { |
2139 AbstractFieldElement abstractField; | 2139 AbstractFieldElement abstractField; |
2140 | 2140 |
2141 AccessorElementX(String name, | 2141 AccessorElementX(String name, |
2142 ElementKind kind, | 2142 ElementKind kind, |
2143 Modifiers modifiers, | 2143 Modifiers modifiers, |
2144 Element enclosing, | 2144 Element enclosing, |
2145 bool hasBody) | 2145 bool hasBody) |
2146 : super(name, kind, modifiers, enclosing, hasBody); | 2146 : super(name, kind, modifiers, enclosing, hasBody); |
2147 } | 2147 } |
2148 | 2148 |
2149 abstract class GetterElementX extends AccessorElementX | 2149 abstract class GetterElementX extends AccessorElementX |
2150 implements GetterElement { | 2150 implements GetterElement { |
2151 | 2151 |
2152 GetterElementX(String name, | 2152 GetterElementX(String name, |
2153 Modifiers modifiers, | 2153 Modifiers modifiers, |
2154 Element enclosing, | 2154 Element enclosing, |
2155 bool hasBody) | 2155 bool hasBody) |
2156 : super(name, ElementKind.GETTER, modifiers, enclosing, hasBody); | 2156 : super(name, ElementKind.GETTER, modifiers, enclosing, hasBody); |
| 2157 |
| 2158 accept(ElementVisitor visitor, arg) { |
| 2159 return visitor.visitGetterElement(this, arg); |
| 2160 } |
2157 } | 2161 } |
2158 | 2162 |
2159 abstract class SetterElementX extends AccessorElementX | 2163 abstract class SetterElementX extends AccessorElementX |
2160 implements SetterElement { | 2164 implements SetterElement { |
2161 | 2165 |
2162 SetterElementX(String name, | 2166 SetterElementX(String name, |
2163 Modifiers modifiers, | 2167 Modifiers modifiers, |
2164 Element enclosing, | 2168 Element enclosing, |
2165 bool hasBody) | 2169 bool hasBody) |
2166 : super(name, ElementKind.SETTER, modifiers, enclosing, hasBody); | 2170 : super(name, ElementKind.SETTER, modifiers, enclosing, hasBody); |
| 2171 |
| 2172 accept(ElementVisitor visitor, arg) { |
| 2173 return visitor.visitSetterElement(this, arg); |
| 2174 } |
2167 } | 2175 } |
2168 | 2176 |
2169 class LocalFunctionElementX extends BaseFunctionElementX | 2177 class LocalFunctionElementX extends BaseFunctionElementX |
2170 implements LocalFunctionElement { | 2178 implements LocalFunctionElement { |
2171 final FunctionExpression node; | 2179 final FunctionExpression node; |
2172 | 2180 |
2173 LocalFunctionElementX(String name, | 2181 LocalFunctionElementX(String name, |
2174 FunctionExpression this.node, | 2182 FunctionExpression this.node, |
2175 ElementKind kind, | 2183 ElementKind kind, |
2176 Modifiers modifiers, | 2184 Modifiers modifiers, |
(...skipping 11 matching lines...) Expand all Loading... |
2188 Token get position { | 2196 Token get position { |
2189 // Use the name as position if this is not an unnamed closure. | 2197 // Use the name as position if this is not an unnamed closure. |
2190 if (node.name != null) { | 2198 if (node.name != null) { |
2191 return node.name.getBeginToken(); | 2199 return node.name.getBeginToken(); |
2192 } else { | 2200 } else { |
2193 return node.getBeginToken(); | 2201 return node.getBeginToken(); |
2194 } | 2202 } |
2195 } | 2203 } |
2196 | 2204 |
2197 bool get isLocal => true; | 2205 bool get isLocal => true; |
| 2206 |
| 2207 accept(ElementVisitor visitor, arg) { |
| 2208 return visitor.visitLocalFunctionElement(this, arg); |
| 2209 } |
2198 } | 2210 } |
2199 | 2211 |
2200 abstract class ConstantConstructorMixin implements ConstructorElement { | 2212 abstract class ConstantConstructorMixin implements ConstructorElement { |
2201 ConstantConstructor _constantConstructor; | 2213 ConstantConstructor _constantConstructor; |
2202 | 2214 |
2203 ConstantConstructor get constantConstructor { | 2215 ConstantConstructor get constantConstructor { |
2204 if (isPatch) { | 2216 if (isPatch) { |
2205 ConstructorElement originConstructor = origin; | 2217 ConstructorElement originConstructor = origin; |
2206 return originConstructor.constantConstructor; | 2218 return originConstructor.constantConstructor; |
2207 } | 2219 } |
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3184 AstElement get definingElement; | 3196 AstElement get definingElement; |
3185 | 3197 |
3186 bool get hasResolvedAst => definingElement.hasTreeElements; | 3198 bool get hasResolvedAst => definingElement.hasTreeElements; |
3187 | 3199 |
3188 ResolvedAst get resolvedAst { | 3200 ResolvedAst get resolvedAst { |
3189 return new ResolvedAst(declaration, | 3201 return new ResolvedAst(declaration, |
3190 definingElement.node, definingElement.treeElements); | 3202 definingElement.node, definingElement.treeElements); |
3191 } | 3203 } |
3192 | 3204 |
3193 } | 3205 } |
OLD | NEW |