| 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 const bool LOG_FAILURES = false; | 9 static const bool LOG_FAILURES = false; |
| 10 | 10 |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 if (receiverKind !== ElementKind.CLASS) { | 566 if (receiverKind !== ElementKind.CLASS) { |
| 567 fail(node.receiver, 'unexpected receiver kind: ${receiverKind}'); | 567 fail(node.receiver, 'unexpected receiver kind: ${receiverKind}'); |
| 568 } | 568 } |
| 569 ClassElement classElement = receiverType.element; | 569 ClassElement classElement = receiverType.element; |
| 570 // TODO(karlklose): substitute type arguments. | 570 // TODO(karlklose): substitute type arguments. |
| 571 DartType memberType = | 571 DartType memberType = |
| 572 lookupMethodType(selector, classElement, selector.source); | 572 lookupMethodType(selector, classElement, selector.source); |
| 573 if (memberType.element === compiler.dynamicClass) return null; | 573 if (memberType.element === compiler.dynamicClass) return null; |
| 574 return memberType; | 574 return memberType; |
| 575 } else { | 575 } else { |
| 576 if (element === null) { | 576 if (Element.isInvalid(element)) { |
| 577 fail(node, 'unresolved ${node.selector}'); | 577 fail(node, 'unresolved ${node.selector}'); |
| 578 } else if (element.kind === ElementKind.FUNCTION) { | 578 } else if (element.kind === ElementKind.FUNCTION) { |
| 579 return computeType(element); | 579 return computeType(element); |
| 580 } else if (element.kind === ElementKind.FOREIGN) { | 580 } else if (element.kind === ElementKind.FOREIGN) { |
| 581 return null; | 581 return null; |
| 582 } else if (element.kind === ElementKind.VARIABLE | 582 } else if (element.kind === ElementKind.VARIABLE |
| 583 || element.kind === ElementKind.FIELD) { | 583 || element.kind === ElementKind.FIELD) { |
| 584 // TODO(karlklose): handle object invocations. | 584 // TODO(karlklose): handle object invocations. |
| 585 return null; | 585 return null; |
| 586 } else { | 586 } else { |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 } | 844 } |
| 845 | 845 |
| 846 visitCatchBlock(CatchBlock node) { | 846 visitCatchBlock(CatchBlock node) { |
| 847 return unhandledStatement(); | 847 return unhandledStatement(); |
| 848 } | 848 } |
| 849 | 849 |
| 850 visitTypedef(Typedef node) { | 850 visitTypedef(Typedef node) { |
| 851 return unhandledStatement(); | 851 return unhandledStatement(); |
| 852 } | 852 } |
| 853 } | 853 } |
| OLD | NEW |