File tree Expand file tree Collapse file tree
test/library-tests/parent Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,8 +80,8 @@ AstNode:
8080
8181Callable :
8282 _children :
83- params : ParamDecl*
8483 self_param : ParamDecl?
84+ params : ParamDecl*
8585 body : BraceStmt?
8686
8787ConditionElement :
@@ -545,7 +545,7 @@ RebindSelfInConstructorExpr:
545545 _extends : Expr
546546 _children :
547547 sub_expr : Expr
548- self : VarDecl
548+ self : VarDecl
549549
550550SequenceExpr :
551551 _extends : Expr
Original file line number Diff line number Diff line change @@ -6,29 +6,29 @@ import codeql.swift.elements.Element
66import codeql.swift.elements.decl.ParamDecl
77
88class CallableBase extends Synth:: TCallable , Element {
9- ParamDecl getImmediateParam ( int index ) {
9+ ParamDecl getImmediateSelfParam ( ) {
1010 result =
1111 Synth:: convertParamDeclFromRaw ( Synth:: convertCallableToRaw ( this )
1212 .( Raw:: Callable )
13- .getParam ( index ) )
13+ .getSelfParam ( ) )
1414 }
1515
16- final ParamDecl getParam ( int index ) { result = getImmediateParam ( index ) .resolve ( ) }
17-
18- final ParamDecl getAParam ( ) { result = getParam ( _) }
16+ final ParamDecl getSelfParam ( ) { result = getImmediateSelfParam ( ) .resolve ( ) }
1917
20- final int getNumberOfParams ( ) { result = count ( getAParam ( ) ) }
18+ final predicate hasSelfParam ( ) { exists ( getSelfParam ( ) ) }
2119
22- ParamDecl getImmediateSelfParam ( ) {
20+ ParamDecl getImmediateParam ( int index ) {
2321 result =
2422 Synth:: convertParamDeclFromRaw ( Synth:: convertCallableToRaw ( this )
2523 .( Raw:: Callable )
26- .getSelfParam ( ) )
24+ .getParam ( index ) )
2725 }
2826
29- final ParamDecl getSelfParam ( ) { result = getImmediateSelfParam ( ) .resolve ( ) }
27+ final ParamDecl getParam ( int index ) { result = getImmediateParam ( index ) .resolve ( ) }
3028
31- final predicate hasSelfParam ( ) { exists ( getSelfParam ( ) ) }
29+ final ParamDecl getAParam ( ) { result = getParam ( _) }
30+
31+ final int getNumberOfParams ( ) { result = count ( getAParam ( ) ) }
3232
3333 BraceStmt getImmediateBody ( ) {
3434 result =
Original file line number Diff line number Diff line change @@ -13,10 +13,10 @@ Element getAnImmediateChild(Element e) {
1313 // * none() simplifies generation, as we can append `or ...` without a special case for the first item
1414 none ( )
1515 or
16- result = e .( Callable ) .getImmediateParam ( _)
17- or
1816 result = e .( Callable ) .getImmediateSelfParam ( )
1917 or
18+ result = e .( Callable ) .getImmediateParam ( _)
19+ or
2020 result = e .( Callable ) .getImmediateBody ( )
2121 or
2222 result = e .( AbstractStorageDecl ) .getImmediateAccessorDecl ( _)
@@ -123,8 +123,6 @@ Element getAnImmediateChild(Element e) {
123123 or
124124 result = e .( RebindSelfInConstructorExpr ) .getImmediateSubExpr ( )
125125 or
126- result = e .( RebindSelfInConstructorExpr ) .getImmediateSelf ( )
127- or
128126 result = e .( SelfApplyExpr ) .getImmediateBase ( )
129127 or
130128 result = e .( SequenceExpr ) .getImmediateElement ( _)
Original file line number Diff line number Diff line change @@ -6,10 +6,10 @@ module Raw {
66 }
77
88 class Callable extends @callable, Element {
9- ParamDecl getParam ( int index ) { callable_params ( this , index , result ) }
10-
119 ParamDecl getSelfParam ( ) { callable_self_params ( this , result ) }
1210
11+ ParamDecl getParam ( int index ) { callable_params ( this , index , result ) }
12+
1313 BraceStmt getBody ( ) { callable_bodies ( this , result ) }
1414 }
1515
Original file line number Diff line number Diff line change @@ -166,19 +166,19 @@ nominal_type_decls( //dir=decl
166166| @abstract_function_decl
167167;
168168
169+ #keyset[id]
170+ callable_self_params(
171+ int id: @callable ref,
172+ int self_param: @param_decl ref
173+ );
174+
169175#keyset[id, index]
170176callable_params(
171177 int id: @callable ref,
172178 int index: int ref,
173179 int param: @param_decl ref
174180);
175181
176- #keyset[id]
177- callable_self_params(
178- int id: @callable ref,
179- int self_param: @param_decl ref
180- );
181-
182182#keyset[id]
183183callable_bodies(
184184 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 623623| expressions.swift:77:21:77:21 | init | ConstructorDecl | expressions.swift:77:21:77:21 | self | ParamDecl |
624624| expressions.swift:77:21:77:21 | init | ConstructorDecl | file://:0:0:0:0 | x | ParamDecl |
625625| 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 |
626627| expressions.swift:78:3:80:3 | init | ConstructorDecl | expressions.swift:78:10:80:3 | { ... } | BraceStmt |
627628| expressions.swift:78:10:80:3 | { ... } | BraceStmt | expressions.swift:79:5:79:21 | self = ... | RebindSelfInConstructorExpr |
628629| 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