mirror of
https://github.com/github/codeql.git
synced 2026-04-23 15:55:18 +02:00
C#: Add support for params parameters in getRuntimeArgumentForParameter.
This commit is contained in:
@@ -182,12 +182,20 @@ class Call extends DotNet::Call, Expr, @call {
|
||||
/**
|
||||
* Gets the argument that corresponds to parameter `p` of a potential
|
||||
* run-time target of this call.
|
||||
*
|
||||
* Does not consider default arguments.
|
||||
*/
|
||||
Expr getRuntimeArgumentForParameter(Parameter p) {
|
||||
exists(Callable c |
|
||||
c = this.getARuntimeTarget() and
|
||||
p = c.getAParameter() and
|
||||
result = this.getRuntimeArgument(p.getPosition())
|
||||
(
|
||||
p.isParams() and
|
||||
result = this.getRuntimeArgument(any(int i | i >= p.getPosition()))
|
||||
or
|
||||
not p.isParams() and
|
||||
result = this.getRuntimeArgument(p.getPosition())
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user