mirror of
https://github.com/github/codeql.git
synced 2025-12-17 17:23:36 +01:00
24 lines
647 B
Plaintext
24 lines
647 B
Plaintext
/**
|
|
* @name Test for object creations
|
|
*/
|
|
|
|
import csharp
|
|
|
|
from
|
|
Method m, ObjectCreation e, Constructor cc, ObjectInitializer i, MemberInitializer a,
|
|
MemberInitializer b
|
|
where
|
|
m.hasName("MainCreations") and
|
|
e.getEnclosingCallable() = m and
|
|
e.getTarget() = cc and
|
|
e.getNumberOfArguments() = 0 and
|
|
cc.hasName("Point") and
|
|
i = e.getInitializer() and
|
|
a = i.getMemberInitializer(0) and
|
|
a.getLValue().(PropertyAccess).getTarget().hasName("X") and
|
|
a.getRValue().getValue() = "0" and
|
|
b = i.getMemberInitializer(1) and
|
|
b.getLValue().(PropertyAccess).getTarget().hasName("Y") and
|
|
b.getRValue().getValue() = "1"
|
|
select e, i, a, b
|