2017-01-14 05:19:48 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <DB/Parsers/IAST.h>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class WriteBuffer;
|
|
|
|
|
|
|
|
|
|
|
|
/** For every lambda expression, rename its parameters to '_lambda0_arg0' form.
|
|
|
|
* Check correctness of lambda expressions.
|
|
|
|
* Find functions, that have lambda expressions as arguments (they are called "higher order" functions).
|
|
|
|
*
|
|
|
|
* This should be done before CollectAliases.
|
|
|
|
*/
|
|
|
|
struct AnalyzeLambdas
|
|
|
|
{
|
|
|
|
void process(ASTPtr & ast);
|
|
|
|
|
2017-01-14 07:19:47 +00:00
|
|
|
/// Parameters of lambda expressions.
|
|
|
|
using LambdaParameters = std::vector<String>;
|
|
|
|
static LambdaParameters extractLambdaParameters(ASTPtr & ast);
|
|
|
|
|
|
|
|
|
2017-01-14 05:19:48 +00:00
|
|
|
using HigherOrderFunctions = std::vector<ASTPtr>;
|
|
|
|
HigherOrderFunctions higher_order_functions;
|
|
|
|
|
|
|
|
/// Debug output
|
|
|
|
void dump(WriteBuffer & out) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|