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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/inferrer/inferrer_visitor.dart

Issue 116443002: Revert "Implement tracing for function expressions and statements, and infer types of parameters of… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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 | Annotate | Revision Log
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 '../dart2jslib.dart' hide Selector, TypedSelector; 7 import '../dart2jslib.dart' hide Selector, TypedSelector;
8 import '../dart_types.dart'; 8 import '../dart_types.dart';
9 import '../elements/elements.dart'; 9 import '../elements/elements.dart';
10 import '../tree/tree.dart'; 10 import '../tree/tree.dart';
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 bool isNull(T type); 42 bool isNull(T type);
43 Selector newTypedSelector(T receiver, Selector selector); 43 Selector newTypedSelector(T receiver, Selector selector);
44 44
45 T allocateList(T type, 45 T allocateList(T type,
46 Node node, 46 Node node,
47 Element enclosing, 47 Element enclosing,
48 [T elementType, int length]); 48 [T elementType, int length]);
49 49
50 T allocateMap(T keyType, T valueType, T type); 50 T allocateMap(T keyType, T valueType, T type);
51 51
52 T allocateClosure(Node node, Element element);
53
54 /** 52 /**
55 * Returns the least upper bound between [firstType] and 53 * Returns the least upper bound between [firstType] and
56 * [secondType]. 54 * [secondType].
57 */ 55 */
58 T computeLUB(T firstType, T secondType); 56 T computeLUB(T firstType, T secondType);
59 57
60 /** 58 /**
61 * Returns the intersection between [T] and [annotation]. 59 * Returns the intersection between [T] and [annotation].
62 * [isNullable] indicates whether the annotation implies a null 60 * [isNullable] indicates whether the annotation implies a null
63 * type. 61 * type.
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 } 264 }
267 265
268 void forEach(void f(T type)) { 266 void forEach(void f(T type)) {
269 positional.forEach(f); 267 positional.forEach(f);
270 named.values.forEach(f); 268 named.values.forEach(f);
271 } 269 }
272 270
273 bool every(bool f(T type)) { 271 bool every(bool f(T type)) {
274 return positional.every(f) && named.values.every(f); 272 return positional.every(f) && named.values.every(f);
275 } 273 }
276
277 bool contains(T type) {
278 return positional.contains(type) || named.containsValue(type);
279 }
280 } 274 }
281 275
282 abstract class MinimalInferrerEngine<T> { 276 abstract class MinimalInferrerEngine<T> {
283 /** 277 /**
284 * Returns the type of [element]. 278 * Returns the type of [element].
285 */ 279 */
286 T typeOfElement(Element element); 280 T typeOfElement(Element element);
287 281
288 /** 282 /**
289 * Records that [node] sets non-final field [element] to be of type 283 * Records that [node] sets non-final field [element] to be of type
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 if (_superType != null) return _superType; 727 if (_superType != null) return _superType;
734 return _superType = types.nonNullExact( 728 return _superType = types.nonNullExact(
735 outermostElement.getEnclosingClass().superclass); 729 outermostElement.getEnclosingClass().superclass);
736 } 730 }
737 731
738 T visitIdentifier(Identifier node) { 732 T visitIdentifier(Identifier node) {
739 if (node.isThis()) { 733 if (node.isThis()) {
740 return thisType; 734 return thisType;
741 } else if (node.isSuper()) { 735 } else if (node.isSuper()) {
742 return superType; 736 return superType;
743 } else {
744 Element element = elements[node];
745 if (Elements.isLocal(element)) {
746 return locals.use(element);
747 }
748 } 737 }
749 } 738 }
750 739
751 void potentiallyAddIsCheck(Send node) { 740 void potentiallyAddIsCheck(Send node) {
752 if (!accumulateIsChecks) return; 741 if (!accumulateIsChecks) return;
753 if (!Elements.isLocal(elements[node.receiver])) return; 742 if (!Elements.isLocal(elements[node.receiver])) return;
754 isChecks.add(node); 743 isChecks.add(node);
755 } 744 }
756 745
757 void potentiallyAddNullCheck(Send node, Node receiver) { 746 void potentiallyAddNullCheck(Send node, Node receiver) {
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 return type; 1154 return type;
1166 } 1155 }
1167 1156
1168 T visitCascade(Cascade node) { 1157 T visitCascade(Cascade node) {
1169 // Ignore the result of the cascade send and return the type of the cascade 1158 // Ignore the result of the cascade send and return the type of the cascade
1170 // receiver. 1159 // receiver.
1171 visit(node.expression); 1160 visit(node.expression);
1172 return cascadeReceiverStack.removeLast(); 1161 return cascadeReceiverStack.removeLast();
1173 } 1162 }
1174 } 1163 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698