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

Unified Diff: sdk/lib/_internal/compiler/implementation/types/inferrer_visitor.dart

Issue 22881003: Implement visitCascade/visitCascadeReceiver in inferrer_visitor.dart (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/compiler/dart2js/simple_inferrer_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/types/inferrer_visitor.dart
diff --git a/sdk/lib/_internal/compiler/implementation/types/inferrer_visitor.dart b/sdk/lib/_internal/compiler/implementation/types/inferrer_visitor.dart
index 747f072c758dc4b111d3fb68ac8f8195e2b3e6a0..d30d74e22652b67b35b8ebaf98323aee842c9263 100644
--- a/sdk/lib/_internal/compiler/implementation/types/inferrer_visitor.dart
+++ b/sdk/lib/_internal/compiler/implementation/types/inferrer_visitor.dart
@@ -462,6 +462,7 @@ abstract class InferrerVisitor<T> extends ResolvedVisitor<T> {
final Map<TargetElement, List<LocalsHandler>> continuesFor =
new Map<TargetElement, List<LocalsHandler<T>>>();
LocalsHandler<T> locals;
+ final List<T> cascadeReceiverStack = new List<T>();
bool accumulateIsChecks = false;
bool conditionIsSimple = false;
@@ -995,14 +996,15 @@ abstract class InferrerVisitor<T> extends ResolvedVisitor<T> {
}
T visitCascadeReceiver(CascadeReceiver node) {
- // TODO(ngeoffray): Implement.
- node.visitChildren(this);
- return types.dynamicType;
+ var type = visit(node.expression);
+ cascadeReceiverStack.add(type);
+ return type;
}
T visitCascade(Cascade node) {
- // TODO(ngeoffray): Implement.
- node.visitChildren(this);
- return types.dynamicType;
+ // Ignore the result of the cascade send and return the type of the cascade
+ // receiver.
+ visit(node.expression);
+ return cascadeReceiverStack.removeLast();
}
}
« no previous file with comments | « no previous file | tests/compiler/dart2js/simple_inferrer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698