@@ -2918,11 +2918,11 @@ void swift::performAbstractFuncDeclDiagnostics(TypeChecker &TC,
2918
2918
}
2919
2919
2920
2920
// Perform MiscDiagnostics on Switch Statements.
2921
- static void checkSwitch (TypeChecker &TC , const SwitchStmt *stmt) {
2921
+ static void checkSwitch (ASTContext &ctx , const SwitchStmt *stmt) {
2922
2922
// We want to warn about "case .Foo, .Bar where 1 != 100:" since the where
2923
2923
// clause only applies to the second case, and this is surprising.
2924
2924
for (auto cs : stmt->getCases ()) {
2925
- TC. checkUnsupportedProtocolType (cs);
2925
+ TypeChecker:: checkUnsupportedProtocolType (ctx, cs);
2926
2926
2927
2927
// The case statement can have multiple case items, each can have a where.
2928
2928
// If we find a "where", and there is a preceding item without a where, and
@@ -2949,25 +2949,25 @@ static void checkSwitch(TypeChecker &TC, const SwitchStmt *stmt) {
2949
2949
if (prevLoc.isInvalid () || thisLoc.isInvalid ())
2950
2950
continue ;
2951
2951
2952
- auto &SM = TC. Context .SourceMgr ;
2952
+ auto &SM = ctx .SourceMgr ;
2953
2953
auto prevLineCol = SM.getLineAndColumn (prevLoc);
2954
2954
if (SM.getLineNumber (thisLoc) != prevLineCol.first )
2955
2955
continue ;
2956
-
2957
- TC .diagnose (items[i].getWhereLoc (), diag::where_on_one_item)
2956
+
2957
+ ctx. Diags .diagnose (items[i].getWhereLoc (), diag::where_on_one_item)
2958
2958
.highlight (items[i].getPattern ()->getSourceRange ())
2959
2959
.highlight (where->getSourceRange ());
2960
2960
2961
2961
// Whitespace it out to the same column as the previous item.
2962
2962
std::string whitespace (prevLineCol.second -1 , ' ' );
2963
- TC .diagnose (thisLoc, diag::add_where_newline)
2963
+ ctx. Diags .diagnose (thisLoc, diag::add_where_newline)
2964
2964
.fixItInsert (thisLoc, " \n " +whitespace);
2965
2965
2966
2966
auto whereRange = SourceRange (items[i].getWhereLoc (),
2967
2967
where->getEndLoc ());
2968
2968
auto charRange = Lexer::getCharSourceRangeFromSourceRange (SM, whereRange);
2969
2969
auto whereText = SM.extractText (charRange);
2970
- TC .diagnose (prevLoc, diag::duplicate_where)
2970
+ ctx. Diags .diagnose (prevLoc, diag::duplicate_where)
2971
2971
.fixItInsertAfter (items[i-1 ].getEndLoc (), " " + whereText.str ())
2972
2972
.highlight (items[i-1 ].getSourceRange ());
2973
2973
}
@@ -3999,10 +3999,10 @@ void swift::performSyntacticExprDiagnostics(TypeChecker &TC, const Expr *E,
3999
3999
}
4000
4000
4001
4001
void swift::performStmtDiagnostics (TypeChecker &TC, const Stmt *S) {
4002
- TC. checkUnsupportedProtocolType (const_cast <Stmt *>(S));
4002
+ TypeChecker:: checkUnsupportedProtocolType (TC. Context , const_cast <Stmt *>(S));
4003
4003
4004
4004
if (auto switchStmt = dyn_cast<SwitchStmt>(S))
4005
- checkSwitch (TC, switchStmt);
4005
+ checkSwitch (TC. Context , switchStmt);
4006
4006
4007
4007
checkStmtConditionTrailingClosure (TC, S);
4008
4008
0 commit comments