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

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

Issue 1382313002: dart2js: set effective target for patched constructors (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « pkg/compiler/lib/src/elements/modelx.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ef5c04f199decfe7d8488c1df9faff384e71f0ac..efb6b35aed975779822002464dabcfd0cfb77f3e 100644
--- a/pkg/compiler/lib/src/resolution/resolution.dart
+++ b/pkg/compiler/lib/src/resolution/resolution.dart
@@ -416,7 +416,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;
@@ -427,7 +427,13 @@ class ResolverTask extends CompilerTask {
break;
}
- Element nextTarget = target.immediateRedirectionTarget;
+ Element nextTarget;
+ if (target.isPatched) {
+ nextTarget = target.patch;
+ } else {
+ nextTarget = target.immediateRedirectionTarget;
+ }
+
if (seen.contains(nextTarget)) {
reporter.reportErrorMessage(
node, MessageKind.CYCLIC_REDIRECTING_FACTORY);
@@ -458,11 +464,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);
+ RedirectingFactoryBody redirectionNode = functionNode.body;
+ DartType factoryType = treeElements.getType(redirectionNode);
+ if (!factoryType.isDynamic) {
+ targetType = targetType.substByContext(factoryType);
+ }
}
factory.effectiveTarget = target;
factory.effectiveTargetType = targetType;
« no previous file with comments | « pkg/compiler/lib/src/elements/modelx.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698