@@ -895,11 +895,11 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
895
895
or
896
896
result = this .asLambdaInstancePostUpdateNode ( ) .toString ( ) + " [LambdaPostUpdate]"
897
897
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 )
900
900
|
901
901
result =
902
- synthcall .toString ( ) + "-" + apos .toString ( ) + "-" + isPost .toString ( ) + " [LambdaArg]"
902
+ synthCall .toString ( ) + "-" + apos .toString ( ) + "-" + isPost .toString ( ) + " [LambdaArg]"
903
903
)
904
904
}
905
905
@@ -918,8 +918,8 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
918
918
919
919
Node asLambdaArgsNode ( ) { this = TNodeLambdaArgs ( result ) }
920
920
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 )
923
923
}
924
924
925
925
Node projectToNode ( ) {
@@ -935,9 +935,9 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
935
935
or
936
936
this = TNodeLambdaArgs ( result )
937
937
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 )
941
941
)
942
942
}
943
943
@@ -964,11 +964,11 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
964
964
nodeDataFlowType ( this .asLambdaArgsNode ( ) , result )
965
965
or
966
966
exists (
967
- DataFlowCall synthcall , ArgumentPosition apos , DataFlowCallable c , ParameterNode p ,
967
+ DataFlowCall synthCall , ArgumentPosition apos , DataFlowCallable c , ParameterNode p ,
968
968
ParameterPosition ppos
969
969
|
970
- this .isLambdaArgNode ( synthcall , apos , _) and
971
- lambdaCreation ( _, _, c , synthcall ) and
970
+ this .isLambdaArgNode ( synthCall , apos , _) and
971
+ lambdaCreation ( _, _, c , synthCall ) and
972
972
isParameterNode ( p , c , ppos ) and
973
973
parameterMatch ( ppos , apos ) and
974
974
nodeDataFlowType ( p , result )
@@ -1049,9 +1049,11 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
1049
1049
or
1050
1050
pre .asNode ( ) = this .asLambdaInstancePostUpdateNode ( )
1051
1051
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 )
1055
1057
)
1056
1058
or
1057
1059
pre .asLambdaMallocNode ( ) = this .asNode ( )
@@ -1801,12 +1803,12 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
1801
1803
or
1802
1804
//read step from malloc to args
1803
1805
//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
1806
1808
lambda = node1 .asLambdaArgsNode ( ) and
1807
1809
c .getAReadContent ( ) = getLambdaArgumentContent ( k , apos )
1808
1810
|
1809
- node2 .isLambdaArgNode ( synthcall , apos , false )
1811
+ node2 .isLambdaArgNode ( synthCall , apos , false )
1810
1812
or
1811
1813
node2 .asLambdaMallocNode ( ) = lambda and
1812
1814
node2 .( ArgNodeEx ) .argumentOf ( _, apos )
@@ -1853,24 +1855,30 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
1853
1855
contentType = node1 .getDataFlowType ( ) and
1854
1856
containerType = node2 .getDataFlowType ( ) and
1855
1857
(
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 |
1857
1861
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
1861
1865
)
1862
1866
or
1867
+ // Simple returns in a lambda write to the post node for the
1868
+ // lambda instance argument.
1863
1869
exists ( DataFlowCallable lambda , LambdaCallKind k , ReturnKind kind |
1864
1870
lambdaCreation ( _, k , lambda , _) and
1865
1871
hasSimpleReturnKindIn ( node1 .asNode ( ) , kind , lambda ) and
1866
1872
nodeGetEnclosingCallable ( node2 .asLambdaInstancePostUpdateNode ( ) ) = lambda and
1867
1873
c = getLambdaReturnContent ( k , kind )
1868
1874
)
1869
1875
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 )
1874
1882
)
1875
1883
)
1876
1884
}
@@ -2049,9 +2057,9 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
2049
2057
TNodeLambdaInstancePostUpdate ( ParameterNode pre ) { isLambdaInstanceParameter ( pre ) } or
2050
2058
TNodeLambdaMalloc ( Node lambda ) { lambdaCreation ( lambda , _, _, _) } or
2051
2059
TNodeLambdaArgs ( Node lambda ) { lambdaCreation ( lambda , _, _, _) } or
2052
- TNodeLambdaArg ( DataFlowCall synthcall , ArgumentPosition apos , Boolean ispost ) {
2060
+ TNodeLambdaArg ( DataFlowCall synthCall , ArgumentPosition apos , Boolean ispost ) {
2053
2061
exists ( DataFlowCallable c , ParameterNode p , ParameterPosition ppos |
2054
- lambdaCreation ( _, _, c , synthcall ) and
2062
+ lambdaCreation ( _, _, c , synthCall ) and
2055
2063
isParameterNode ( p , c , ppos ) and
2056
2064
parameterMatch ( ppos , apos ) and
2057
2065
not isLambdaInstanceParameter ( p ) and
0 commit comments