Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(525)

Side by Side Diff: pkg/kernel/lib/type_checker.dart

Issue 2778223002: Add primitive to create closures and use it for closure conversion (Closed)
Patch Set: Fix bug: put parameters with no initalizers into contexts correctly Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 visitVectorCreation(VectorCreation node) {
694 return const VectorType();
695 }
696
697 @override
693 DartType visitVectorGet(VectorGet node) { 698 DartType visitVectorGet(VectorGet node) {
694 var type = visitExpression(node.vectorExpression); 699 var type = visitExpression(node.vectorExpression);
695 if (type is! VectorType) { 700 if (type is! VectorType) {
696 fail( 701 fail(
697 node.vectorExpression, 702 node.vectorExpression,
698 'The type of vector-expression in vector-get node is expected to be ' 703 'The type of vector-expression in vector-get node is expected to be '
699 'VectorType, but $type found'); 704 'VectorType, but $type found');
700 } 705 }
701 return const DynamicType(); 706 return const DynamicType();
702 } 707 }
(...skipping 16 matching lines...) Expand all
719 if (type is! VectorType) { 724 if (type is! VectorType) {
720 fail( 725 fail(
721 node.vectorExpression, 726 node.vectorExpression,
722 'The type of vector-expression in vector-copy node is exected to be ' 727 'The type of vector-expression in vector-copy node is exected to be '
723 'VectorType, but $type found'); 728 'VectorType, but $type found');
724 } 729 }
725 return const VectorType(); 730 return const VectorType();
726 } 731 }
727 732
728 @override 733 @override
729 DartType visitVectorCreation(VectorCreation node) { 734 visitClosureCreation(ClosureCreation node) {
730 return const VectorType(); 735 var contextType = visitExpression(node.contextVector);
736 if (contextType is! VectorType) {
737 fail(
738 node.contextVector,
739 "The second child of 'ClosureConversion' node is supposed to be a "
740 "Vector, but $contextType found.");
741 }
742 return node.functionType;
731 } 743 }
732 744
733 @override 745 @override
734 visitAssertStatement(AssertStatement node) { 746 visitAssertStatement(AssertStatement node) {
735 visitExpression(node.condition); 747 visitExpression(node.condition);
736 if (node.message != null) { 748 if (node.message != null) {
737 visitExpression(node.message); 749 visitExpression(node.message);
738 } 750 }
739 } 751 }
740 752
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 } 955 }
944 956
945 @override 957 @override
946 visitLocalInitializer(LocalInitializer node) { 958 visitLocalInitializer(LocalInitializer node) {
947 visitVariableDeclaration(node.variable); 959 visitVariableDeclaration(node.variable);
948 } 960 }
949 961
950 @override 962 @override
951 visitInvalidInitializer(InvalidInitializer node) {} 963 visitInvalidInitializer(InvalidInitializer node) {}
952 } 964 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698