Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: pkg/compiler/lib/src/resolution/resolution.dart

Issue 2125823002: Handle redirects to unresolved redirects (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 f77519078554fdd3435b4a9270104b57fe86c583..90e6ad267db066a43ad2854397d4e19b97760807 100644
--- a/pkg/compiler/lib/src/resolution/resolution.dart
+++ b/pkg/compiler/lib/src/resolution/resolution.dart
@@ -448,11 +448,11 @@ class ResolverTask extends CompilerTask {
void resolveRedirectionChain(ConstructorElement constructor, Spannable node) {
ConstructorElement target = constructor;
- InterfaceType targetType;
- List<Element> seen = new List<Element>();
+ DartType targetType;
+ List<ConstructorElement> seen = new List<ConstructorElement>();
bool isMalformed = false;
// Follow the chain of redirections and check for cycles.
- while (target.isRedirectingFactory || target.isPatched) {
+ while (target.isRedirectingFactory) {
if (target.hasEffectiveTarget) {
// We found a constructor that already has been processed.
// TODO(johnniwinther): Should `effectiveTargetType` be part of the
@@ -466,12 +466,7 @@ class ResolverTask extends CompilerTask {
break;
}
- Element nextTarget;
- if (target.isPatched) {
- nextTarget = target.patch;
- } else {
- nextTarget = target.immediateRedirectionTarget;
- }
+ Element nextTarget = target.immediateRedirectionTarget;
Harry Terkelsen 2016/07/06 16:40:07 much cleaner!
if (seen.contains(nextTarget)) {
reporter.reportErrorMessage(
@@ -503,16 +498,14 @@ class ResolverTask extends CompilerTask {
// substitution of the target type with respect to the factory type.
while (!seen.isEmpty) {
ConstructorElementX factory = seen.removeLast();
- TreeElements treeElements = factory.treeElements;
- assert(invariant(node, treeElements != null,
- message: 'No TreeElements cached for $factory.'));
- if (!factory.isPatched) {
- FunctionExpression functionNode = factory.node;
- RedirectingFactoryBody redirectionNode = functionNode.body;
- DartType factoryType = treeElements.getType(redirectionNode);
- if (!factoryType.isDynamic) {
- targetType = targetType.substByContext(factoryType);
- }
+ ResolvedAst resolvedAst = factory.resolvedAst;
+ assert(invariant(node, resolvedAst != null,
+ message: 'No ResolvedAst for $factory.'));
+ FunctionExpression functionNode = resolvedAst.node;
+ RedirectingFactoryBody redirectionNode = resolvedAst.body;
+ DartType factoryType = resolvedAst.elements.getType(redirectionNode);
+ if (!factoryType.isDynamic) {
+ targetType = targetType.substByContext(factoryType);
}
factory.setEffectiveTarget(target, targetType, isMalformed: isMalformed);
}

Powered by Google App Engine
This is Rietveld 408576698