SourceKit: Introduce a new enum class to describe the kind of resolved sema token kind. NFC (#7657)

This commit is contained in:
Xi Ge
2017-02-20 23:18:54 -08:00
committed by GitHub
parent 86cc11a4c6
commit c62ec0c116
3 changed files with 61 additions and 12 deletions

View File

@@ -91,6 +91,22 @@ bool SemaLocResolver::tryResolve(ModuleEntity Mod, SourceLoc Loc) {
return false;
}
bool SemaLocResolver::tryResolve(Stmt *St) {
if (auto *LST = dyn_cast<LabeledStmt>(St)) {
if (LST->getStartLoc() == LocToResolve) {
SemaTok = { St };
return true;
}
}
if (auto *CS = dyn_cast<CaseStmt>(St)) {
if (CS->getStartLoc() == LocToResolve) {
SemaTok = { St };
return true;
}
}
return false;
}
bool SemaLocResolver::visitSubscriptReference(ValueDecl *D, CharSourceRange Range,
bool IsOpenBracket) {
// We should treat both open and close brackets equally
@@ -133,7 +149,7 @@ bool SemaLocResolver::walkToStmtPre(Stmt *S) {
// non-implicit Stmts (fix Stmts created for lazy vars).
if (!S->isImplicit() && !rangeContainsLoc(S->getSourceRange()))
return false;
return true;
return !tryResolve(S);
}
bool SemaLocResolver::walkToStmtPost(Stmt *S) {