mirror of
https://github.com/github/codeql.git
synced 2026-04-25 16:55:19 +02:00
JS: Update use of Locations
This commit is contained in:
@@ -1056,11 +1056,7 @@ module DataFlow {
|
||||
|
||||
override StmtContainer getContainer() { result = expr.getContainer() }
|
||||
|
||||
override predicate hasLocationInfo(
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
expr.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
|
||||
}
|
||||
override Location getLocation() { result = expr.getLocation() }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1075,13 +1071,7 @@ module DataFlow {
|
||||
|
||||
override StmtContainer getContainer() { result = constructor }
|
||||
|
||||
override predicate hasLocationInfo(
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
constructor
|
||||
.getLocation()
|
||||
.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
|
||||
}
|
||||
override Location getLocation() { result = constructor.getLocation() }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1403,11 +1393,7 @@ module DataFlow {
|
||||
|
||||
override string toString() { result = "[function self-reference] " + function.toString() }
|
||||
|
||||
override predicate hasLocationInfo(
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
function.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
|
||||
}
|
||||
override Location getLocation() { result = function.getLocation() }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1423,11 +1409,7 @@ module DataFlow {
|
||||
|
||||
override StmtContainer getContainer() { result = expr.getContainer() }
|
||||
|
||||
override predicate hasLocationInfo(
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
expr.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
|
||||
}
|
||||
override Location getLocation() { result = expr.getLocation() }
|
||||
|
||||
override string toString() { result = "[post update] " + expr.toString() }
|
||||
}
|
||||
|
||||
@@ -59,12 +59,6 @@ class CaptureNode extends DataFlow::Node, TSynthCaptureNode {
|
||||
|
||||
cached
|
||||
private Location getLocation() { result = this.getNode().getLocation() }
|
||||
|
||||
override predicate hasLocationInfo(
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
|
||||
}
|
||||
}
|
||||
|
||||
class GenericSynthesizedNode extends DataFlow::Node, TGenericSynthesizedNode {
|
||||
@@ -78,11 +72,7 @@ class GenericSynthesizedNode extends DataFlow::Node, TGenericSynthesizedNode {
|
||||
|
||||
override string toString() { result = "[synthetic node] " + tag }
|
||||
|
||||
override predicate hasLocationInfo(
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
node.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
|
||||
}
|
||||
override Location getLocation() { result = node.getLocation() }
|
||||
|
||||
string getTag() { result = tag }
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ private import semmle.javascript.dataflow.internal.DataFlowNode
|
||||
private import codeql.dataflow.VariableCapture
|
||||
private import semmle.javascript.dataflow.internal.sharedlib.DataFlowImplCommon as DataFlowImplCommon
|
||||
|
||||
module VariableCaptureConfig implements InputSig<js::Location> {
|
||||
module VariableCaptureConfig implements InputSig<js::DbLocation> {
|
||||
private js::Function getLambdaFromVariable(js::LocalVariable variable) {
|
||||
result.getVariable() = variable
|
||||
or
|
||||
@@ -185,7 +185,7 @@ module VariableCaptureConfig implements InputSig<js::Location> {
|
||||
|
||||
string toString() { none() } // Overridden in subclass
|
||||
|
||||
js::Location getLocation() { none() } // Overridden in subclass
|
||||
js::DbLocation getLocation() { none() } // Overridden in subclass
|
||||
|
||||
predicate hasCfgNode(BasicBlock bb, int i) { none() } // Overridden in subclass
|
||||
|
||||
@@ -203,7 +203,7 @@ module VariableCaptureConfig implements InputSig<js::Location> {
|
||||
override string toString() { result = pattern.toString() }
|
||||
|
||||
/** Gets the location of this write. */
|
||||
override js::Location getLocation() { result = pattern.getLocation() }
|
||||
override js::DbLocation getLocation() { result = pattern.getLocation() }
|
||||
|
||||
override js::DataFlow::Node getSource() {
|
||||
// Note: there is not always an expression corresponding to the RHS of the assignment.
|
||||
@@ -239,7 +239,7 @@ module VariableCaptureConfig implements InputSig<js::Location> {
|
||||
|
||||
override string toString() { result = "[implicit init] " + variable }
|
||||
|
||||
override js::Location getLocation() { result = variable.getLocation() }
|
||||
override js::DbLocation getLocation() { result = variable.getLocation() }
|
||||
|
||||
override CapturedVariable getVariable() { result = variable }
|
||||
|
||||
@@ -259,7 +259,7 @@ module VariableCaptureConfig implements InputSig<js::Location> {
|
||||
predicate exitBlock(BasicBlock bb) { bb.getLastNode() instanceof js::ControlFlowExitNode }
|
||||
}
|
||||
|
||||
module VariableCaptureOutput = Flow<js::Location, VariableCaptureConfig>;
|
||||
module VariableCaptureOutput = Flow<js::DbLocation, VariableCaptureConfig>;
|
||||
|
||||
js::DataFlow::Node getNodeFromClosureNode(VariableCaptureOutput::ClosureNode node) {
|
||||
result = TValueNode(node.(VariableCaptureOutput::ExprNode).getExpr())
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
private import semmle.javascript.Locations
|
||||
private import codeql.dataflow.DataFlow
|
||||
private import DataFlowArg
|
||||
import DataFlowMake<JSDataFlow>
|
||||
import DataFlowMake<Location, JSDataFlow>
|
||||
import DataFlowImplSpecific::Public
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
private import semmle.javascript.Locations
|
||||
private import DataFlowImplSpecific
|
||||
private import codeql.dataflow.DataFlow as SharedDataFlow
|
||||
private import codeql.dataflow.TaintTracking as SharedTaintTracking
|
||||
|
||||
module JSDataFlow implements SharedDataFlow::InputSig {
|
||||
module JSDataFlow implements SharedDataFlow::InputSig<Location> {
|
||||
import Private
|
||||
import Public
|
||||
|
||||
@@ -16,6 +17,6 @@ module JSDataFlow implements SharedDataFlow::InputSig {
|
||||
predicate viableImplInCallContext = Private::viableImplInCallContext/2;
|
||||
}
|
||||
|
||||
module JSTaintFlow implements SharedTaintTracking::InputSig<JSDataFlow> {
|
||||
module JSTaintFlow implements SharedTaintTracking::InputSig<Location, JSDataFlow> {
|
||||
import semmle.javascript.dataflow.internal.TaintTrackingPrivate
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
private import semmle.javascript.Locations
|
||||
private import codeql.dataflow.internal.DataFlowImpl
|
||||
private import DataFlowArg
|
||||
import MakeImpl<JSDataFlow>
|
||||
import MakeImpl<Location, JSDataFlow>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
private import semmle.javascript.Locations
|
||||
private import DataFlowArg
|
||||
private import codeql.dataflow.internal.DataFlowImplCommon
|
||||
import MakeImplCommon<JSDataFlow>
|
||||
import MakeImplCommon<Location, JSDataFlow>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
private import semmle.javascript.Locations
|
||||
private import codeql.dataflow.TaintTracking
|
||||
private import DataFlowArg
|
||||
import TaintFlowMake<JSDataFlow, JSTaintFlow>
|
||||
import TaintFlowMake<Location, JSDataFlow, JSTaintFlow>
|
||||
|
||||
Reference in New Issue
Block a user