@@ -995,6 +995,30 @@ private class InstanceCallable extends Callable {
995995 Location getARelevantLocation ( ) { result = l }
996996}
997997
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+
9981022/** A collection of cached types and predicates to be evaluated in the same stage. */
9991023cached
10001024private module Cached {
@@ -1018,8 +1042,13 @@ private module Cached {
10181042 TAssignableDefinitionNode ( AssignableDefinition def , ControlFlow:: Node cfn ) {
10191043 cfn = def .getExpr ( ) .getAControlFlowNode ( )
10201044 } 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
10231052 TDelegateSelfReferenceNode ( Callable c ) { lambdaCreationExpr ( _, c ) } or
10241053 TLocalFunctionCreationNode ( ControlFlow:: Nodes:: ElementNode cfn , Boolean isPostUpdate ) {
10251054 cfn .getAstNode ( ) instanceof LocalFunctionStmt
@@ -1055,11 +1084,13 @@ private module Cached {
10551084 or
10561085 lambdaCallExpr ( _, cfn )
10571086 } or
1058- TFlowSummaryNode ( FlowSummaryImpl:: Private:: SummaryNode sn ) or
1087+ TFlowSummaryNode ( FlowSummaryImpl:: Private:: SummaryNode sn ) {
1088+ sn .getSummarizedCallable ( ) instanceof CallableUsedInSource
1089+ } or
10591090 TParamsArgumentNode ( ControlFlow:: Node callCfn ) {
10601091 callCfn = any ( Call c | isParamsArg ( c , _, _) ) .getAControlFlowNode ( )
10611092 } or
1062- TFlowInsensitiveFieldNode ( FieldOrProperty f ) { f .isFieldLike ( ) } or
1093+ TFlowInsensitiveFieldNode ( FieldOrPropertyUsedInSource f ) { f .isFieldLike ( ) } or
10631094 TFlowInsensitiveCapturedVariableNode ( LocalScopeVariable v ) { v .isCaptured ( ) } or
10641095 TInstanceParameterAccessNode ( ControlFlow:: Node cfn , Boolean isPostUpdate ) {
10651096 cfn = getAPrimaryConstructorParameterCfn ( _)
0 commit comments