Skip to content

Commit 141e8fc

Browse files
committed
Swift: Sync schema.
1 parent 51bb33a commit 141e8fc

File tree

5 files changed

+30
-6
lines changed

5 files changed

+30
-6
lines changed

swift/codegen/schema.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ ExprPattern:
516516

517517
IsPattern:
518518
_extends: Pattern
519-
cast_type_repr: TypeRepr
519+
cast_type_repr: TypeRepr?
520520
sub_pattern: Pattern?
521521

522522
NamedPattern:
@@ -661,6 +661,7 @@ TypeDecl:
661661

662662
AutoClosureExpr:
663663
_extends: AbstractClosureExpr
664+
body: BraceStmt
664665

665666
ClosureExpr:
666667
_extends: AbstractClosureExpr
@@ -858,6 +859,7 @@ DoStmt:
858859
ForEachStmt:
859860
_extends: LabeledStmt
860861
body: BraceStmt
862+
sequence: Expr
861863
where: Expr?
862864

863865
LabeledConditionalStmt:
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
// generated by codegen/codegen.py
22
import codeql.swift.elements.expr.AbstractClosureExpr
3+
import codeql.swift.elements.stmt.BraceStmt
34

45
class AutoClosureExprBase extends @auto_closure_expr, AbstractClosureExpr {
56
override string toString() { result = "AutoClosureExpr" }
7+
8+
BraceStmt getBody() {
9+
exists(BraceStmt x |
10+
auto_closure_exprs(this, x) and
11+
result = x.resolve()
12+
)
13+
}
614
}

swift/ql/lib/codeql/swift/generated/pattern/IsPattern.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class IsPatternBase extends @is_pattern, Pattern {
77

88
TypeRepr getCastTypeRepr() {
99
exists(TypeRepr x |
10-
is_patterns(this, x) and
10+
is_pattern_cast_type_reprs(this, x) and
1111
result = x.resolve()
1212
)
1313
}

swift/ql/lib/codeql/swift/generated/stmt/ForEachStmt.qll

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@ class ForEachStmtBase extends @for_each_stmt, LabeledStmt {
88

99
BraceStmt getBody() {
1010
exists(BraceStmt x |
11-
for_each_stmts(this, x) and
11+
for_each_stmts(this, x, _) and
12+
result = x.resolve()
13+
)
14+
}
15+
16+
Expr getSequence() {
17+
exists(Expr x |
18+
for_each_stmts(this, _, x) and
1219
result = x.resolve()
1320
)
1421
}

swift/ql/lib/swift.dbscheme

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,12 @@ expr_patterns(
10221022
);
10231023

10241024
is_patterns(
1025-
unique int id: @is_pattern,
1025+
unique int id: @is_pattern
1026+
);
1027+
1028+
#keyset[id]
1029+
is_pattern_cast_type_reprs(
1030+
int id: @is_pattern ref,
10261031
int cast_type_repr: @type_repr ref
10271032
);
10281033

@@ -1314,7 +1319,8 @@ type_decls(
13141319
);
13151320

13161321
auto_closure_exprs(
1317-
unique int id: @auto_closure_expr
1322+
unique int id: @auto_closure_expr,
1323+
int body: @brace_stmt ref
13181324
);
13191325

13201326
closure_exprs(
@@ -1625,7 +1631,8 @@ do_stmts(
16251631

16261632
for_each_stmts(
16271633
unique int id: @for_each_stmt,
1628-
int body: @brace_stmt ref
1634+
int body: @brace_stmt ref,
1635+
int sequence: @expr ref
16291636
);
16301637

16311638
#keyset[id]

0 commit comments

Comments
 (0)