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

Side by Side Diff: pkg/compiler/lib/src/kernel/element_map.dart

Issue 2905623002: Extract type inference queries from KernelAstAdapter to KernelToTypeInferenceMap (Closed)
Patch Set: Created 3 years, 7 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'package:kernel/ast.dart' as ir; 5 import 'package:kernel/ast.dart' as ir;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/names.dart'; 8 import '../common/names.dart';
9 import '../constants/constructors.dart'; 9 import '../constants/constructors.dart';
10 import '../constants/expressions.dart'; 10 import '../constants/expressions.dart';
11 import '../constants/values.dart'; 11 import '../constants/values.dart';
12 import '../common_elements.dart'; 12 import '../common_elements.dart';
13 import '../elements/entities.dart'; 13 import '../elements/entities.dart';
14 import '../elements/names.dart'; 14 import '../elements/names.dart';
15 import '../elements/operators.dart'; 15 import '../elements/operators.dart';
16 import '../elements/types.dart'; 16 import '../elements/types.dart';
17 import '../js_backend/backend.dart' show JavaScriptBackend; 17 import '../js_backend/backend.dart' show JavaScriptBackend;
18 import '../native/native.dart' as native; 18 import '../native/native.dart' as native;
19 import '../types/types.dart';
19 import '../universe/call_structure.dart'; 20 import '../universe/call_structure.dart';
20 import '../universe/selector.dart'; 21 import '../universe/selector.dart';
22 import '../world.dart';
21 import 'kernel_debug.dart'; 23 import 'kernel_debug.dart';
22 24
23 /// Interface that translates between Kernel IR nodes and entities. 25 /// Interface that translates between Kernel IR nodes and entities.
24 abstract class KernelToElementMap { 26 abstract class KernelToElementMap {
25 /// Access to the commonly used elements and types. 27 /// Access to the commonly used elements and types.
26 CommonElements get commonElements; 28 CommonElements get commonElements;
27 29
28 /// [ElementEnvironment] for library, class and member lookup. 30 /// [ElementEnvironment] for library, class and member lookup.
29 ElementEnvironment get elementEnvironment; 31 ElementEnvironment get elementEnvironment;
30 32
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 } 873 }
872 if (isRedirecting) { 874 if (isRedirecting) {
873 return new RedirectingGenerativeConstantConstructor( 875 return new RedirectingGenerativeConstantConstructor(
874 defaultValues, superConstructorInvocation); 876 defaultValues, superConstructorInvocation);
875 } else { 877 } else {
876 return new GenerativeConstantConstructor( 878 return new GenerativeConstantConstructor(
877 type, defaultValues, fieldMap, superConstructorInvocation); 879 type, defaultValues, fieldMap, superConstructorInvocation);
878 } 880 }
879 } 881 }
880 } 882 }
883
884 /// Interface for type inference results for kernel IR nodes.
885 abstract class KernelToTypeInferenceMap {
886 /// Returns the inferred return type of [function].
887 TypeMask getReturnTypeOf(FunctionEntity function);
888
889 /// Returns the inferred receiver type of the dynamic [invocation].
890 TypeMask typeOfInvocation(
891 ir.MethodInvocation invocation, ClosedWorld closedWorld);
892
893 /// Returns the inferred receiver type of the dynamic [read].
894 TypeMask typeOfGet(ir.PropertyGet read);
895
896 /// Returns the inferred receiver type of the dynamic [write].
897 TypeMask typeOfSet(ir.PropertySet write, ClosedWorld closedWorld);
898
899 /// Returns the inferred type of [listLiteral].
900 TypeMask typeOfListLiteral(
901 MemberEntity owner, ir.ListLiteral listLiteral, ClosedWorld closedWorld);
902
903 /// Returns the inferred type of iterator in [forInStatement].
904 TypeMask typeOfIterator(ir.ForInStatement forInStatement);
905
906 /// Returns the inferred type of `current` in [forInStatement].
907 TypeMask typeOfIteratorCurrent(ir.ForInStatement forInStatement);
908
909 /// Returns the inferred type of `moveNext` in [forInStatement].
910 TypeMask typeOfIteratorMoveNext(ir.ForInStatement forInStatement);
911
912 /// Returns `true` if [forInStatement] is inferred to be a JavaScript
913 /// indexable iterator.
914 bool isJsIndexableIterator(
915 ir.ForInStatement forInStatement, ClosedWorld closedWorld);
916
917 /// Returns the inferred index type of [forInStatement].
918 TypeMask inferredIndexType(ir.ForInStatement forInStatement);
919
920 /// Returns the inferred type of [member].
921 TypeMask getInferredTypeOf(MemberEntity member);
922
923 /// Returns the inferred type of a dynamic [selector] access on a receiver of
924 /// type [mask].
925 TypeMask selectorTypeOf(Selector selector, TypeMask mask);
926
927 /// Returns the returned type annotation in the [nativeBehavior].
928 TypeMask typeFromNativeBehavior(
929 native.NativeBehavior nativeBehavior, ClosedWorld closedWorld);
930 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698