| 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 library dart2js.typechecker; | 5 library dart2js.typechecker; |
| 6 | 6 |
| 7 import 'common.dart'; | 7 import 'common.dart'; |
| 8 import 'common/names.dart' show | 8 import 'common/names.dart' show |
| 9 Identifiers; | 9 Identifiers; |
| 10 import 'common/resolution.dart' show | 10 import 'common/resolution.dart' show |
| (...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1191 receiverType = thisType; | 1191 receiverType = thisType; |
| 1192 } | 1192 } |
| 1193 DartType constructorType = computeConstructorType(element, receiverType); | 1193 DartType constructorType = computeConstructorType(element, receiverType); |
| 1194 analyzeArguments(node, element, constructorType); | 1194 analyzeArguments(node, element, constructorType); |
| 1195 return const DynamicType(); | 1195 return const DynamicType(); |
| 1196 } | 1196 } |
| 1197 | 1197 |
| 1198 Identifier selector = node.selector.asIdentifier(); | 1198 Identifier selector = node.selector.asIdentifier(); |
| 1199 if (Elements.isClosureSend(node, element)) { | 1199 if (Elements.isClosureSend(node, element)) { |
| 1200 if (element != null) { | 1200 if (element != null) { |
| 1201 // foo() where foo is a local or a parameter. | 1201 if (element.isError) { |
| 1202 return analyzeInvocation(node, createPromotedAccess(element)); | 1202 // foo() where foo is erroneous |
| 1203 return analyzeInvocation(node, const DynamicAccess()); |
| 1204 } else { |
| 1205 assert(invariant(node, element.isLocal, |
| 1206 message: "Unexpected element $element in closure send.")); |
| 1207 // foo() where foo is a local or a parameter. |
| 1208 return analyzeInvocation(node, createPromotedAccess(element)); |
| 1209 } |
| 1203 } else { | 1210 } else { |
| 1204 // exp() where exp is some complex expression like (o) or foo(). | 1211 // exp() where exp is some complex expression like (o) or foo(). |
| 1205 DartType type = analyze(node.selector); | 1212 DartType type = analyze(node.selector); |
| 1206 return analyzeInvocation(node, new TypeAccess(type)); | 1213 return analyzeInvocation(node, new TypeAccess(type)); |
| 1207 } | 1214 } |
| 1208 } else if (Elements.isMalformed(element) && selector == null) { | 1215 } else if (Elements.isMalformed(element) && selector == null) { |
| 1209 // exp() where exp is an erroneous construct like `new Unresolved()`. | 1216 // exp() where exp is an erroneous construct like `new Unresolved()`. |
| 1210 DartType type = analyze(node.selector); | 1217 DartType type = analyze(node.selector); |
| 1211 return analyzeInvocation(node, new TypeAccess(type)); | 1218 return analyzeInvocation(node, new TypeAccess(type)); |
| 1212 } | 1219 } |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1996 | 2003 |
| 1997 visitTypedef(Typedef node) { | 2004 visitTypedef(Typedef node) { |
| 1998 // Do not typecheck [Typedef] nodes. | 2005 // Do not typecheck [Typedef] nodes. |
| 1999 } | 2006 } |
| 2000 | 2007 |
| 2001 visitNode(Node node) { | 2008 visitNode(Node node) { |
| 2002 reporter.internalError(node, | 2009 reporter.internalError(node, |
| 2003 'Unexpected node ${node.getObjectDescription()} in the type checker.'); | 2010 'Unexpected node ${node.getObjectDescription()} in the type checker.'); |
| 2004 } | 2011 } |
| 2005 } | 2012 } |
| OLD | NEW |