@@ -84,6 +84,8 @@ class Synthesis extends TSynthesis {
8484
8585 predicate functionName ( FunctionBase f , string name ) { none ( ) }
8686
87+ predicate getAnAccess ( VarAccessSynth va , Variable v ) { none ( ) }
88+
8789 predicate memberName ( Member m , string name ) { none ( ) }
8890
8991 predicate typeName ( Type t , string name ) { none ( ) }
@@ -116,13 +118,26 @@ Raw::Ast getRawAst(Ast r) { r = getResultAst(result) }
116118
117119private module ThisSynthesis {
118120 private class ThisSynthesis extends Synthesis {
121+ private predicate thisAccess ( Raw:: Ast parent , ChildIndex i , Child child , Raw:: Scope scope ) {
122+ scope = parent .getScope ( ) and
123+ parent .getChild ( toRawChildIndex ( i ) ) .( Raw:: VarAccess ) .getUserPath ( ) .toLowerCase ( ) = "this" and
124+ child = SynthChild ( VarAccessSynthKind ( TVariableSynth ( scope , ThisVar ( ) ) ) )
125+ }
126+
119127 override predicate child ( Raw:: Ast parent , ChildIndex i , Child child ) {
120128 parent instanceof Raw:: MethodScriptBlock and
121129 i = ThisVar ( ) and
122130 child = SynthChild ( VarSynthKind ( ThisVarKind ( ) ) )
123131 or
124- parent .getChild ( toRawChildIndex ( i ) ) .( Raw:: VarAccess ) .getUserPath ( ) .toLowerCase ( ) = "this" and
125- child = SynthChild ( VarAccessSynthKind ( TVariableSynth ( parent .getScope ( ) , ThisVar ( ) ) ) )
132+ this .thisAccess ( parent , i , child , _)
133+ }
134+
135+ final override predicate getAnAccess ( VarAccessSynth va , Variable v ) {
136+ exists ( Raw:: Ast parent , Raw:: Scope scope , ChildIndex i |
137+ this .thisAccess ( parent , i , _, scope ) and
138+ v = TVariableSynth ( scope , ThisVar ( ) ) and
139+ va = TVarAccessSynth ( parent , i )
140+ )
126141 }
127142
128143 override predicate variableSynthName ( VariableSynth v , string name ) {
@@ -731,18 +746,26 @@ private module IteratorAccessSynth {
731746 )
732747 }
733748
749+ final override predicate getAnAccess ( VarAccessSynth va , Variable v ) {
750+ exists ( Raw:: Ast parent , ChildIndex i , Raw:: VarAccess r |
751+ this .expr ( parent , i , r , _) and
752+ va = TVarAccessSynth ( parent , i ) and
753+ v = this .varAccess ( r )
754+ )
755+ }
756+
734757 override predicate exprStmtExpr ( ExprStmt e , Expr expr ) {
735758 exists ( Raw:: Ast p , Raw:: VarAccess va , Raw:: CmdExpr cmdExpr , ChildIndex i1 , ChildIndex i2 |
736759 this .stmt ( p , i1 , _, _) and
737760 this .expr ( cmdExpr , i2 , va , _) and
738761 e = TExprStmtSynth ( p , i1 ) and
739- expr = TVarAccessSynth ( cmdExpr , i2 , this . varAccess ( va ) )
762+ expr = TVarAccessSynth ( cmdExpr , i2 )
740763 )
741764 }
742765
743766 final override Expr getResultAstImpl ( Raw:: Ast r ) {
744767 exists ( Raw:: Ast parent , ChildIndex i | this .expr ( parent , i , r , _) |
745- result = TVarAccessSynth ( parent , i , this . varAccess ( r ) )
768+ result = TVarAccessSynth ( parent , i )
746769 )
747770 }
748771
0 commit comments