mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[IDE] Remove support for C-style ForStmt
This commit is contained in:
@@ -585,33 +585,6 @@ std::pair<bool, Stmt *> ModelASTWalker::walkToStmtPre(Stmt *S) {
|
||||
addExprElem(SyntaxStructureElementKind::Expr, ForEachS->getSequence(),SN);
|
||||
pushStructureNode(SN, S);
|
||||
|
||||
} else if (auto *ForS = dyn_cast<ForStmt>(S)) {
|
||||
SyntaxStructureNode SN;
|
||||
SN.Kind = SyntaxStructureKind::ForStatement;
|
||||
SN.Range = charSourceRangeFromSourceRange(SM, S->getSourceRange());
|
||||
|
||||
if (!ForS->getInitializerVarDecls().empty()) {
|
||||
auto InitDs = ForS->getInitializerVarDecls();
|
||||
// Initializer decls come as a PatternBindingDecl followed by VarDecl's
|
||||
// for each pattern set up. The PBD covers the whole initializer.
|
||||
assert(isa<PatternBindingDecl>(InitDs[0]));
|
||||
SourceRange ElemRange = InitDs[0]->getSourceRange();
|
||||
SN.Elements.emplace_back(SyntaxStructureElementKind::InitExpr,
|
||||
charSourceRangeFromSourceRange(SM, ElemRange));
|
||||
} else if (ForS->getInitializer()) {
|
||||
addExprElem(SyntaxStructureElementKind::InitExpr,
|
||||
ForS->getInitializer().get(), SN);
|
||||
}
|
||||
|
||||
if (ForS->getCond()) {
|
||||
addExprElem(SyntaxStructureElementKind::Expr, ForS->getCond().get(), SN);
|
||||
}
|
||||
if (ForS->getIncrement()) {
|
||||
addExprElem(SyntaxStructureElementKind::Expr, ForS->getIncrement().get(),
|
||||
SN);
|
||||
}
|
||||
pushStructureNode(SN, S);
|
||||
|
||||
} else if (auto *WhileS = dyn_cast<WhileStmt>(S)) {
|
||||
SyntaxStructureNode SN;
|
||||
SN.Kind = SyntaxStructureKind::WhileStatement;
|
||||
|
||||
Reference in New Issue
Block a user