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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/ssa/builder.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/ssa/builder.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/dart/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
index 720aad368b262b74b0bd9a01d7b23b86e32fd0f7..db63457ecbf9f5de6095e5cf639ededaae183727 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
@@ -3073,7 +3073,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
compiler.internalError("Unresolved element: $constructor", node: node);
}
FunctionElement functionElement = constructor;
- constructor = functionElement.defaultImplementation;
+ constructor = functionElement.redirectionTarget;
// TODO(5346): Try to avoid the need for calling [declaration] before
// creating an [HStatic].
HInstruction target = new HStatic(constructor.declaration);
@@ -3307,6 +3307,9 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
visitNewExpression(NewExpression node) {
Element element = elements[node.send];
+ if (!Elements.isErroneousElement(element)) {
+ element = element.redirectionTarget;
+ }
if (Elements.isErroneousElement(element)) {
ErroneousElement error = element;
if (error.messageKind == MessageKind.CANNOT_FIND_CONSTRUCTOR) {
@@ -3523,10 +3526,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
native.handleSsaNative(this, node.expression);
return;
}
- if (node.isRedirectingFactoryBody) {
- compiler.internalError("Unimplemented: Redirecting factory constructor",
- node: node);
- }
+ assert(invariant(node, !node.isRedirectingFactoryBody));
HInstruction value;
if (node.expression == null) {
value = graph.addConstantNull(constantSystem);
« no previous file with comments | « dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart ('k') | dart/tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698