mirror of
https://github.com/github/codeql.git
synced 2026-05-25 00:27:09 +02:00
PS: Don't include the this parameter in getParameter.
This commit is contained in:
@@ -79,6 +79,9 @@ class ScriptBlock extends Ast, TScriptBlock {
|
||||
result = this.getParameter(index)
|
||||
)
|
||||
or
|
||||
i = ThisVar() and
|
||||
result = this.getThisParameter()
|
||||
or
|
||||
exists(int index |
|
||||
i = scriptBlockUsing(index) and
|
||||
result = this.getUsingStmt(index)
|
||||
@@ -90,13 +93,14 @@ class ScriptBlock extends Ast, TScriptBlock {
|
||||
or
|
||||
any(Synthesis s).pipelineParameterHasIndex(this, i) and
|
||||
synthChild(getRawAst(this), PipelineParamVar(), result)
|
||||
or
|
||||
i = -1 and
|
||||
synthChild(getRawAst(this), ThisVar(), result)
|
||||
}
|
||||
|
||||
Parameter getThisParameter() { synthChild(getRawAst(this), ThisVar(), result) }
|
||||
|
||||
/**
|
||||
* Gets a parameter of this block.
|
||||
*
|
||||
* Note: This does not include the `this` parameter, but it does include pipeline parameters.
|
||||
*/
|
||||
Parameter getAParameter() { result = this.getParameter(_) }
|
||||
|
||||
|
||||
@@ -151,6 +151,30 @@ module Trees {
|
||||
|
||||
override predicate succ(AstNode pred, AstNode succ, Completion c) {
|
||||
this.succEntry(pred, c) and
|
||||
(
|
||||
first(super.getThisParameter(), succ)
|
||||
or
|
||||
not exists(super.getThisParameter()) and
|
||||
first(super.getParameter(0), succ)
|
||||
or
|
||||
not exists(super.getThisParameter()) and
|
||||
not exists(super.getAParameter()) and
|
||||
first(super.getBeginBlock(), succ)
|
||||
or
|
||||
not exists(super.getThisParameter()) and
|
||||
not exists(super.getAParameter()) and
|
||||
not exists(super.getBeginBlock()) and
|
||||
first(super.getProcessBlock(), succ)
|
||||
or
|
||||
not exists(super.getThisParameter()) and
|
||||
not exists(super.getAParameter()) and
|
||||
not exists(super.getBeginBlock()) and
|
||||
not exists(super.getProcessBlock()) and
|
||||
first(super.getEndBlock(), succ)
|
||||
)
|
||||
or
|
||||
last(super.getThisParameter(), pred, c) and
|
||||
completionIsNormal(c) and
|
||||
(
|
||||
first(super.getParameter(0), succ)
|
||||
or
|
||||
|
||||
Reference in New Issue
Block a user