separate analyze_as_lambda_invocation to 2 function to get captures for lambdas in advance