mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
JS: Cache PropRef.getBase
This commit is contained in:
@@ -492,6 +492,7 @@ module DataFlow {
|
||||
* Gets the data flow node corresponding to the base object
|
||||
* whose property is read from or written to.
|
||||
*/
|
||||
cached
|
||||
abstract Node getBase();
|
||||
|
||||
/**
|
||||
@@ -595,7 +596,10 @@ module DataFlow {
|
||||
|
||||
PropLValueAsPropWrite() { astNode instanceof LValue }
|
||||
|
||||
override Node getBase() { result = valueNode(astNode.getBase()) }
|
||||
override Node getBase() {
|
||||
result = valueNode(astNode.getBase()) and
|
||||
Stages::DataFlowStage::ref()
|
||||
}
|
||||
|
||||
override Expr getPropertyNameExpr() { result = astNode.getPropertyNameExpr() }
|
||||
|
||||
|
||||
@@ -133,6 +133,8 @@ module Stages {
|
||||
exists(any(DataFlow::Node node).toString())
|
||||
or
|
||||
exists(any(AccessPath a).getAnInstanceIn(_))
|
||||
or
|
||||
exists(any(DataFlow::PropRef ref).getBase())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user