mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
Swift: add more SelfApplyExpr testing
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
| constructor_ref_calls.swift:7:9:7:9 | call to init | getFunction: | constructor_ref_calls.swift:7:9:7:9 | init | getBaseExpr: | constructor_ref_calls.swift:7:9:7:9 | X.Type |
|
||||
| constructor_ref_calls.swift:8:10:8:10 | call to init | getFunction: | constructor_ref_calls.swift:8:10:8:10 | init | getBaseExpr: | constructor_ref_calls.swift:8:10:8:10 | Y.Type |
|
||||
| constructor_ref_calls.swift:9:10:9:10 | call to init | getFunction: | constructor_ref_calls.swift:9:10:9:10 | init | getBaseExpr: | constructor_ref_calls.swift:9:10:9:10 | Y.Type |
|
||||
@@ -0,0 +1,11 @@
|
||||
// generated by codegen/codegen.py
|
||||
import codeql.swift.elements
|
||||
import TestUtils
|
||||
|
||||
from ConstructorRefCallExpr x, Expr getFunction, Expr getBaseExpr
|
||||
where
|
||||
toBeTested(x) and
|
||||
not x.isUnknown() and
|
||||
getFunction = x.getFunction() and
|
||||
getBaseExpr = x.getBaseExpr()
|
||||
select x, "getFunction:", getFunction, "getBaseExpr:", getBaseExpr
|
||||
@@ -0,0 +1,3 @@
|
||||
| constructor_ref_calls.swift:7:9:7:9 | call to init | 0 | constructor_ref_calls.swift:7:9:7:9 | : X.Type |
|
||||
| constructor_ref_calls.swift:8:10:8:10 | call to init | 0 | constructor_ref_calls.swift:8:10:8:10 | : Y.Type |
|
||||
| constructor_ref_calls.swift:9:10:9:10 | call to init | 0 | constructor_ref_calls.swift:9:10:9:10 | : Y.Type |
|
||||
@@ -0,0 +1,7 @@
|
||||
// generated by codegen/codegen.py
|
||||
import codeql.swift.elements
|
||||
import TestUtils
|
||||
|
||||
from ConstructorRefCallExpr x, int index
|
||||
where toBeTested(x) and not x.isUnknown()
|
||||
select x, index, x.getArgument(index)
|
||||
@@ -0,0 +1,3 @@
|
||||
| constructor_ref_calls.swift:7:9:7:9 | call to init | () -> X |
|
||||
| constructor_ref_calls.swift:8:10:8:10 | call to init | (Int) -> Y |
|
||||
| constructor_ref_calls.swift:9:10:9:10 | call to init | () -> Y |
|
||||
@@ -0,0 +1,7 @@
|
||||
// generated by codegen/codegen.py
|
||||
import codeql.swift.elements
|
||||
import TestUtils
|
||||
|
||||
from ConstructorRefCallExpr x
|
||||
where toBeTested(x) and not x.isUnknown()
|
||||
select x, x.getType()
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -0,0 +1,9 @@
|
||||
struct X {}
|
||||
struct Y {
|
||||
init() {}
|
||||
init(_: Int) {}
|
||||
}
|
||||
|
||||
let x = X()
|
||||
let y1 = Y(42)
|
||||
let y2 = Y()
|
||||
@@ -1,2 +1,9 @@
|
||||
| dot_syntax_call.swift:6:1:6:3 | call to foo(_:_:) | getFunction: | dot_syntax_call.swift:6:3:6:3 | foo(_:_:) | getBaseExpr: | dot_syntax_call.swift:6:1:6:1 | X.Type |
|
||||
| dot_syntax_call.swift:7:1:7:3 | call to bar() | getFunction: | dot_syntax_call.swift:7:3:7:3 | bar() | getBaseExpr: | dot_syntax_call.swift:7:1:7:1 | X.Type |
|
||||
| dot_syntax_call.swift:7:13:7:13 | call to ... | getFunction: | dot_syntax_call.swift:7:13:7:13 | { ... } | getBaseExpr: | dot_syntax_call.swift:7:13:7:13 | self |
|
||||
| dot_syntax_call.swift:7:13:7:13 | call to baz(_:) | getFunction: | dot_syntax_call.swift:7:13:7:13 | baz(_:) | getBaseExpr: | file://:0:0:0:0 | self |
|
||||
| dot_syntax_call.swift:11:1:11:3 | call to foo(_:_:) | getFunction: | dot_syntax_call.swift:11:3:11:3 | foo(_:_:) | getBaseExpr: | dot_syntax_call.swift:11:1:11:1 | X.Type |
|
||||
| dot_syntax_call.swift:12:1:12:3 | call to bar() | getFunction: | dot_syntax_call.swift:12:3:12:3 | bar() | getBaseExpr: | dot_syntax_call.swift:12:1:12:1 | X.Type |
|
||||
| dot_syntax_call.swift:13:1:13:5 | call to baz(_:) | getFunction: | dot_syntax_call.swift:13:5:13:5 | baz(_:) | getBaseExpr: | dot_syntax_call.swift:13:1:13:3 | call to ... |
|
||||
| dot_syntax_call.swift:15:9:15:11 | call to ... | getFunction: | dot_syntax_call.swift:15:11:15:11 | { ... } | getBaseExpr: | dot_syntax_call.swift:15:9:15:9 | X.Type |
|
||||
| dot_syntax_call.swift:15:11:15:11 | call to bar() | getFunction: | dot_syntax_call.swift:15:11:15:11 | bar() | getBaseExpr: | file://:0:0:0:0 | self |
|
||||
| dot_syntax_call.swift:16:9:16:13 | call to ... | getFunction: | dot_syntax_call.swift:16:13:16:13 | { ... } | getBaseExpr: | dot_syntax_call.swift:16:9:16:11 | call to ... |
|
||||
| dot_syntax_call.swift:16:13:16:13 | call to baz(_:) | getFunction: | dot_syntax_call.swift:16:13:16:13 | baz(_:) | getBaseExpr: | file://:0:0:0:0 | self |
|
||||
|
||||
@@ -1,2 +1,9 @@
|
||||
| dot_syntax_call.swift:6:1:6:3 | call to foo(_:_:) | 0 | dot_syntax_call.swift:6:1:6:1 | : X.Type |
|
||||
| dot_syntax_call.swift:7:1:7:3 | call to bar() | 0 | dot_syntax_call.swift:7:1:7:1 | : X.Type |
|
||||
| dot_syntax_call.swift:7:13:7:13 | call to ... | 0 | dot_syntax_call.swift:7:13:7:13 | : self |
|
||||
| dot_syntax_call.swift:7:13:7:13 | call to baz(_:) | 0 | file://:0:0:0:0 | : self |
|
||||
| dot_syntax_call.swift:11:1:11:3 | call to foo(_:_:) | 0 | dot_syntax_call.swift:11:1:11:1 | : X.Type |
|
||||
| dot_syntax_call.swift:12:1:12:3 | call to bar() | 0 | dot_syntax_call.swift:12:1:12:1 | : X.Type |
|
||||
| dot_syntax_call.swift:13:1:13:5 | call to baz(_:) | 0 | dot_syntax_call.swift:13:1:13:3 | : call to ... |
|
||||
| dot_syntax_call.swift:15:9:15:11 | call to ... | 0 | dot_syntax_call.swift:15:9:15:9 | : X.Type |
|
||||
| dot_syntax_call.swift:15:11:15:11 | call to bar() | 0 | file://:0:0:0:0 | : self |
|
||||
| dot_syntax_call.swift:16:9:16:13 | call to ... | 0 | dot_syntax_call.swift:16:9:16:11 | : call to ... |
|
||||
| dot_syntax_call.swift:16:13:16:13 | call to baz(_:) | 0 | file://:0:0:0:0 | : self |
|
||||
|
||||
@@ -1,2 +1,9 @@
|
||||
| dot_syntax_call.swift:6:1:6:3 | call to foo(_:_:) | (Int, Int) -> () |
|
||||
| dot_syntax_call.swift:7:1:7:3 | call to bar() | () -> () |
|
||||
| dot_syntax_call.swift:7:13:7:13 | call to ... | (Int) -> () |
|
||||
| dot_syntax_call.swift:7:13:7:13 | call to baz(_:) | (Int) -> () |
|
||||
| dot_syntax_call.swift:11:1:11:3 | call to foo(_:_:) | (Int, Int) -> () |
|
||||
| dot_syntax_call.swift:12:1:12:3 | call to bar() | () -> () |
|
||||
| dot_syntax_call.swift:13:1:13:5 | call to baz(_:) | (Int) -> () |
|
||||
| dot_syntax_call.swift:15:9:15:11 | call to ... | () -> () |
|
||||
| dot_syntax_call.swift:15:11:15:11 | call to bar() | () -> () |
|
||||
| dot_syntax_call.swift:16:9:16:13 | call to ... | (Int) -> () |
|
||||
| dot_syntax_call.swift:16:13:16:13 | call to baz(_:) | (Int) -> () |
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
class X {
|
||||
static func foo(_: Int, _:Int) {}
|
||||
class func bar() {}
|
||||
func baz(_: Int) {}
|
||||
|
||||
init() {
|
||||
let f = baz
|
||||
}
|
||||
}
|
||||
|
||||
X.foo(1, 2)
|
||||
X.bar()
|
||||
X().baz(42)
|
||||
|
||||
let f = X.bar
|
||||
let g = X().baz
|
||||
|
||||
Reference in New Issue
Block a user