Sema: Remove DeclChecker::IsSecondPass

The DeclChecker had three possible states:

- IsFirstPass true, IsSecondPass false. This is the 'first pass' for
  declarations that appear at the top-level, or are nested inside
  top-level types.

- IsFirstPass false, IsSecondPass true. This is the 'second pass' for
  declarations that appear at the top-level, or are nested inside
  top-level types.

- IsFirstPass false, IsSecondPass false. This was used for (some)
  local declarations.

This is unnecessarily confusing. We can eliminate the third state
by calling typeCheckDecl() twice in a few places. This allows
IsSecondPass to be removed entirely since it's now always equal to
!IsFirstPass.
This commit is contained in:
Slava Pestov
2018-03-21 14:39:28 -07:00
parent 2bed632a95
commit f9f5ebbba9
4 changed files with 23 additions and 23 deletions

View File

@@ -1975,7 +1975,7 @@ ConstructorDecl *swift::createImplicitConstructor(TypeChecker &tc,
}
// Type-check the constructor declaration.
tc.typeCheckDecl(ctor, /*isFirstPass=*/true);
tc.validateDecl(ctor);
return ctor;
}