File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -174,12 +174,12 @@ class ClosureConstraintGenerator
174
174
175
175
void visitBreakStmt (BreakStmt *breakStmt) { }
176
176
void visitContinueStmt (ContinueStmt *continueStmt) { }
177
+ void visitDeferStmt (DeferStmt *deferStmt) { }
177
178
178
179
#define UNSUPPORTED_STMT (STMT ) void visit##STMT##Stmt(STMT##Stmt *) { \
179
180
llvm_unreachable (" Unsupported statement kind " #STMT); \
180
181
}
181
182
UNSUPPORTED_STMT (Yield)
182
- UNSUPPORTED_STMT (Defer)
183
183
UNSUPPORTED_STMT (DoCatch)
184
184
UNSUPPORTED_STMT (Switch)
185
185
UNSUPPORTED_STMT (Case)
@@ -440,11 +440,20 @@ class ClosureConstraintApplication
440
440
return continueStmt;
441
441
}
442
442
443
+ ASTNode visitDeferStmt (DeferStmt *deferStmt) {
444
+ TypeChecker::typeCheckDecl (deferStmt->getTempDecl ());
445
+
446
+ Expr *theCall = deferStmt->getCallExpr ();
447
+ TypeChecker::typeCheckExpression (theCall, closure);
448
+ deferStmt->setCallExpr (theCall);
449
+
450
+ return deferStmt;
451
+ }
452
+
443
453
#define UNSUPPORTED_STMT (STMT ) ASTNode visit##STMT##Stmt(STMT##Stmt *) { \
444
454
llvm_unreachable (" Unsupported statement kind " #STMT); \
445
455
}
446
456
UNSUPPORTED_STMT (Yield)
447
- UNSUPPORTED_STMT(Defer)
448
457
UNSUPPORTED_STMT(DoCatch)
449
458
UNSUPPORTED_STMT(Switch)
450
459
UNSUPPORTED_STMT(Case)
Original file line number Diff line number Diff line change @@ -38,6 +38,10 @@ func mapWithMoreStatements(ints: [Int]) {
38
38
}
39
39
} while random ( i)
40
40
41
+ defer {
42
+ print ( " I am so done here " )
43
+ }
44
+
41
45
for j in 0 ..< i where j % 2 == 0 {
42
46
if j % 7 == 0 {
43
47
continue
You can’t perform that action at this time.
0 commit comments