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

Side by Side Diff: pkg/compiler/lib/src/inferrer/inferrer_visitor.dart

Issue 2363773005: Move closed world reasoning methods from ClassWorld to ClosedWorld. (Closed)
Patch Set: Created 4 years, 2 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library inferrer_visitor; 5 library inferrer_visitor;
6 6
7 import 'dart:collection' show IterableMixin; 7 import 'dart:collection' show IterableMixin;
8 8
9 import '../common.dart'; 9 import '../common.dart';
10 import '../compiler.dart' show Compiler; 10 import '../compiler.dart' show Compiler;
11 import '../constants/constant_system.dart'; 11 import '../constants/constant_system.dart';
12 import '../constants/expressions.dart'; 12 import '../constants/expressions.dart';
13 import '../dart_types.dart'; 13 import '../dart_types.dart';
14 import '../elements/elements.dart'; 14 import '../elements/elements.dart';
15 import '../resolution/operators.dart'; 15 import '../resolution/operators.dart';
16 import '../resolution/semantic_visitor.dart'; 16 import '../resolution/semantic_visitor.dart';
17 import '../resolution/tree_elements.dart' show TreeElements; 17 import '../resolution/tree_elements.dart' show TreeElements;
18 import '../tree/tree.dart'; 18 import '../tree/tree.dart';
19 import '../types/constants.dart' show computeTypeMask; 19 import '../types/constants.dart' show computeTypeMask;
20 import '../types/types.dart' show TypeMask; 20 import '../types/types.dart' show TypeMask;
21 import '../universe/call_structure.dart' show CallStructure; 21 import '../universe/call_structure.dart' show CallStructure;
22 import '../universe/selector.dart' show Selector; 22 import '../universe/selector.dart' show Selector;
23 import '../util/util.dart'; 23 import '../util/util.dart';
24 import '../world.dart' show ClassWorld; 24 import '../world.dart' show ClosedWorld;
25 25
26 /** 26 /**
27 * The interface [InferrerVisitor] will use when working on types. 27 * The interface [InferrerVisitor] will use when working on types.
28 */ 28 */
29 abstract class TypeSystem<T> { 29 abstract class TypeSystem<T> {
30 T get dynamicType; 30 T get dynamicType;
31 T get nullType; 31 T get nullType;
32 T get intType; 32 T get intType;
33 T get uint31Type; 33 T get uint31Type;
34 T get uint32Type; 34 T get uint32Type;
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 bool isThisOrSuper(Node node) => node.isThis() || node.isSuper(); 943 bool isThisOrSuper(Node node) => node.isThis() || node.isSuper();
944 944
945 Element get outermostElement { 945 Element get outermostElement {
946 return analyzedElement.outermostEnclosingMemberOrTopLevel.implementation; 946 return analyzedElement.outermostEnclosingMemberOrTopLevel.implementation;
947 } 947 }
948 948
949 T _thisType; 949 T _thisType;
950 T get thisType { 950 T get thisType {
951 if (_thisType != null) return _thisType; 951 if (_thisType != null) return _thisType;
952 ClassElement cls = outermostElement.enclosingClass; 952 ClassElement cls = outermostElement.enclosingClass;
953 ClassWorld classWorld = compiler.closedWorld; 953 ClosedWorld closedWorld = compiler.closedWorld;
954 if (classWorld.isUsedAsMixin(cls)) { 954 if (closedWorld.isUsedAsMixin(cls)) {
955 return _thisType = types.nonNullSubtype(cls); 955 return _thisType = types.nonNullSubtype(cls);
956 } else { 956 } else {
957 return _thisType = types.nonNullSubclass(cls); 957 return _thisType = types.nonNullSubclass(cls);
958 } 958 }
959 } 959 }
960 960
961 T _superType; 961 T _superType;
962 T get superType { 962 T get superType {
963 if (_superType != null) return _superType; 963 if (_superType != null) return _superType;
964 return _superType = 964 return _superType =
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 return type; 1484 return type;
1485 } 1485 }
1486 1486
1487 T visitCascade(Cascade node) { 1487 T visitCascade(Cascade node) {
1488 // Ignore the result of the cascade send and return the type of the cascade 1488 // Ignore the result of the cascade send and return the type of the cascade
1489 // receiver. 1489 // receiver.
1490 visit(node.expression); 1490 visit(node.expression);
1491 return cascadeReceiverStack.removeLast(); 1491 return cascadeReceiverStack.removeLast();
1492 } 1492 }
1493 } 1493 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart » ('j') | pkg/compiler/lib/src/world.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698