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

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

Issue 11308347: Fix crash on factory redirection to an unresolved class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | dart/sdk/lib/_internal/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of resolution; 5 part of resolution;
6 6
7 abstract class TreeElements { 7 abstract class TreeElements {
8 Element operator[](Node node); 8 Element operator[](Node node);
9 Selector getSelector(Send send); 9 Selector getSelector(Send send);
10 DartType getType(Node node); 10 DartType getType(Node node);
(...skipping 2015 matching lines...) Expand 10 before | Expand all | Expand 10 after
2026 var type = mapping.getType(node.expression); 2026 var type = mapping.getType(node.expression);
2027 if (type is InterfaceType && !type.isRaw) { 2027 if (type is InterfaceType && !type.isRaw) {
2028 unimplemented(node.expression, 'type arguments on redirecting factory'); 2028 unimplemented(node.expression, 'type arguments on redirecting factory');
2029 } 2029 }
2030 useElement(node.expression, redirectionTarget); 2030 useElement(node.expression, redirectionTarget);
2031 FunctionElement constructor = enclosingElement; 2031 FunctionElement constructor = enclosingElement;
2032 if (constructor.modifiers.isConst() && 2032 if (constructor.modifiers.isConst() &&
2033 !redirectionTarget.modifiers.isConst()) { 2033 !redirectionTarget.modifiers.isConst()) {
2034 error(node, MessageKind.CONSTRUCTOR_IS_NOT_CONST); 2034 error(node, MessageKind.CONSTRUCTOR_IS_NOT_CONST);
2035 } 2035 }
2036 constructor.defaultImplementation = redirectionTarget;
2037 if (Elements.isUnresolved(redirectionTarget)) return;
2038
2036 // TODO(ahe): Check that this doesn't lead to a cycle. For now, 2039 // TODO(ahe): Check that this doesn't lead to a cycle. For now,
2037 // just make sure that the redirection target isn't itself a 2040 // just make sure that the redirection target isn't itself a
2038 // redirecting factory. 2041 // redirecting factory.
2039 { // This entire block is temporary code per the above TODO. 2042 { // This entire block is temporary code per the above TODO.
2040 FunctionElement targetImplementation = redirectionTarget.implementation; 2043 FunctionElement targetImplementation = redirectionTarget.implementation;
2041 FunctionExpression function = targetImplementation.parseNode(compiler); 2044 FunctionExpression function = targetImplementation.parseNode(compiler);
2042 if (function.body != null && function.body.asReturn() != null 2045 if (function.body != null && function.body.asReturn() != null
2043 && function.body.asReturn().isRedirectingFactoryBody) { 2046 && function.body.asReturn().isRedirectingFactoryBody) {
2044 unimplemented(node.expression, 'redirecing to redirecting factory'); 2047 unimplemented(node.expression, 'redirecing to redirecting factory');
2045 } 2048 }
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after
3207 return e; 3210 return e;
3208 } 3211 }
3209 3212
3210 /// Assumed to be called by [resolveRedirectingFactory]. 3213 /// Assumed to be called by [resolveRedirectingFactory].
3211 Element visitReturn(Return node) { 3214 Element visitReturn(Return node) {
3212 Node expression = node.expression; 3215 Node expression = node.expression;
3213 return finishConstructorReference(visit(expression), 3216 return finishConstructorReference(visit(expression),
3214 expression, expression); 3217 expression, expression);
3215 } 3218 }
3216 } 3219 }
OLDNEW
« no previous file with comments | « no previous file | dart/sdk/lib/_internal/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698