JS: cache things

This commit is contained in:
Asger F
2019-07-31 12:44:41 +01:00
parent 313579c258
commit 96d9e66ced
2 changed files with 4 additions and 0 deletions

View File

@@ -41,6 +41,7 @@ module GlobalAccessPath {
* })(NS = NS || {});
* ```
*/
cached
string fromReference(DataFlow::Node node) {
result = fromReference(node.getImmediatePredecessor())
or
@@ -142,6 +143,7 @@ module GlobalAccessPath {
* })(foo = foo || {});
* ```
*/
cached
string fromRhs(DataFlow::Node node) {
exists(DataFlow::SourceNode base, string baseName, string name |
node = base.getAPropertyWrite(name).getRhs() and

View File

@@ -693,6 +693,7 @@ class ClassNode extends DataFlow::SourceNode {
/**
* Gets a dataflow node that refers to this class object.
*/
cached
DataFlow::SourceNode getAClassReference() {
result = getAClassReference(DataFlow::TypeTracker::end())
}
@@ -730,6 +731,7 @@ class ClassNode extends DataFlow::SourceNode {
/**
* Gets a dataflow node that refers to an instance of this class.
*/
cached
DataFlow::SourceNode getAnInstanceReference() {
result = getAnInstanceReference(DataFlow::TypeTracker::end())
}