Swift: autoformat for for-in changes

This commit is contained in:
Robert Marsh
2023-09-14 16:48:19 +00:00
parent 56b646a74c
commit eddca7f3f6
4 changed files with 5783 additions and 6896 deletions

View File

@@ -983,8 +983,8 @@ predicate readStep(Node node1, ContentSet c, Node node2) {
node1.(DictionarySubscriptNode).getExpr() = subscript and
c.isSingleton(any(Content::TupleContent tc | tc.getIndex() = 1))
)
// read of an optional into the loop variable via foreach
or
// read of an optional into the loop variable via foreach
exists(ForEachStmt for |
node1.asExpr() = for.getNextCall() and
node2.asPattern() = for.getPattern() and

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -18,19 +18,22 @@ module Generated {
* behavior of both the `Immediate` and non-`Immediate` versions.
*/
Pattern getImmediatePattern() {
result = Synth::convertPatternFromRaw(Synth::convertForEachStmtToRaw(this).(Raw::ForEachStmt).getPattern())
result =
Synth::convertPatternFromRaw(Synth::convertForEachStmtToRaw(this)
.(Raw::ForEachStmt)
.getPattern())
}
/**
* Gets the pattern of this for each statement.
*
*/
final Pattern getPattern() {
exists(Pattern immediate | immediate = this.getImmediatePattern() and
result = immediate.resolve())
exists(Pattern immediate |
immediate = this.getImmediatePattern() and
result = immediate.resolve()
)
}
/**
* Gets the where of this for each statement, if it exists.
*
@@ -38,39 +41,39 @@ module Generated {
* behavior of both the `Immediate` and non-`Immediate` versions.
*/
Expr getImmediateWhere() {
result = Synth::convertExprFromRaw(Synth::convertForEachStmtToRaw(this).(Raw::ForEachStmt).getWhere())
result =
Synth::convertExprFromRaw(Synth::convertForEachStmtToRaw(this).(Raw::ForEachStmt).getWhere())
}
/**
* Gets the where of this for each statement, if it exists.
*
*/
final Expr getWhere() {
exists(Expr immediate | immediate = this.getImmediateWhere() and
result = immediate.resolve())
exists(Expr immediate |
immediate = this.getImmediateWhere() and
result = immediate.resolve()
)
}
/**
* Holds if `getWhere()` exists.
*/
final predicate hasWhere() {
exists(this.getWhere())
}
final predicate hasWhere() { exists(this.getWhere()) }
/**
* Gets the iteratorvar of this for each statement, if it exists.
*
*/
PatternBindingDecl getIteratorVar() {
result = Synth::convertPatternBindingDeclFromRaw(Synth::convertForEachStmtToRaw(this).(Raw::ForEachStmt).getIteratorVar())
result =
Synth::convertPatternBindingDeclFromRaw(Synth::convertForEachStmtToRaw(this)
.(Raw::ForEachStmt)
.getIteratorVar())
}
/**
* Holds if `getIteratorVar()` exists.
*/
final predicate hasIteratorVar() {
exists(this.getIteratorVar())
}
final predicate hasIteratorVar() { exists(this.getIteratorVar()) }
/**
* Gets the nextcall of this for each statement, if it exists.
@@ -79,32 +82,35 @@ module Generated {
* behavior of both the `Immediate` and non-`Immediate` versions.
*/
Expr getImmediateNextCall() {
result = Synth::convertExprFromRaw(Synth::convertForEachStmtToRaw(this).(Raw::ForEachStmt).getNextCall())
result =
Synth::convertExprFromRaw(Synth::convertForEachStmtToRaw(this)
.(Raw::ForEachStmt)
.getNextCall())
}
/**
* Gets the nextcall of this for each statement, if it exists.
*
*/
final Expr getNextCall() {
exists(Expr immediate | immediate = this.getImmediateNextCall() and
result = immediate.resolve())
exists(Expr immediate |
immediate = this.getImmediateNextCall() and
result = immediate.resolve()
)
}
/**
* Holds if `getNextCall()` exists.
*/
final predicate hasNextCall() {
exists(this.getNextCall())
}
final predicate hasNextCall() { exists(this.getNextCall()) }
/**
* Gets the body of this for each statement.
*
*/
BraceStmt getBody() {
result = Synth::convertBraceStmtFromRaw(Synth::convertForEachStmtToRaw(this).(Raw::ForEachStmt).getBody())
result =
Synth::convertBraceStmtFromRaw(Synth::convertForEachStmtToRaw(this)
.(Raw::ForEachStmt)
.getBody())
}
}
}