forked from xkbeyer/liquid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FunctionDeclaration.h
34 lines (32 loc) · 1.24 KB
/
FunctionDeclaration.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef FUNCTION_DECLARATION_H
#define FUNCTION_DECLARATION_H
#include "AstNode.h"
namespace liquid {
class FunctionDeclaration : public Statement
{
friend class ClassDeclaration;
Identifier* type;
Identifier* id;
VariableList* arguments;
Block* block;
YYLTYPE location;
public:
FunctionDeclaration( Identifier* type, Identifier* id, VariableList* arguments, Block* block, YYLTYPE loc )
: type( type ), id( id ), arguments( arguments ), block( block ), location( loc )
{}
FunctionDeclaration( Identifier* id, VariableList* arguments, Block* block, YYLTYPE loc )
: type(new Identifier("var", loc)), id(id), arguments(arguments), block(block), location(loc)
{}
virtual ~FunctionDeclaration();
virtual llvm::Value* codeGen( CodeGenContext& context );
NodeType getType() { return NodeType::function; }
Identifier* getId() { return id; }
virtual std::string toString();
virtual void Accept( Visitor& v ) { v.VisitFunctionDeclaration( this ); }
virtual VariableList* getParameter() { return arguments; }
virtual Block* getBody() { return block; }
virtual Identifier* getRetType() { return type; }
YYLTYPE getlocation() { return location; }
};
}
#endif // FUNCTION_DECLARATION_H