#pragma once #include #include #include #include namespace Fig::Ast { class FunctionLiteralExprAst final : public ExpressionAst { public: FunctionParameters paras; std::variant body; FunctionLiteralExprAst(FunctionParameters _paras, BlockStatement _body) : paras(std::move(_paras)), body(std::move(_body)) { type = AstType::FunctionLiteralExpr; } FunctionLiteralExprAst(FunctionParameters _paras, Expression _exprBody) : paras(std::move(_paras)), body(std::move(_exprBody)) { type = AstType::FunctionLiteralExpr; } bool isExprMode() const { return std::holds_alternative(body); } BlockStatement &getBlockBody() { return std::get(body); } Expression &getExprBody() { return std::get(body); } ~FunctionLiteralExprAst() = default; }; using FunctionLiteralExpr = std::shared_ptr; } // namespace Fig::Ast