File tree Expand file tree Collapse file tree 7 files changed +23
-26
lines changed
test/library-tests/parent Expand file tree Collapse file tree 7 files changed +23
-26
lines changed Original file line number Diff line number Diff line change @@ -80,8 +80,8 @@ AstNode:
80
80
81
81
Callable :
82
82
_children :
83
- params : ParamDecl*
84
83
self_param : ParamDecl?
84
+ params : ParamDecl*
85
85
body : BraceStmt?
86
86
87
87
ConditionElement :
@@ -545,7 +545,7 @@ RebindSelfInConstructorExpr:
545
545
_extends : Expr
546
546
_children :
547
547
sub_expr : Expr
548
- self : VarDecl
548
+ self : VarDecl
549
549
550
550
SequenceExpr :
551
551
_extends : Expr
Original file line number Diff line number Diff line change @@ -6,29 +6,29 @@ import codeql.swift.elements.Element
6
6
import codeql.swift.elements.decl.ParamDecl
7
7
8
8
class CallableBase extends Synth:: TCallable , Element {
9
- ParamDecl getImmediateParam ( int index ) {
9
+ ParamDecl getImmediateSelfParam ( ) {
10
10
result =
11
11
Synth:: convertParamDeclFromRaw ( Synth:: convertCallableToRaw ( this )
12
12
.( Raw:: Callable )
13
- .getParam ( index ) )
13
+ .getSelfParam ( ) )
14
14
}
15
15
16
- final ParamDecl getParam ( int index ) { result = getImmediateParam ( index ) .resolve ( ) }
17
-
18
- final ParamDecl getAParam ( ) { result = getParam ( _) }
16
+ final ParamDecl getSelfParam ( ) { result = getImmediateSelfParam ( ) .resolve ( ) }
19
17
20
- final int getNumberOfParams ( ) { result = count ( getAParam ( ) ) }
18
+ final predicate hasSelfParam ( ) { exists ( getSelfParam ( ) ) }
21
19
22
- ParamDecl getImmediateSelfParam ( ) {
20
+ ParamDecl getImmediateParam ( int index ) {
23
21
result =
24
22
Synth:: convertParamDeclFromRaw ( Synth:: convertCallableToRaw ( this )
25
23
.( Raw:: Callable )
26
- .getSelfParam ( ) )
24
+ .getParam ( index ) )
27
25
}
28
26
29
- final ParamDecl getSelfParam ( ) { result = getImmediateSelfParam ( ) .resolve ( ) }
27
+ final ParamDecl getParam ( int index ) { result = getImmediateParam ( index ) .resolve ( ) }
30
28
31
- final predicate hasSelfParam ( ) { exists ( getSelfParam ( ) ) }
29
+ final ParamDecl getAParam ( ) { result = getParam ( _) }
30
+
31
+ final int getNumberOfParams ( ) { result = count ( getAParam ( ) ) }
32
32
33
33
BraceStmt getImmediateBody ( ) {
34
34
result =
Original file line number Diff line number Diff line change @@ -13,10 +13,10 @@ Element getAnImmediateChild(Element e) {
13
13
// * none() simplifies generation, as we can append `or ...` without a special case for the first item
14
14
none ( )
15
15
or
16
- result = e .( Callable ) .getImmediateParam ( _)
17
- or
18
16
result = e .( Callable ) .getImmediateSelfParam ( )
19
17
or
18
+ result = e .( Callable ) .getImmediateParam ( _)
19
+ or
20
20
result = e .( Callable ) .getImmediateBody ( )
21
21
or
22
22
result = e .( AbstractStorageDecl ) .getImmediateAccessorDecl ( _)
@@ -123,8 +123,6 @@ Element getAnImmediateChild(Element e) {
123
123
or
124
124
result = e .( RebindSelfInConstructorExpr ) .getImmediateSubExpr ( )
125
125
or
126
- result = e .( RebindSelfInConstructorExpr ) .getImmediateSelf ( )
127
- or
128
126
result = e .( SelfApplyExpr ) .getImmediateBase ( )
129
127
or
130
128
result = e .( SequenceExpr ) .getImmediateElement ( _)
Original file line number Diff line number Diff line change @@ -6,10 +6,10 @@ module Raw {
6
6
}
7
7
8
8
class Callable extends @callable, Element {
9
- ParamDecl getParam ( int index ) { callable_params ( this , index , result ) }
10
-
11
9
ParamDecl getSelfParam ( ) { callable_self_params ( this , result ) }
12
10
11
+ ParamDecl getParam ( int index ) { callable_params ( this , index , result ) }
12
+
13
13
BraceStmt getBody ( ) { callable_bodies ( this , result ) }
14
14
}
15
15
Original file line number Diff line number Diff line change @@ -166,19 +166,19 @@ nominal_type_decls( //dir=decl
166
166
| @abstract_function_decl
167
167
;
168
168
169
+ #keyset[id]
170
+ callable_self_params(
171
+ int id: @callable ref,
172
+ int self_param: @param_decl ref
173
+ );
174
+
169
175
#keyset[id, index]
170
176
callable_params(
171
177
int id: @callable ref,
172
178
int index: int ref,
173
179
int param: @param_decl ref
174
180
);
175
181
176
- #keyset[id]
177
- callable_self_params(
178
- int id: @callable ref,
179
- int self_param: @param_decl ref
180
- );
181
-
182
182
#keyset[id]
183
183
callable_bodies(
184
184
int id: @callable ref,
Original file line number Diff line number Diff line change 1
- | ConstructorDecl | RebindSelfInConstructorExpr | ParamDecl |
2
- | RebindSelfInConstructorExpr | ConstructorDecl | ParamDecl |
Original file line number Diff line number Diff line change 623
623
| expressions.swift:77:21:77:21 | init | ConstructorDecl | expressions.swift:77:21:77:21 | self | ParamDecl |
624
624
| expressions.swift:77:21:77:21 | init | ConstructorDecl | file://:0:0:0:0 | x | ParamDecl |
625
625
| expressions.swift:77:21:77:21 | init | ConstructorDecl | file://:0:0:0:0 | { ... } | BraceStmt |
626
+ | expressions.swift:78:3:80:3 | init | ConstructorDecl | expressions.swift:78:3:78:3 | self | ParamDecl |
626
627
| expressions.swift:78:3:80:3 | init | ConstructorDecl | expressions.swift:78:10:80:3 | { ... } | BraceStmt |
627
628
| expressions.swift:78:10:80:3 | { ... } | BraceStmt | expressions.swift:79:5:79:21 | self = ... | RebindSelfInConstructorExpr |
628
629
| expressions.swift:78:10:80:3 | { ... } | BraceStmt | expressions.swift:80:3:80:3 | return | ReturnStmt |
You can’t perform that action at this time.
0 commit comments