Files
codeql/swift/ql/test/extractor-tests/expressions/semantics.ql
2022-05-24 10:00:14 +01:00

32 lines
1.1 KiB
Plaintext

import swift
from Expr e, string semantics
where
e.getLocation().getFile().getName().matches("%swift/ql/test%") and
(
exists(DeclRefExpr ref | ref = e |
ref.hasDirectToImplementationSemantics() and semantics = "DirectToImplementation"
or
ref.hasDirectToStorageSemantics() and semantics = "DirectToStorage"
or
ref.hasOrdinarySemantics() and semantics = "OrdinarySemantics"
)
or
exists(SubscriptExpr sub | sub = e |
sub.hasDirectToImplementationSemantics() and semantics = "DirectToImplementation"
or
sub.hasDirectToStorageSemantics() and semantics = "DirectToStorage"
or
sub.hasOrdinarySemantics() and semantics = "OrdinarySemantics"
)
or
exists(MemberRefExpr memberRef | memberRef = e |
memberRef.hasDirectToImplementationSemantics() and semantics = "DirectToImplementation"
or
memberRef.hasDirectToStorageSemantics() and semantics = "DirectToStorage"
or
memberRef.hasOrdinarySemantics() and semantics = "OrdinarySemantics"
)
)
select e, semantics