Skip to content

Commit da3149d

Browse files
committed
taking into account DeclContext's kind for initialization.
If DeclContext's kind is TopLevelCodeDecl we are sure to be visiting a BraceStmt that opens a TopLevelDecl.
1 parent ab513c8 commit da3149d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/Sema/TypeCheckStmt.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,12 @@ class StmtChecker : public StmtVisitor<StmtChecker, Stmt*> {
364364

365365
StmtChecker(TypeChecker &TC, DeclContext *DC)
366366
: TC(TC), TheFunc(), DC(DC), IsREPL(false),
367-
IsBraceStmtFromTopLevelDecl(true) {
367+
IsBraceStmtFromTopLevelDecl(false) {
368368
if (const SourceFile *SF = DC->getParentSourceFile())
369369
if (SF->Kind == SourceFileKind::REPL)
370370
IsREPL = true;
371+
372+
IsBraceStmtFromTopLevelDecl = isa<TopLevelCodeDecl>(DC);
371373
}
372374

373375
//===--------------------------------------------------------------------===//

0 commit comments

Comments
 (0)