File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
powershell/ql/lib/semmle/code/powershell/ast/internal Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -113,3 +113,28 @@ Ast getResultAst(Raw::Ast r) {
113113}
114114
115115Raw:: Ast getRawAst ( Ast r ) { r = getResultAst ( result ) }
116+
117+ private module ThisSynthesis {
118+ private class ThisSynthesis extends Synthesis {
119+ override predicate child ( Raw:: Ast parent , ChildIndex i , Child child ) {
120+ parent instanceof Raw:: MethodScriptBlock and
121+ i = ThisVar ( ) and
122+ child = SynthChild ( VarSynthKind ( ThisVarKind ( ) ) )
123+ or
124+ parent .getChild ( toRawChildIndex ( i ) ) .( Raw:: VarAccess ) .getUserPath ( ) .toLowerCase ( ) = "this" and
125+ child = SynthChild ( VarAccessSynthKind ( TVariableSynth ( parent .getScope ( ) , ThisVar ( ) ) ) )
126+ }
127+
128+ override predicate variableSynthName ( VariableSynth v , string name ) {
129+ v = TVariableSynth ( _, ThisVar ( ) ) and
130+ name = "this"
131+ }
132+
133+ override Location getLocation ( Ast n ) {
134+ exists ( Raw:: Ast scope |
135+ n = TVariableSynth ( scope , ThisVar ( ) ) and
136+ result = scope .getLocation ( )
137+ )
138+ }
139+ }
140+ }
You can’t perform that action at this time.
0 commit comments