@@ -895,11 +895,11 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
895895 or
896896 result = this .asLambdaInstancePostUpdateNode ( ) .toString ( ) + " [LambdaPostUpdate]"
897897 or
898- exists ( DataFlowCall synthcall , ArgumentPosition apos , boolean isPost |
899- this .isLambdaArgNode ( synthcall , apos , isPost )
898+ exists ( DataFlowCall synthCall , ArgumentPosition apos , boolean isPost |
899+ this .isLambdaArgNode ( synthCall , apos , isPost )
900900 |
901901 result =
902- synthcall .toString ( ) + "-" + apos .toString ( ) + "-" + isPost .toString ( ) + " [LambdaArg]"
902+ synthCall .toString ( ) + "-" + apos .toString ( ) + "-" + isPost .toString ( ) + " [LambdaArg]"
903903 )
904904 }
905905
@@ -918,8 +918,8 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
918918
919919 Node asLambdaArgsNode ( ) { this = TNodeLambdaArgs ( result ) }
920920
921- predicate isLambdaArgNode ( DataFlowCall synthcall , ArgumentPosition apos , boolean isPost ) {
922- this = TNodeLambdaArg ( synthcall , apos , isPost )
921+ predicate isLambdaArgNode ( DataFlowCall synthCall , ArgumentPosition apos , boolean isPost ) {
922+ this = TNodeLambdaArg ( synthCall , apos , isPost )
923923 }
924924
925925 Node projectToNode ( ) {
@@ -935,9 +935,9 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
935935 or
936936 this = TNodeLambdaArgs ( result )
937937 or
938- exists ( DataFlowCall synthcall |
939- this = TNodeLambdaArg ( synthcall , _, _) and
940- lambdaCreation ( result , _, _, synthcall )
938+ exists ( DataFlowCall synthCall |
939+ this = TNodeLambdaArg ( synthCall , _, _) and
940+ lambdaCreation ( result , _, _, synthCall )
941941 )
942942 }
943943
@@ -964,11 +964,11 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
964964 nodeDataFlowType ( this .asLambdaArgsNode ( ) , result )
965965 or
966966 exists (
967- DataFlowCall synthcall , ArgumentPosition apos , DataFlowCallable c , ParameterNode p ,
967+ DataFlowCall synthCall , ArgumentPosition apos , DataFlowCallable c , ParameterNode p ,
968968 ParameterPosition ppos
969969 |
970- this .isLambdaArgNode ( synthcall , apos , _) and
971- lambdaCreation ( _, _, c , synthcall ) and
970+ this .isLambdaArgNode ( synthCall , apos , _) and
971+ lambdaCreation ( _, _, c , synthCall ) and
972972 isParameterNode ( p , c , ppos ) and
973973 parameterMatch ( ppos , apos ) and
974974 nodeDataFlowType ( p , result )
@@ -1049,9 +1049,11 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
10491049 or
10501050 pre .asNode ( ) = this .asLambdaInstancePostUpdateNode ( )
10511051 or
1052- exists ( DataFlowCall synthcall , ArgumentPosition apos |
1053- this .isLambdaArgNode ( synthcall , apos , true ) and
1054- pre .isLambdaArgNode ( synthcall , apos , false )
1052+ // Every argument in the synthetic call has a post update node
1053+ // corresponding to the argument node.
1054+ exists ( DataFlowCall synthCall , ArgumentPosition apos |
1055+ this .isLambdaArgNode ( synthCall , apos , true ) and
1056+ pre .isLambdaArgNode ( synthCall , apos , false )
10551057 )
10561058 or
10571059 pre .asLambdaMallocNode ( ) = this .asNode ( )
@@ -1801,12 +1803,12 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
18011803 or
18021804 //read step from malloc to args
18031805 //lambdaCreation(Node creation, LambdaCallKind kind, DataFlowCallable c, DataFlowCall synthCall)
1804- exists ( Node lambda , DataFlowCall synthcall , LambdaCallKind k , ArgumentPosition apos |
1805- lambdaCreation ( lambda , k , _, synthcall ) and
1806+ exists ( Node lambda , DataFlowCall synthCall , LambdaCallKind k , ArgumentPosition apos |
1807+ lambdaCreation ( lambda , k , _, synthCall ) and
18061808 lambda = node1 .asLambdaArgsNode ( ) and
18071809 c .getAReadContent ( ) = getLambdaArgumentContent ( k , apos )
18081810 |
1809- node2 .isLambdaArgNode ( synthcall , apos , false )
1811+ node2 .isLambdaArgNode ( synthCall , apos , false )
18101812 or
18111813 node2 .asLambdaMallocNode ( ) = lambda and
18121814 node2 .( ArgNodeEx ) .argumentOf ( _, apos )
@@ -1853,24 +1855,30 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
18531855 contentType = node1 .getDataFlowType ( ) and
18541856 containerType = node2 .getDataFlowType ( ) and
18551857 (
1856- exists ( DataFlowCall call , LambdaCallKind k , Node receiver , ArgumentPosition apos |
1858+ // Arguments in a call to a lambda write to the receiving node at the
1859+ // `Content` corresponding to the argument position.
1860+ exists ( DataFlowCall call , LambdaCallKind k , Node receiver , ArgumentPosition pos |
18571861 lambdaCall ( call , k , receiver ) and
1858- node2 .asNode ( ) .( PostUpdateNode ) . getPreUpdateNode ( ) = receiver and
1859- c = getLambdaArgumentContent ( k , apos ) and
1860- node1 .asNode ( ) .( ArgNode ) . argumentOf ( call , apos )
1862+ node1 .asNode ( ) .( ArgNode ) . argumentOf ( call , pos ) and
1863+ c = getLambdaArgumentContent ( k , pos ) and
1864+ node2 .asNode ( ) .( PostUpdateNode ) . getPreUpdateNode ( ) = receiver
18611865 )
18621866 or
1867+ // Simple returns in a lambda write to the post node for the
1868+ // lambda instance argument.
18631869 exists ( DataFlowCallable lambda , LambdaCallKind k , ReturnKind kind |
18641870 lambdaCreation ( _, k , lambda , _) and
18651871 hasSimpleReturnKindIn ( node1 .asNode ( ) , kind , lambda ) and
18661872 nodeGetEnclosingCallable ( node2 .asLambdaInstancePostUpdateNode ( ) ) = lambda and
18671873 c = getLambdaReturnContent ( k , kind )
18681874 )
18691875 or
1870- exists ( DataFlowCall synthcall , LambdaCallKind k , ArgumentPosition apos |
1871- lambdaCreation ( node2 .asNode ( ) , k , _, synthcall ) and
1872- node1 .isLambdaArgNode ( synthcall , apos , true ) and
1873- c = getLambdaArgumentContent ( k , apos )
1876+ // Argument nodes to a synthetic call node for a lamda write to the
1877+ // lambda at the `Content` corresponding to the argument position.
1878+ exists ( DataFlowCall synthCall , LambdaCallKind k , ArgumentPosition pos |
1879+ lambdaCreation ( node2 .asNode ( ) , k , _, synthCall ) and
1880+ node1 .isLambdaArgNode ( synthCall , pos , true ) and
1881+ c = getLambdaArgumentContent ( k , pos )
18741882 )
18751883 )
18761884 }
@@ -2049,9 +2057,9 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
20492057 TNodeLambdaInstancePostUpdate ( ParameterNode pre ) { isLambdaInstanceParameter ( pre ) } or
20502058 TNodeLambdaMalloc ( Node lambda ) { lambdaCreation ( lambda , _, _, _) } or
20512059 TNodeLambdaArgs ( Node lambda ) { lambdaCreation ( lambda , _, _, _) } or
2052- TNodeLambdaArg ( DataFlowCall synthcall , ArgumentPosition apos , Boolean ispost ) {
2060+ TNodeLambdaArg ( DataFlowCall synthCall , ArgumentPosition apos , Boolean ispost ) {
20532061 exists ( DataFlowCallable c , ParameterNode p , ParameterPosition ppos |
2054- lambdaCreation ( _, _, c , synthcall ) and
2062+ lambdaCreation ( _, _, c , synthCall ) and
20552063 isParameterNode ( p , c , ppos ) and
20562064 parameterMatch ( ppos , apos ) and
20572065 not isLambdaInstanceParameter ( p ) and
0 commit comments