mirror of
https://github.com/github/codeql.git
synced 2026-04-18 21:44:02 +02:00
Swift: initial getStaticTarget test
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
noStaticTarget
|
||||
| file://:0:0:0:0 | call to ... | file://:0:0:0:0 | (no string representation) | DeclRefExpr |
|
||||
| methodlookup.swift:27:5:27:27 | call to ... | methodlookup.swift:27:5:27:9 | .{ ... } | DotSyntaxBaseIgnoredExpr |
|
||||
| methodlookup.swift:27:5:27:29 | call to ... | methodlookup.swift:27:5:27:27 | call to ... | CallExpr |
|
||||
| methodlookup.swift:47:11:47:30 | call to ... | methodlookup.swift:47:11:47:15 | call to instanceMethod() | DotSyntaxCallExpr |
|
||||
| methodlookup.swift:48:11:48:33 | call to ... | methodlookup.swift:48:11:48:15 | .{ ... } | DotSyntaxBaseIgnoredExpr |
|
||||
| methodlookup.swift:48:11:48:35 | call to ... | methodlookup.swift:48:11:48:33 | call to ... | CallExpr |
|
||||
| methodlookup.swift:50:11:50:27 | call to ... | methodlookup.swift:50:11:50:15 | call to classMethod() | DotSyntaxCallExpr |
|
||||
| methodlookup.swift:51:11:51:28 | call to ... | methodlookup.swift:51:11:51:15 | call to staticMethod() | DotSyntaxCallExpr |
|
||||
#select
|
||||
| file://:0:0:0:0 | call to ... | false | - |
|
||||
| file://:0:0:0:0 | call to init(_:) | true | init(_:) |
|
||||
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
|
||||
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
|
||||
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
|
||||
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
|
||||
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
|
||||
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
|
||||
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
|
||||
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
|
||||
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
|
||||
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
|
||||
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
|
||||
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
|
||||
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
|
||||
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
|
||||
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
|
||||
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
|
||||
| methodlookup.swift:23:15:23:19 | call to init() | true | init() |
|
||||
| methodlookup.swift:24:9:24:18 | call to init() | true | init() |
|
||||
| methodlookup.swift:26:5:26:24 | call to instanceMethod() | true | instanceMethod() |
|
||||
| methodlookup.swift:27:5:27:27 | call to ... | false | - |
|
||||
| methodlookup.swift:27:5:27:29 | call to ... | false | - |
|
||||
| methodlookup.swift:27:9:27:9 | call to instanceMethod() | true | instanceMethod() |
|
||||
| methodlookup.swift:29:5:29:21 | call to classMethod() | true | classMethod() |
|
||||
| methodlookup.swift:30:5:30:22 | call to staticMethod() | true | staticMethod() |
|
||||
| methodlookup.swift:33:1:41:1 | call to init(priority:operation:) | true | init(priority:operation:) |
|
||||
| methodlookup.swift:34:15:34:19 | call to init() | true | init() |
|
||||
| methodlookup.swift:35:9:35:18 | call to init() | true | init() |
|
||||
| methodlookup.swift:37:11:37:30 | call to instanceMethod() | true | instanceMethod() |
|
||||
| methodlookup.swift:40:5:40:22 | call to staticMethod() | true | staticMethod() |
|
||||
| methodlookup.swift:43:1:52:1 | call to init(priority:operation:) | true | init(priority:operation:) |
|
||||
| methodlookup.swift:44:21:44:25 | call to init() | true | init() |
|
||||
| methodlookup.swift:45:15:45:24 | call to init() | true | init() |
|
||||
| methodlookup.swift:47:11:47:30 | call to ... | false | - |
|
||||
| methodlookup.swift:48:11:48:33 | call to ... | false | - |
|
||||
| methodlookup.swift:48:11:48:35 | call to ... | false | - |
|
||||
| methodlookup.swift:48:15:48:15 | call to instanceMethod() | true | instanceMethod() |
|
||||
| methodlookup.swift:50:11:50:27 | call to ... | false | - |
|
||||
| methodlookup.swift:51:11:51:28 | call to ... | false | - |
|
||||
@@ -0,0 +1,19 @@
|
||||
import swift
|
||||
|
||||
query predicate noStaticTarget(CallExpr c, Expr func, string funcClass) {
|
||||
not exists(c.getStaticTarget()) and
|
||||
func = c.getFunction() and
|
||||
funcClass = func.getPrimaryQlClasses()
|
||||
}
|
||||
|
||||
from CallExpr c, boolean hasStaticTarget, string staticTarget
|
||||
where
|
||||
if exists(c.getStaticTarget().toString())
|
||||
then (
|
||||
hasStaticTarget = true and
|
||||
staticTarget = c.getStaticTarget().toString()
|
||||
) else (
|
||||
hasStaticTarget = false and
|
||||
staticTarget = "-"
|
||||
)
|
||||
select c, hasStaticTarget, staticTarget
|
||||
@@ -44,8 +44,8 @@ Task {
|
||||
let baz = await Baz()
|
||||
_ = await Baz.init()
|
||||
|
||||
await baz.instanceMethod()
|
||||
await Baz.instanceMethod(baz)()
|
||||
await baz.instanceMethod() // DotSyntaxCallExpr
|
||||
await Baz.instanceMethod(baz)() // DotSyntaxBaseIgnoredExpr
|
||||
|
||||
await Baz.classMethod()
|
||||
await Baz.staticMethod()
|
||||
|
||||
Reference in New Issue
Block a user