| Index: lib/compiler/implementation/typechecker.dart
|
| diff --git a/lib/compiler/implementation/typechecker.dart b/lib/compiler/implementation/typechecker.dart
|
| index 11ba1ee98ed0a6b5b955afa72898735a494c67ed..7d63fc041e0dd173418a56e7d32443f1eb52da5b 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);
|
| }
|
|
|