@@ -37,7 +37,7 @@ abstract class LibraryCallable extends string {
3737 LibraryCallable ( ) { any ( ) }
3838
3939 /** Gets a call to this library callable. */
40- Cmd getACall ( ) { none ( ) }
40+ Call getACall ( ) { none ( ) }
4141}
4242
4343/**
@@ -222,7 +222,8 @@ private module Cached {
222222
223223 cached
224224 newtype TArgumentPosition =
225- TKeywordArgumentPosition ( string name ) { name = any ( CmdParameter p ) .getName ( ) } or
225+ TThisArgumentPosition ( ) or
226+ TKeywordArgumentPosition ( string name ) { name = any ( Argument p ) .getName ( ) } or
226227 TPositionalArgumentPosition ( int pos , NamedSet ns ) {
227228 exists ( CfgNodes:: CallCfgNode call |
228229 call = ns .getABindingCall ( ) and
@@ -232,7 +233,8 @@ private module Cached {
232233
233234 cached
234235 newtype TParameterPosition =
235- TKeywordParameter ( string name ) { name = any ( CmdParameter p ) .getName ( ) } or
236+ TThisParameterPosition ( ) or
237+ TKeywordParameter ( string name ) { name = any ( Argument p ) .getName ( ) } or
236238 TPositionalParameter ( int pos , NamedSet ns ) {
237239 exists ( CfgNodes:: CallCfgNode call |
238240 call = ns .getABindingCall ( ) and
@@ -245,6 +247,9 @@ import Cached
245247
246248/** A parameter position. */
247249class ParameterPosition extends TParameterPosition {
250+ /** Holds if this position represents a `this` parameter. */
251+ predicate isThis ( ) { this = TThisParameterPosition ( ) }
252+
248253 /**
249254 * Holds if this position represents a positional parameter at position `pos`
250255 * with function is called with exactly the named parameters from the set `ns`
@@ -256,6 +261,8 @@ class ParameterPosition extends TParameterPosition {
256261
257262 /** Gets a textual representation of this position. */
258263 string toString ( ) {
264+ this .isThis ( ) and result = "this"
265+ or
259266 exists ( int pos , NamedSet ns |
260267 this .isPositional ( pos , ns ) and result = "pos(" + pos + ", " + ns .toString ( ) + ")"
261268 )
@@ -266,13 +273,18 @@ class ParameterPosition extends TParameterPosition {
266273
267274/** An argument position. */
268275class ArgumentPosition extends TArgumentPosition {
276+ /** Holds if this position represents a `this` argument. */
277+ predicate isThis ( ) { this = TThisArgumentPosition ( ) }
278+
269279 /** Holds if this position represents a positional argument at position `pos`. */
270280 predicate isPositional ( int pos , NamedSet ns ) { this = TPositionalArgumentPosition ( pos , ns ) }
271281
272282 predicate isKeyword ( string name ) { this = TKeywordArgumentPosition ( name ) }
273283
274284 /** Gets a textual representation of this position. */
275285 string toString ( ) {
286+ this .isThis ( ) and result = "this"
287+ or
276288 exists ( int pos , NamedSet ns |
277289 this .isPositional ( pos , ns ) and result = "pos(" + pos + ", " + ns .toString ( ) + ")"
278290 )
@@ -284,6 +296,8 @@ class ArgumentPosition extends TArgumentPosition {
284296/** Holds if arguments at position `apos` match parameters at position `ppos`. */
285297pragma [ nomagic]
286298predicate parameterMatch ( ParameterPosition ppos , ArgumentPosition apos ) {
299+ ppos .isThis ( ) and apos .isThis ( )
300+ or
287301 exists ( string name |
288302 ppos .isKeyword ( name ) and
289303 apos .isKeyword ( name )
0 commit comments