Chromium Code Reviews| 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 'dart:collection' show LinkedHashMap; | 7 import 'dart:collection' show LinkedHashMap; |
| 8 | 8 |
| 9 import 'elements.dart'; | 9 import 'elements.dart'; |
| 10 import '../../compiler.dart' as api; | 10 import '../../compiler.dart' as api; |
| (...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1268 : super(name, kind, enclosing) { | 1268 : super(name, kind, enclosing) { |
| 1269 assert(modifiers != null); | 1269 assert(modifiers != null); |
| 1270 defaultImplementation = this; | 1270 defaultImplementation = this; |
| 1271 } | 1271 } |
| 1272 | 1272 |
| 1273 bool get isPatched => patch != null; | 1273 bool get isPatched => patch != null; |
| 1274 bool get isPatch => origin != null; | 1274 bool get isPatch => origin != null; |
| 1275 | 1275 |
| 1276 bool get isRedirectingFactory => defaultImplementation != this; | 1276 bool get isRedirectingFactory => defaultImplementation != this; |
| 1277 | 1277 |
| 1278 FunctionElement get redirectionTarget { | 1278 /// This field is set by the post process queue when checking for cycles. |
| 1279 if (this == defaultImplementation) return this; | 1279 FunctionElement internalRedirectionTarget; |
| 1280 var target = defaultImplementation; | 1280 set redirectionTarget(FunctionElement constructor) { |
| 1281 Set<Element> seen = new Set<Element>(); | 1281 assert(constructor != null && internalRedirectionTarget == null); |
| 1282 seen.add(target); | 1282 internalRedirectionTarget = constructor; |
| 1283 while (!target.isErroneous() && target != target.defaultImplementation) { | 1283 } |
| 1284 target = target.defaultImplementation; | 1284 get redirectionTarget { |
| 1285 if (seen.contains(target)) { | 1285 return internalRedirectionTarget != null ? internalRedirectionTarget |
| 1286 // TODO(ahe): This is expedient for now, but it should be | 1286 : defaultImplementation; |
|
ngeoffray
2013/09/18 11:19:23
This looks weird. Depending on the current stage o
karlklose
2013/09/18 12:30:39
Actually I can decide which of them to return inde
| |
| 1287 // checked by the resolver. Keeping http://dartbug.com/3970 | |
| 1288 // open to track this. | |
| 1289 throw new SpannableAssertionFailure( | |
| 1290 target, 'redirecting factory leads to cycle'); | |
| 1291 } | |
| 1292 } | |
| 1293 return target; | |
| 1294 } | 1287 } |
| 1295 | 1288 |
| 1296 InterfaceType computeTargetType(Compiler compiler, | 1289 InterfaceType computeTargetType(Compiler compiler, |
| 1297 InterfaceType newType) { | 1290 InterfaceType newType) { |
| 1298 if (!isRedirectingFactory) return newType; | 1291 if (!isRedirectingFactory) return newType; |
| 1299 ClassElement targetClass = getEnclosingClass(); | 1292 ClassElement targetClass = getEnclosingClass(); |
| 1300 TreeElements treeElements = | 1293 TreeElements treeElements = |
| 1301 compiler.enqueuer.resolution.getCachedElements( | 1294 compiler.enqueuer.resolution.getCachedElements( |
| 1302 declaration); | 1295 declaration); |
| 1303 FunctionExpression functionNode = parseNode(compiler); | 1296 FunctionExpression functionNode = parseNode(compiler); |
| (...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2217 | 2210 |
| 2218 MetadataAnnotation ensureResolved(Compiler compiler) { | 2211 MetadataAnnotation ensureResolved(Compiler compiler) { |
| 2219 if (resolutionState == STATE_NOT_STARTED) { | 2212 if (resolutionState == STATE_NOT_STARTED) { |
| 2220 compiler.resolver.resolveMetadataAnnotation(this); | 2213 compiler.resolver.resolveMetadataAnnotation(this); |
| 2221 } | 2214 } |
| 2222 return this; | 2215 return this; |
| 2223 } | 2216 } |
| 2224 | 2217 |
| 2225 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 2218 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
| 2226 } | 2219 } |
| OLD | NEW |