| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 dart2js.resolution; | 5 library dart2js.resolution; |
| 6 | 6 |
| 7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
| 8 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../common/names.dart' show Identifiers; | 10 import '../common/names.dart' show Identifiers; |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 if (annotation == null) return const DynamicType(); | 411 if (annotation == null) return const DynamicType(); |
| 412 DartType result = visitorFor(element).resolveTypeAnnotation(annotation); | 412 DartType result = visitorFor(element).resolveTypeAnnotation(annotation); |
| 413 if (result == null) { | 413 if (result == null) { |
| 414 // TODO(karklose): warning. | 414 // TODO(karklose): warning. |
| 415 return const DynamicType(); | 415 return const DynamicType(); |
| 416 } | 416 } |
| 417 return result; | 417 return result; |
| 418 } | 418 } |
| 419 | 419 |
| 420 void resolveRedirectionChain( | 420 void resolveRedirectionChain( |
| 421 ConstructorElementX constructor, Spannable node) { | 421 ConstructorElement constructor, Spannable node) { |
| 422 ConstructorElementX target = constructor; | 422 ConstructorElement target = constructor; |
| 423 InterfaceType targetType; | 423 InterfaceType targetType; |
| 424 List<Element> seen = new List<Element>(); | 424 List<Element> seen = new List<Element>(); |
| 425 bool isMalformed = false; | 425 bool isMalformed = false; |
| 426 // Follow the chain of redirections and check for cycles. | 426 // Follow the chain of redirections and check for cycles. |
| 427 while (target.isRedirectingFactory || target.isPatched) { | 427 while (target.isRedirectingFactory || target.isPatched) { |
| 428 if (target.effectiveTargetInternal != null) { | 428 if (target.hasEffectiveTarget) { |
| 429 // We found a constructor that already has been processed. | 429 // We found a constructor that already has been processed. |
| 430 targetType = target.effectiveTargetType; | 430 // TODO(johnniwinther): Should `effectiveTargetType` be part of the |
| 431 // interface? |
| 432 targetType = target.computeEffectiveTargetType( |
| 433 target.enclosingClass.thisType); |
| 431 assert(invariant(target, targetType != null, | 434 assert(invariant(target, targetType != null, |
| 432 message: 'Redirection target type has not been computed for ' | 435 message: 'Redirection target type has not been computed for ' |
| 433 '$target')); | 436 '$target')); |
| 434 target = target.effectiveTargetInternal; | 437 target = target.effectiveTarget; |
| 435 break; | 438 break; |
| 436 } | 439 } |
| 437 | 440 |
| 438 Element nextTarget; | 441 Element nextTarget; |
| 439 if (target.isPatched) { | 442 if (target.isPatched) { |
| 440 nextTarget = target.patch; | 443 nextTarget = target.patch; |
| 441 } else { | 444 } else { |
| 442 nextTarget = target.immediateRedirectionTarget; | 445 nextTarget = target.immediateRedirectionTarget; |
| 443 } | 446 } |
| 444 | 447 |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 TreeElements get treeElements { | 1100 TreeElements get treeElements { |
| 1098 assert(invariant(this, _treeElements != null, | 1101 assert(invariant(this, _treeElements != null, |
| 1099 message: "TreeElements have not been computed for $this.")); | 1102 message: "TreeElements have not been computed for $this.")); |
| 1100 return _treeElements; | 1103 return _treeElements; |
| 1101 } | 1104 } |
| 1102 | 1105 |
| 1103 void reuseElement() { | 1106 void reuseElement() { |
| 1104 _treeElements = null; | 1107 _treeElements = null; |
| 1105 } | 1108 } |
| 1106 } | 1109 } |
| OLD | NEW |