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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 } else if (name === '||' || name === '&&' || name === '!') { | 598 } else if (name === '||' || name === '&&' || name === '!') { |
599 checkAssignable(firstArgument, boolType, firstArgumentType); | 599 checkAssignable(firstArgument, boolType, firstArgumentType); |
600 if (!arguments.isEmpty()) { | 600 if (!arguments.isEmpty()) { |
601 // TODO(karlklose): check number of arguments in validator. | 601 // TODO(karlklose): check number of arguments in validator. |
602 checkAssignable(secondArgument, boolType, secondArgumentType); | 602 checkAssignable(secondArgument, boolType, secondArgumentType); |
603 } | 603 } |
604 return boolType; | 604 return boolType; |
605 } | 605 } |
606 fail(selector, 'unexpected operator ${name}'); | 606 fail(selector, 'unexpected operator ${name}'); |
607 | 607 |
608 } else if (node.isPropertyAccess) { | 608 } else if (node.isPropertyAccessOrTypeReference) { |
609 if (node.receiver !== null) { | 609 if (node.receiver !== null) { |
610 // TODO(karlklose): we cannot handle fields. | 610 // TODO(karlklose): we cannot handle fields. |
611 return unhandledExpression(); | 611 return unhandledExpression(); |
612 } | 612 } |
613 if (element === null) return types.dynamicType; | 613 if (element === null) return types.dynamicType; |
614 return computeType(element); | 614 return computeType(element); |
615 | 615 |
616 } else if (node.isFunctionObjectInvocation) { | 616 } else if (node.isFunctionObjectInvocation) { |
617 fail(node.receiver, 'function object invocation unimplemented'); | 617 fail(node.receiver, 'function object invocation unimplemented'); |
618 | 618 |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 } | 918 } |
919 | 919 |
920 visitCatchBlock(CatchBlock node) { | 920 visitCatchBlock(CatchBlock node) { |
921 return unhandledStatement(); | 921 return unhandledStatement(); |
922 } | 922 } |
923 | 923 |
924 visitTypedef(Typedef node) { | 924 visitTypedef(Typedef node) { |
925 return unhandledStatement(); | 925 return unhandledStatement(); |
926 } | 926 } |
927 } | 927 } |
OLD | NEW |