mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
rework StmtCondition to be based on patterns initializers and boolean
conditions instead of being wrapped around PatternBindingDecl. When let/else goes away, PatternBindingDecl will become a lot simpler. Swift SVN r28055
This commit is contained in:
@@ -763,17 +763,24 @@ public:
|
||||
return P;
|
||||
}
|
||||
|
||||
bool doIt(StmtCondition C) {
|
||||
bool doIt(const StmtCondition &C) {
|
||||
for (auto &elt : C) {
|
||||
if (auto E = elt.getCondition()) {
|
||||
if (auto E = elt.getConditionOrNull()) {
|
||||
// Walk an expression condition normally.
|
||||
E = doIt(E);
|
||||
if (!E)
|
||||
return true;
|
||||
elt.setCondition(E);
|
||||
} else if (auto CB = elt.getBinding()) {
|
||||
doIt(CB);
|
||||
continue;
|
||||
}
|
||||
|
||||
auto *P = doIt(elt.getPattern());
|
||||
if (!P) return true;
|
||||
elt.setPattern(P);
|
||||
|
||||
auto *I = doIt(elt.getInitializer());
|
||||
if (!I) return true;
|
||||
elt.setInitializer(I);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user