@@ -995,6 +995,30 @@ private class InstanceCallable extends Callable {
995
995
Location getARelevantLocation ( ) { result = l }
996
996
}
997
997
998
+ /**
999
+ * A callable which is either itself defined in source or which is the target
1000
+ * of some call in source, and therefore ought to have dataflow nodes created.
1001
+ */
1002
+ private class CallableUsedInSource extends Callable {
1003
+ CallableUsedInSource ( ) {
1004
+ this .fromSource ( )
1005
+ or
1006
+ this .getACall ( ) .fromSource ( )
1007
+ }
1008
+ }
1009
+
1010
+ /**
1011
+ * A field or property which is either itself defined in source or which is the target
1012
+ * of some access in source, and therefore ought to have dataflow nodes created.
1013
+ */
1014
+ private class FieldOrPropertyUsedInSource extends FieldOrProperty {
1015
+ FieldOrPropertyUsedInSource ( ) {
1016
+ this .fromSource ( )
1017
+ or
1018
+ this .getAnAccess ( ) .fromSource ( )
1019
+ }
1020
+ }
1021
+
998
1022
/** A collection of cached types and predicates to be evaluated in the same stage. */
999
1023
cached
1000
1024
private module Cached {
@@ -1018,8 +1042,13 @@ private module Cached {
1018
1042
TAssignableDefinitionNode ( AssignableDefinition def , ControlFlow:: Node cfn ) {
1019
1043
cfn = def .getExpr ( ) .getAControlFlowNode ( )
1020
1044
} or
1021
- TExplicitParameterNode ( Parameter p , DataFlowCallable c ) { p = c .asCallable ( _) .getAParameter ( ) } or
1022
- TInstanceParameterNode ( InstanceCallable c , Location l ) { l = c .getARelevantLocation ( ) } or
1045
+ TExplicitParameterNode ( Parameter p , DataFlowCallable c ) {
1046
+ p = c .asCallable ( _) .( CallableUsedInSource ) .getAParameter ( )
1047
+ } or
1048
+ TInstanceParameterNode ( InstanceCallable c , Location l ) {
1049
+ c instanceof CallableUsedInSource and
1050
+ l = c .getARelevantLocation ( )
1051
+ } or
1023
1052
TDelegateSelfReferenceNode ( Callable c ) { lambdaCreationExpr ( _, c ) } or
1024
1053
TLocalFunctionCreationNode ( ControlFlow:: Nodes:: ElementNode cfn , Boolean isPostUpdate ) {
1025
1054
cfn .getAstNode ( ) instanceof LocalFunctionStmt
@@ -1055,11 +1084,13 @@ private module Cached {
1055
1084
or
1056
1085
lambdaCallExpr ( _, cfn )
1057
1086
} or
1058
- TFlowSummaryNode ( FlowSummaryImpl:: Private:: SummaryNode sn ) or
1087
+ TFlowSummaryNode ( FlowSummaryImpl:: Private:: SummaryNode sn ) {
1088
+ sn .getSummarizedCallable ( ) instanceof CallableUsedInSource
1089
+ } or
1059
1090
TParamsArgumentNode ( ControlFlow:: Node callCfn ) {
1060
1091
callCfn = any ( Call c | isParamsArg ( c , _, _) ) .getAControlFlowNode ( )
1061
1092
} or
1062
- TFlowInsensitiveFieldNode ( FieldOrProperty f ) { f .isFieldLike ( ) } or
1093
+ TFlowInsensitiveFieldNode ( FieldOrPropertyUsedInSource f ) { f .isFieldLike ( ) } or
1063
1094
TFlowInsensitiveCapturedVariableNode ( LocalScopeVariable v ) { v .isCaptured ( ) } or
1064
1095
TInstanceParameterAccessNode ( ControlFlow:: Node cfn , Boolean isPostUpdate ) {
1065
1096
cfn = getAPrimaryConstructorParameterCfn ( _)
0 commit comments