Index: lib/compiler/implementation/typechecker.dart |
diff --git a/lib/compiler/implementation/typechecker.dart b/lib/compiler/implementation/typechecker.dart |
index a579b1172d3093ddbdf17af6096b78c53350f5e6..6f3dacc53efd2b0cb66bd92c10d575c63b3a8a22 100644 |
--- a/lib/compiler/implementation/typechecker.dart |
+++ b/lib/compiler/implementation/typechecker.dart |
@@ -178,6 +178,8 @@ class TypeCheckerVisitor implements Visitor<Type> { |
Type expectedReturnType; |
ClassElement currentClass; |
+ Link<Type> cascadeTypes = const EmptyLink<Type>(); |
+ |
Type intType; |
Type doubleType; |
Type boolType; |
@@ -252,10 +254,31 @@ class TypeCheckerVisitor implements Visitor<Type> { |
checkAssignable(condition, boolType, analyze(condition)); |
} |
+ void pushCascadeType(Type type) { |
+ cascadeTypes = cascadeTypes.prepend(type); |
+ } |
+ |
+ void popCascadeType() { |
+ Type type = cascadeTypes.head; |
+ cascadeTypes = cascadeTypes.tail; |
+ return type; |
+ } |
+ |
Type visitBlock(Block node) { |
return analyze(node.statements); |
} |
+ Type visitCascade(Cascade node) { |
+ analyze(node.expression); |
+ return popCascadeType(); |
+ } |
+ |
+ Type visitCascadeReceiver(CascadeReceiver node) { |
+ Type type = analyze(node.expression); |
+ pushCascadeType(type); |
+ return type; |
+ } |
+ |
Type visitClassNode(ClassNode node) { |
fail(node); |
} |