OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library kernel.type_checker; | 4 library kernel.type_checker; |
5 | 5 |
6 import 'ast.dart'; | 6 import 'ast.dart'; |
7 import 'class_hierarchy.dart'; | 7 import 'class_hierarchy.dart'; |
8 import 'core_types.dart'; | 8 import 'core_types.dart'; |
9 import 'type_algebra.dart'; | 9 import 'type_algebra.dart'; |
10 import 'type_environment.dart'; | 10 import 'type_environment.dart'; |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 DartType visitLoadLibrary(LoadLibrary node) { | 683 DartType visitLoadLibrary(LoadLibrary node) { |
684 return environment.futureType(const DynamicType()); | 684 return environment.futureType(const DynamicType()); |
685 } | 685 } |
686 | 686 |
687 @override | 687 @override |
688 DartType visitCheckLibraryIsLoaded(CheckLibraryIsLoaded node) { | 688 DartType visitCheckLibraryIsLoaded(CheckLibraryIsLoaded node) { |
689 return environment.objectType; | 689 return environment.objectType; |
690 } | 690 } |
691 | 691 |
692 @override | 692 @override |
| 693 DartType visitVectorGet(VectorGet node) { |
| 694 var type = visitExpression(node.vectorExpression); |
| 695 if (type is! VectorType) { |
| 696 fail( |
| 697 node.vectorExpression, |
| 698 'The type of vector-expression in vector-get node is expected to be ' |
| 699 'VectorType, but $type found'); |
| 700 } |
| 701 return const DynamicType(); |
| 702 } |
| 703 |
| 704 @override |
| 705 visitVectorSet(VectorSet node) { |
| 706 var type = visitExpression(node.vectorExpression); |
| 707 if (type is! VectorType) { |
| 708 fail( |
| 709 node.vectorExpression, |
| 710 'The type of vector-expression in vector-set node is expected to be ' |
| 711 'VectorType, but $type found'); |
| 712 } |
| 713 return visitExpression(node.value); |
| 714 } |
| 715 |
| 716 @override |
| 717 visitVectorCopy(VectorCopy node) { |
| 718 var type = visitExpression(node.vectorExpression); |
| 719 if (type is! VectorType) { |
| 720 fail( |
| 721 node.vectorExpression, |
| 722 'The type of vector-expression in vector-copy node is exected to be ' |
| 723 'VectorType, but $type found'); |
| 724 } |
| 725 return const VectorType(); |
| 726 } |
| 727 |
| 728 @override |
| 729 DartType visitVectorCreation(VectorCreation node) { |
| 730 return const VectorType(); |
| 731 } |
| 732 |
| 733 @override |
693 visitAssertStatement(AssertStatement node) { | 734 visitAssertStatement(AssertStatement node) { |
694 visitExpression(node.condition); | 735 visitExpression(node.condition); |
695 if (node.message != null) { | 736 if (node.message != null) { |
696 visitExpression(node.message); | 737 visitExpression(node.message); |
697 } | 738 } |
698 } | 739 } |
699 | 740 |
700 @override | 741 @override |
701 visitBlock(Block node) { | 742 visitBlock(Block node) { |
702 node.statements.forEach(visitStatement); | 743 node.statements.forEach(visitStatement); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 } | 943 } |
903 | 944 |
904 @override | 945 @override |
905 visitLocalInitializer(LocalInitializer node) { | 946 visitLocalInitializer(LocalInitializer node) { |
906 visitVariableDeclaration(node.variable); | 947 visitVariableDeclaration(node.variable); |
907 } | 948 } |
908 | 949 |
909 @override | 950 @override |
910 visitInvalidInitializer(InvalidInitializer node) {} | 951 visitInvalidInitializer(InvalidInitializer node) {} |
911 } | 952 } |
OLD | NEW |