| 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 class TypeCheckerTask extends CompilerTask { | 5 class TypeCheckerTask extends CompilerTask { |
| 6 TypeCheckerTask(Compiler compiler) : super(compiler); | 6 TypeCheckerTask(Compiler compiler) : super(compiler); |
| 7 String get name() => "Type checker"; | 7 String get name() => "Type checker"; |
| 8 | 8 |
| 9 void check(Node tree, TreeElements elements) { | 9 void check(Node tree, TreeElements elements) { |
| 10 measure(() { | 10 measure(() { |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 ClassElement classElement = receiverType.element; | 368 ClassElement classElement = receiverType.element; |
| 369 // TODO(karlklose): substitute type arguments. | 369 // TODO(karlklose): substitute type arguments. |
| 370 Type memberType = lookupMethodType(node, classElement, selector.source); | 370 Type memberType = lookupMethodType(node, classElement, selector.source); |
| 371 if (memberType === types.dynamicType) return types.dynamicType; | 371 if (memberType === types.dynamicType) return types.dynamicType; |
| 372 if (memberType is !FunctionType) { | 372 if (memberType is !FunctionType) { |
| 373 fail(node, 'can only handle function types'); | 373 fail(node, 'can only handle function types'); |
| 374 } | 374 } |
| 375 funType = memberType; | 375 funType = memberType; |
| 376 } else { | 376 } else { |
| 377 Element element = elements[node]; | 377 Element element = elements[node]; |
| 378 if (element.kind === ElementKind.FUNCTION) { | 378 if (element === null) { |
| 379 fail(node, 'unresolved ${node.selector}'); |
| 380 } else if (element.kind === ElementKind.FUNCTION) { |
| 379 funType = computeType(element); | 381 funType = computeType(element); |
| 380 } else if (element.kind === ElementKind.FOREIGN) { | 382 } else if (element.kind === ElementKind.FOREIGN) { |
| 381 return types.dynamicType; | 383 return types.dynamicType; |
| 382 } else { | 384 } else { |
| 383 fail(node, 'unexpected element kind ${element.kind}'); | 385 fail(node, 'unexpected element kind ${element.kind}'); |
| 384 } | 386 } |
| 385 } | 387 } |
| 386 Link<Type> parameterTypes = funType.parameterTypes; | 388 Link<Type> parameterTypes = funType.parameterTypes; |
| 387 Link<Node> argumentNodes = node.arguments; | 389 Link<Node> argumentNodes = node.arguments; |
| 388 while (!argumentTypes.isEmpty() && !parameterTypes.isEmpty()) { | 390 while (!argumentTypes.isEmpty() && !parameterTypes.isEmpty()) { |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 } | 627 } |
| 626 | 628 |
| 627 visitCatchBlock(CatchBlock node) { | 629 visitCatchBlock(CatchBlock node) { |
| 628 compiler.unimplemented('visitCatchBlock', node: node); | 630 compiler.unimplemented('visitCatchBlock', node: node); |
| 629 } | 631 } |
| 630 | 632 |
| 631 visitTypedef(Typedef node) { | 633 visitTypedef(Typedef node) { |
| 632 compiler.unimplemented('visitTypedef', node: node); | 634 compiler.unimplemented('visitTypedef', node: node); |
| 633 } | 635 } |
| 634 } | 636 } |
| OLD | NEW |