| 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 static final bool LOG_FAILURES = false; | 9 static final bool LOG_FAILURES = false; |
| 10 | 10 |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 | 399 |
| 400 } else { | 400 } else { |
| 401 Link<Type> argumentTypes = analyzeArguments(node.arguments); | 401 Link<Type> argumentTypes = analyzeArguments(node.arguments); |
| 402 FunctionType funType; | 402 FunctionType funType; |
| 403 if (node.receiver !== null) { | 403 if (node.receiver !== null) { |
| 404 Type receiverType = analyze(node.receiver); | 404 Type receiverType = analyze(node.receiver); |
| 405 if (receiverType === types.dynamicType) return types.dynamicType; | 405 if (receiverType === types.dynamicType) return types.dynamicType; |
| 406 if (receiverType === null) { | 406 if (receiverType === null) { |
| 407 fail(node.receiver, 'receivertype is null'); | 407 fail(node.receiver, 'receivertype is null'); |
| 408 } | 408 } |
| 409 if (receiverType.element.kind !== ElementKind.CLASS) { |
| 410 fail(node.receiver, 'receivertype is not a class'); |
| 411 } |
| 409 ClassElement classElement = receiverType.element; | 412 ClassElement classElement = receiverType.element; |
| 410 // TODO(karlklose): substitute type arguments. | 413 // TODO(karlklose): substitute type arguments. |
| 411 Type memberType = lookupMethodType(node, classElement, selector.source); | 414 Type memberType = lookupMethodType(node, classElement, selector.source); |
| 412 if (memberType === types.dynamicType) return types.dynamicType; | 415 if (memberType === types.dynamicType) return types.dynamicType; |
| 413 if (memberType is !FunctionType) { | 416 if (memberType is !FunctionType) { |
| 414 fail(node, 'can only handle function types'); | 417 fail(node, 'can only handle function types'); |
| 415 } | 418 } |
| 416 funType = memberType; | 419 funType = memberType; |
| 417 } else { | 420 } else { |
| 418 Element element = elements[node]; | 421 Element element = elements[node]; |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 } | 678 } |
| 676 | 679 |
| 677 visitCatchBlock(CatchBlock node) { | 680 visitCatchBlock(CatchBlock node) { |
| 678 fail(node); | 681 fail(node); |
| 679 } | 682 } |
| 680 | 683 |
| 681 visitTypedef(Typedef node) { | 684 visitTypedef(Typedef node) { |
| 682 fail(node); | 685 fail(node); |
| 683 } | 686 } |
| 684 } | 687 } |
| OLD | NEW |