mirror of
https://github.com/github/codeql.git
synced 2026-04-25 16:55:19 +02:00
fix performance by caching getArgument
This commit is contained in:
@@ -92,13 +92,20 @@ class InvokeNode extends DataFlow::SourceNode instanceof DataFlow::Impl::InvokeN
|
||||
* but the position of `z` cannot be determined, hence there are no first and second
|
||||
* argument nodes.
|
||||
*/
|
||||
DataFlow::Node getArgument(int i) { result = super.getArgument(i) }
|
||||
cached
|
||||
DataFlow::Node getArgument(int i) {
|
||||
result = super.getArgument(i) and Stages::DataFlowStage::ref()
|
||||
}
|
||||
|
||||
/** Gets the data flow node corresponding to an argument of this invocation. */
|
||||
DataFlow::Node getAnArgument() { result = super.getAnArgument() }
|
||||
cached
|
||||
DataFlow::Node getAnArgument() { result = super.getAnArgument() and Stages::DataFlowStage::ref() }
|
||||
|
||||
/** Gets the data flow node corresponding to the last argument of this invocation. */
|
||||
DataFlow::Node getLastArgument() { result = this.getArgument(this.getNumArgument() - 1) }
|
||||
cached
|
||||
DataFlow::Node getLastArgument() {
|
||||
result = this.getArgument(this.getNumArgument() - 1) and Stages::DataFlowStage::ref()
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a data flow node corresponding to an array of values being passed as
|
||||
|
||||
@@ -145,6 +145,12 @@ module Stages {
|
||||
exists(any(DataFlow::PropRef ref).getBase())
|
||||
or
|
||||
exists(any(DataFlow::ClassNode cls))
|
||||
or
|
||||
exists(any(DataFlow::CallNode node).getArgument(_))
|
||||
or
|
||||
exists(any(DataFlow::CallNode node).getAnArgument())
|
||||
or
|
||||
exists(any(DataFlow::CallNode node).getLastArgument())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user