Skip to content

Commit 607f2d6

Browse files
committed
JS: Rename getASelfRef to getAnInstanceRef
1 parent 999f22f commit 607f2d6

File tree

1 file changed

+9
-6
lines changed
  • javascript/ql/lib/semmle/javascript/frameworks

1 file changed

+9
-6
lines changed

javascript/ql/lib/semmle/javascript/frameworks/Vue.qll

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,16 +323,19 @@ module Vue {
323323
result = getAsClassComponent().getAnInstanceMember()
324324
}
325325

326-
/**
327-
* Gets a reference to `this` inside the component, referring to an instance of the component.
328-
*/
329-
DataFlow::SourceNode getASelfRef() { result = getABoundFunction().getReceiver() }
326+
/** Gets an API node referring to an instance of this component. */
327+
API::Node getInstance() {
328+
result.getAnImmediateUse() = getABoundFunction().getReceiver()
329+
}
330+
331+
/** Gets a data flow node referring to an instance of this component. */
332+
DataFlow::SourceNode getAnInstanceRef() { result = getInstance().getAnImmediateUse() }
330333

331334
pragma[noinline]
332335
private DataFlow::PropWrite getAPropertyValueWrite(string name) {
333336
result = getData().getALocalSource().getAPropertyWrite(name)
334337
or
335-
result = getASelfRef().getAPropertyWrite(name)
338+
result = getAnInstanceRef().getAPropertyWrite(name)
336339
}
337340

338341
/**
@@ -548,7 +551,7 @@ module Vue {
548551

549552
pragma[nomagic]
550553
private DataFlow::Node propStepSucc(Component comp, string name) {
551-
result = comp.getASelfRef().getAPropertyRead(name)
554+
result = comp.getAnInstanceRef().getAPropertyRead(name)
552555
}
553556

554557
/**

0 commit comments

Comments
 (0)