Index: pkg/compiler/lib/src/resolution/resolution.dart |
diff --git a/pkg/compiler/lib/src/resolution/resolution.dart b/pkg/compiler/lib/src/resolution/resolution.dart |
index 4a3118bf585f45f0a27fc95b2ba84f6707038589..2a74eb16c85240460c980b0f1193a53e4c4ecd4d 100644 |
--- a/pkg/compiler/lib/src/resolution/resolution.dart |
+++ b/pkg/compiler/lib/src/resolution/resolution.dart |
@@ -421,7 +421,7 @@ class ResolverTask extends CompilerTask { |
InterfaceType targetType; |
List<Element> seen = new List<Element>(); |
// Follow the chain of redirections and check for cycles. |
- while (target.isRedirectingFactory) { |
+ while (target.isRedirectingFactory || target.isPatched) { |
if (target.internalEffectiveTarget != null) { |
// We found a constructor that already has been processed. |
targetType = target.effectiveTargetType; |
@@ -432,7 +432,13 @@ class ResolverTask extends CompilerTask { |
break; |
} |
- Element nextTarget = target.immediateRedirectionTarget; |
+ Element nextTarget; |
+ if (target.isPatched) { |
+ nextTarget = target.implementation; |
+ } else { |
+ nextTarget = target.immediateRedirectionTarget; |
+ } |
+ |
if (seen.contains(nextTarget)) { |
compiler.reportErrorMessage( |
node, MessageKind.CYCLIC_REDIRECTING_FACTORY); |
@@ -463,11 +469,13 @@ class ResolverTask extends CompilerTask { |
TreeElements treeElements = factory.treeElements; |
assert(invariant(node, treeElements != null, |
message: 'No TreeElements cached for $factory.')); |
- FunctionExpression functionNode = factory.parseNode(parsing); |
- RedirectingFactoryBody redirectionNode = functionNode.body; |
- DartType factoryType = treeElements.getType(redirectionNode); |
- if (!factoryType.isDynamic) { |
- targetType = targetType.substByContext(factoryType); |
+ if (!factory.isPatched) { |
+ FunctionExpression functionNode = factory.parseNode(parsing); |
+ Statement redirectionNode = functionNode.body; |
Johnni Winther
2015/10/06 10:38:14
Why is this needed?
Harry Terkelsen
2015/10/12 18:17:44
Good catch, it's not needed. It was from an earlie
|
+ DartType factoryType = treeElements.getType(redirectionNode); |
+ if (!factoryType.isDynamic) { |
+ targetType = targetType.substByContext(factoryType); |
+ } |
} |
factory.effectiveTarget = target; |
factory.effectiveTargetType = targetType; |