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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart

Issue 11365108: Implement redirecting constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 8 years, 1 month 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: dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart
index 357c08ae25077b334580277a1f946c7bc6740d54..719b88b87f79a9823b8c18cd86dd74a6b3dfa481 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -1875,7 +1875,15 @@ class ResolverVisitor extends CommonResolverVisitor<Element> {
visitReturn(Return node) {
if (node.isRedirectingFactoryBody) {
- useElement(node.expression, resolveRedirectingFactory(node));
+ Element redirectionTarget = resolveRedirectingFactory(node);
+ useElement(node.expression, redirectionTarget);
+ assert(invariant(node, enclosingElement.isFactoryConstructor()));
+ FunctionElement constructor = enclosingElement;
+ // TODO(ahe): Check that this doesn't lead to a cycle. For now,
+ // that is checked on demand when the backend requests this
+ // constructor and it leads to a crash.
+ constructor.defaultImplementation = redirectionTarget;
+ world.registerStaticUse(redirectionTarget);
} else {
visit(node.expression);
}

Powered by Google App Engine
This is Rietveld 408576698