| 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 '../../compiler.dart' as api; | 8 import '../../compiler.dart' as api; |
| 9 import '../tree/tree.dart'; | 9 import '../tree/tree.dart'; |
| 10 import '../util/util.dart'; | 10 import '../util/util.dart'; |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 throw 'unsupported operation on erroneous element'; | 326 throw 'unsupported operation on erroneous element'; |
| 327 } | 327 } |
| 328 | 328 |
| 329 Link<MetadataAnnotation> get metadata => unsupported(); | 329 Link<MetadataAnnotation> get metadata => unsupported(); |
| 330 get type => unsupported(); | 330 get type => unsupported(); |
| 331 get cachedNode => unsupported(); | 331 get cachedNode => unsupported(); |
| 332 get functionSignature => unsupported(); | 332 get functionSignature => unsupported(); |
| 333 get patch => null; | 333 get patch => null; |
| 334 get origin => this; | 334 get origin => this; |
| 335 get defaultImplementation => unsupported(); | 335 get defaultImplementation => unsupported(); |
| 336 get nestedClosures => unsupported(); |
| 336 | 337 |
| 337 bool get isRedirectingFactory => unsupported(); | 338 bool get isRedirectingFactory => unsupported(); |
| 338 | 339 |
| 339 setPatch(patch) => unsupported(); | 340 setPatch(patch) => unsupported(); |
| 340 computeSignature(compiler) => unsupported(); | 341 computeSignature(compiler) => unsupported(); |
| 341 requiredParameterCount(compiler) => unsupported(); | 342 requiredParameterCount(compiler) => unsupported(); |
| 342 optionalParameterCount(compiler) => unsupported(); | 343 optionalParameterCount(compiler) => unsupported(); |
| 343 parameterCount(compiler) => unsupported(); | 344 parameterCount(compiler) => unsupported(); |
| 344 | 345 |
| 345 // TODO(kasperl): These seem unnecessary. | 346 // TODO(kasperl): These seem unnecessary. |
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 | 1158 |
| 1158 bool isInstanceMember() => variables.isInstanceMember(); | 1159 bool isInstanceMember() => variables.isInstanceMember(); |
| 1159 | 1160 |
| 1160 // Note: cachedNode.getBeginToken() will not be correct in all | 1161 // Note: cachedNode.getBeginToken() will not be correct in all |
| 1161 // cases, for example, for function typed parameters. | 1162 // cases, for example, for function typed parameters. |
| 1162 Token position() => findMyName(variables.position()); | 1163 Token position() => findMyName(variables.position()); |
| 1163 | 1164 |
| 1164 accept(ElementVisitor visitor) => visitor.visitVariableElement(this); | 1165 accept(ElementVisitor visitor) => visitor.visitVariableElement(this); |
| 1165 } | 1166 } |
| 1166 | 1167 |
| 1168 class FieldElementX extends VariableElementX implements FieldElement { |
| 1169 List<FunctionElement> nestedClosures = new List<FunctionElement>(); |
| 1170 |
| 1171 FieldElementX(String name, |
| 1172 VariableListElement variables, |
| 1173 Expression cachedNode) |
| 1174 : super(name, variables, ElementKind.FIELD, cachedNode); |
| 1175 |
| 1176 accept(ElementVisitor visitor) => visitor.visitFieldElement(this); |
| 1177 } |
| 1178 |
| 1167 /** | 1179 /** |
| 1168 * Parameters in constructors that directly initialize fields. For example: | 1180 * Parameters in constructors that directly initialize fields. For example: |
| 1169 * [:A(this.field):]. | 1181 * [:A(this.field):]. |
| 1170 */ | 1182 */ |
| 1171 class FieldParameterElementX extends VariableElementX | 1183 class FieldParameterElementX extends VariableElementX |
| 1172 implements FieldParameterElement { | 1184 implements FieldParameterElement { |
| 1173 VariableElement fieldElement; | 1185 VariableElement fieldElement; |
| 1174 | 1186 |
| 1175 FieldParameterElementX(String name, | 1187 FieldParameterElementX(String name, |
| 1176 this.fieldElement, | 1188 this.fieldElement, |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1413 } | 1425 } |
| 1414 return true; | 1426 return true; |
| 1415 } | 1427 } |
| 1416 } | 1428 } |
| 1417 | 1429 |
| 1418 class FunctionElementX extends ElementX implements FunctionElement { | 1430 class FunctionElementX extends ElementX implements FunctionElement { |
| 1419 FunctionExpression cachedNode; | 1431 FunctionExpression cachedNode; |
| 1420 DartType type; | 1432 DartType type; |
| 1421 final Modifiers modifiers; | 1433 final Modifiers modifiers; |
| 1422 | 1434 |
| 1435 List<FunctionElement> nestedClosures = new List<FunctionElement>(); |
| 1436 |
| 1423 FunctionSignature functionSignature; | 1437 FunctionSignature functionSignature; |
| 1424 | 1438 |
| 1425 /** | 1439 /** |
| 1426 * A function declaration that should be parsed instead of the current one. | 1440 * A function declaration that should be parsed instead of the current one. |
| 1427 * The patch should be parsed as if it was in the current scope. Its | 1441 * The patch should be parsed as if it was in the current scope. Its |
| 1428 * signature must match this function's signature. | 1442 * signature must match this function's signature. |
| 1429 */ | 1443 */ |
| 1430 FunctionElement patch = null; | 1444 FunctionElement patch = null; |
| 1431 FunctionElement origin = null; | 1445 FunctionElement origin = null; |
| 1432 | 1446 |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2054 | 2068 |
| 2055 /** | 2069 /** |
| 2056 * Runs through all instance-field members of this class. | 2070 * Runs through all instance-field members of this class. |
| 2057 * | 2071 * |
| 2058 * The enclosing class is passed to the callback. This is useful when | 2072 * The enclosing class is passed to the callback. This is useful when |
| 2059 * [includeSuperAndInjectedMembers] is [:true:]. | 2073 * [includeSuperAndInjectedMembers] is [:true:]. |
| 2060 * | 2074 * |
| 2061 * When called on the implementation element both the fields declared in the | 2075 * When called on the implementation element both the fields declared in the |
| 2062 * origin and in the patch are included. | 2076 * origin and in the patch are included. |
| 2063 */ | 2077 */ |
| 2064 void forEachInstanceField(void f(ClassElement enclosingClass, Element field), | 2078 void forEachInstanceField(void f(ClassElement enclosingClass, |
| 2079 FieldElement field), |
| 2065 {bool includeSuperAndInjectedMembers: false}) { | 2080 {bool includeSuperAndInjectedMembers: false}) { |
| 2066 // Filters so that [f] is only invoked with instance fields. | 2081 // Filters so that [f] is only invoked with instance fields. |
| 2067 void fieldFilter(ClassElement enclosingClass, Element member) { | 2082 void fieldFilter(ClassElement enclosingClass, Element member) { |
| 2068 if (member.isInstanceMember() && member.kind == ElementKind.FIELD) { | 2083 if (member.isInstanceMember() && member.kind == ElementKind.FIELD) { |
| 2069 f(enclosingClass, member); | 2084 f(enclosingClass, member); |
| 2070 } | 2085 } |
| 2071 } | 2086 } |
| 2072 | 2087 |
| 2073 forEachMember(fieldFilter, | 2088 forEachMember(fieldFilter, |
| 2074 includeSuperAndInjectedMembers: includeSuperAndInjectedMembers); | 2089 includeSuperAndInjectedMembers: includeSuperAndInjectedMembers); |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2414 | 2429 |
| 2415 MetadataAnnotation ensureResolved(Compiler compiler) { | 2430 MetadataAnnotation ensureResolved(Compiler compiler) { |
| 2416 if (resolutionState == STATE_NOT_STARTED) { | 2431 if (resolutionState == STATE_NOT_STARTED) { |
| 2417 compiler.resolver.resolveMetadataAnnotation(this); | 2432 compiler.resolver.resolveMetadataAnnotation(this); |
| 2418 } | 2433 } |
| 2419 return this; | 2434 return this; |
| 2420 } | 2435 } |
| 2421 | 2436 |
| 2422 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 2437 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
| 2423 } | 2438 } |
| OLD | NEW |