Address review comments

This commit is contained in:
Tom Hvitved
2026-04-07 11:38:48 +02:00
parent 1e1a8732a3
commit 0d4524f8f3
4 changed files with 9 additions and 5 deletions

View File

@@ -30,5 +30,7 @@ module CsharpDataFlow implements InputSig<Location> {
exists(n.(AssignableDefinitionNode).getDefinition().getTargetAccess())
}
DataFlowType getSourceContextParameterNodeType() { result.isSourceContextParameterType() }
DataFlowType getSourceContextParameterNodeType(Node p) {
exists(p) and result.isSourceContextParameterType()
}
}

View File

@@ -2526,6 +2526,8 @@ predicate typeStrongerThan(DataFlowType t1, DataFlowType t2) {
uselessTypebound(t2)
or
compatibleTypesDelegateLeft(t1, t2)
or
compatibleTypesSourceContextParameterTypeLeft(t1, t2)
}
/**

View File

@@ -64,7 +64,7 @@ signature module InputSig<LocationSig Location> {
DataFlowType getNodeType(Node node);
/**
* Gets a special type to use for parameter nodes belonging to callables with a
* Gets a special type to use for parameter node `p` belonging to callables with a
* source node where a source call context `FlowFeature` is used, if any.
*
* This can be used to prevent lambdas from being resolved, when a concrete call
@@ -90,7 +90,7 @@ signature module InputSig<LocationSig Location> {
* prevent the call edge from (1) to (4). Note that the call edge from (3) to (2)
* will still be valid.
*/
default DataFlowType getSourceContextParameterNodeType() { none() }
default DataFlowType getSourceContextParameterNodeType(Node p) { none() }
predicate nodeIsHidden(Node node);

View File

@@ -2117,8 +2117,8 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
private predicate typeFlowParamType(ParamNode p, Type t, boolean cc) {
exists(Callable c |
Input::dataFlowNonCallEntry(c, cc) and
if cc = true and exists(getSourceContextParameterNodeType())
then t = getSourceContextParameterNodeType()
if cc = true and exists(getSourceContextParameterNodeType(p))
then t = getSourceContextParameterNodeType(p)
else trackedParamWithType(p, t, c)
)
or