| 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 2230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2241 compiler.reportMessage( | 2241 compiler.reportMessage( |
| 2242 compiler.spanFromSpannable(node), | 2242 compiler.spanFromSpannable(node), |
| 2243 MessageKind.FACTORY_REDIRECTION_IN_NON_FACTORY.error([]), | 2243 MessageKind.FACTORY_REDIRECTION_IN_NON_FACTORY.error([]), |
| 2244 Diagnostic.ERROR); | 2244 Diagnostic.ERROR); |
| 2245 compiler.reportMessage( | 2245 compiler.reportMessage( |
| 2246 compiler.spanFromSpannable(enclosingElement), | 2246 compiler.spanFromSpannable(enclosingElement), |
| 2247 MessageKind.MISSING_FACTORY_KEYWORD.error([]), | 2247 MessageKind.MISSING_FACTORY_KEYWORD.error([]), |
| 2248 Diagnostic.INFO); | 2248 Diagnostic.INFO); |
| 2249 } | 2249 } |
| 2250 Element redirectionTarget = resolveRedirectingFactory(node); | 2250 Element redirectionTarget = resolveRedirectingFactory(node); |
| 2251 var type = mapping.getType(node.expression); | |
| 2252 if (type is InterfaceType && !type.isRaw) { | |
| 2253 unimplemented(node.expression, 'type arguments on redirecting factory'); | |
| 2254 } | |
| 2255 useElement(node.expression, redirectionTarget); | 2251 useElement(node.expression, redirectionTarget); |
| 2256 FunctionElement constructor = enclosingElement; | 2252 FunctionElement constructor = enclosingElement; |
| 2257 if (constructor.modifiers.isConst() && | 2253 if (constructor.modifiers.isConst() && |
| 2258 !redirectionTarget.modifiers.isConst()) { | 2254 !redirectionTarget.modifiers.isConst()) { |
| 2259 error(node, MessageKind.CONSTRUCTOR_IS_NOT_CONST); | 2255 error(node, MessageKind.CONSTRUCTOR_IS_NOT_CONST); |
| 2260 } | 2256 } |
| 2261 constructor.defaultImplementation = redirectionTarget; | 2257 constructor.defaultImplementation = redirectionTarget; |
| 2262 if (Elements.isUnresolved(redirectionTarget)) return; | 2258 if (Elements.isUnresolved(redirectionTarget)) return; |
| 2263 | 2259 |
| 2264 // TODO(ahe): Check that this doesn't lead to a cycle. For now, | 2260 // TODO(ahe): Check that this doesn't lead to a cycle. For now, |
| (...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3603 return e; | 3599 return e; |
| 3604 } | 3600 } |
| 3605 | 3601 |
| 3606 /// Assumed to be called by [resolveRedirectingFactory]. | 3602 /// Assumed to be called by [resolveRedirectingFactory]. |
| 3607 Element visitReturn(Return node) { | 3603 Element visitReturn(Return node) { |
| 3608 Node expression = node.expression; | 3604 Node expression = node.expression; |
| 3609 return finishConstructorReference(visit(expression), | 3605 return finishConstructorReference(visit(expression), |
| 3610 expression, expression); | 3606 expression, expression); |
| 3611 } | 3607 } |
| 3612 } | 3608 } |
| OLD | NEW |