| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |