OLD | NEW |
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 '../constants/constant_system.dart'; | 7 import '../constants/constant_system.dart'; |
8 import '../constants/expressions.dart'; | 8 import '../constants/expressions.dart'; |
9 import '../dart2jslib.dart' hide Selector, TypedSelector; | 9 import '../dart2jslib.dart' hide Selector, TypedSelector; |
10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
(...skipping 29 matching lines...) Expand all Loading... |
40 T get stringType; | 40 T get stringType; |
41 T get typeType; | 41 T get typeType; |
42 | 42 |
43 T stringLiteralType(DartString value); | 43 T stringLiteralType(DartString value); |
44 | 44 |
45 T nonNullSubtype(ClassElement type); | 45 T nonNullSubtype(ClassElement type); |
46 T nonNullSubclass(ClassElement type); | 46 T nonNullSubclass(ClassElement type); |
47 T nonNullExact(ClassElement type); | 47 T nonNullExact(ClassElement type); |
48 T nonNullEmpty(); | 48 T nonNullEmpty(); |
49 bool isNull(T type); | 49 bool isNull(T type); |
50 TypeMask newTypedSelector(T receiver, TypeMask mask); | 50 Selector newTypedSelector(T receiver, Selector selector); |
51 | 51 |
52 T allocateList(T type, | 52 T allocateList(T type, |
53 Node node, | 53 Node node, |
54 Element enclosing, | 54 Element enclosing, |
55 [T elementType, int length]); | 55 [T elementType, int length]); |
56 | 56 |
57 T allocateMap(T type, Node node, Element element, [List<T> keyType, | 57 T allocateMap(T type, Node node, Element element, [List<T> keyType, |
58 List<T> valueType]); | 58 List<T> valueType]); |
59 | 59 |
60 T allocateClosure(Node node, Element element); | 60 T allocateClosure(Node node, Element element); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 /** | 104 /** |
105 * Adds [newType] as an input of [phiType]. | 105 * Adds [newType] as an input of [phiType]. |
106 */ | 106 */ |
107 T addPhiInput(Local variable, T phiType, T newType); | 107 T addPhiInput(Local variable, T phiType, T newType); |
108 | 108 |
109 /** | 109 /** |
110 * Returns `true` if `selector` should be updated to reflect the new | 110 * Returns `true` if `selector` should be updated to reflect the new |
111 * `receiverType`. | 111 * `receiverType`. |
112 */ | 112 */ |
113 bool selectorNeedsUpdate(T receiverType, TypeMask mask); | 113 bool selectorNeedsUpdate(T receiverType, Selector selector); |
114 | 114 |
115 /** | 115 /** |
116 * Returns a new receiver type for this [selector] applied to | 116 * Returns a new receiver type for this [selector] applied to |
117 * [receiverType]. | 117 * [receiverType]. |
118 * | 118 * |
119 * The option [isConditional] is true when [selector] was seen in a | 119 * The option [isConditional] is true when [selector] was seen in a |
120 * conditional send (e.g. `a?.selector`), in which case the returned type may | 120 * conditional send (e.g. `a?.selector`), in which case the returned type may |
121 * be null. | 121 * be null. |
122 */ | 122 */ |
123 T refineReceiver(Selector selector, | 123 T refineReceiver(Selector selector, T receiverType, bool isConditional); |
124 TypeMask mask, | |
125 T receiverType, | |
126 bool isConditional); | |
127 | 124 |
128 /** | 125 /** |
129 * Returns the internal inferrer representation for [mask]. | 126 * Returns the internal inferrer representation for [mask]. |
130 */ | 127 */ |
131 T getConcreteTypeFor(TypeMask mask); | 128 T getConcreteTypeFor(TypeMask mask); |
132 } | 129 } |
133 | 130 |
134 /** | 131 /** |
135 * A variable scope holds types for variables. It has a link to a | 132 * A variable scope holds types for variables. It has a link to a |
136 * parent scope, but never changes the types in that parent. Instead, | 133 * parent scope, but never changes the types in that parent. Instead, |
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1443 return type; | 1440 return type; |
1444 } | 1441 } |
1445 | 1442 |
1446 T visitCascade(Cascade node) { | 1443 T visitCascade(Cascade node) { |
1447 // Ignore the result of the cascade send and return the type of the cascade | 1444 // Ignore the result of the cascade send and return the type of the cascade |
1448 // receiver. | 1445 // receiver. |
1449 visit(node.expression); | 1446 visit(node.expression); |
1450 return cascadeReceiverStack.removeLast(); | 1447 return cascadeReceiverStack.removeLast(); |
1451 } | 1448 } |
1452 } | 1449 } |
OLD | NEW |