mirror of
https://github.com/github/codeql.git
synced 2026-03-23 16:06:47 +01:00
15 lines
506 B
Plaintext
15 lines
506 B
Plaintext
/**
|
|
* @name Test for anonymous object creations
|
|
*/
|
|
import csharp
|
|
|
|
from Assignment assign, AnonymousObjectCreation o, Assignment a, Property p
|
|
where assign.getLValue().(VariableAccess).getTarget().hasName("contacts2")
|
|
and o.getParent+() = assign
|
|
and o.getInitializer().getMemberInitializer(0) = a
|
|
and a.getRValue().getValue() = "Chris Smith"
|
|
and p = a.getLValue().(PropertyAccess).getTarget()
|
|
and p.hasName("Name")
|
|
and p.getDeclaringType() = o.getObjectType()
|
|
select o, p.getType().toString()
|