Implements binding and evaluating function declarations

This commit is contained in:
2019-06-01 12:33:52 +02:00
parent c407ba2f50
commit 6936b26cae
11 changed files with 215 additions and 10 deletions

View File

@@ -16,6 +16,7 @@ enum class BoundStatementKind{
Block,
Expression,
Assignment,
FunctionDeclaration,
};
class BoundStatement{
@@ -114,4 +115,32 @@ public:
}
};
class BoundFunctionDeclarationStatement : public BoundStatement{
BoundVariableKey* _key;
BoundBlockStatement* _block;
FunctionScriptType* _type;
public:
BoundFunctionDeclarationStatement(FunctionScriptType* type, BoundVariableKey* key, BoundBlockStatement* block){
_key = key;
_block = block;
_type = type;
}
BoundStatementKind GetKind() final{
return BoundStatementKind ::FunctionDeclaration;
}
BoundVariableKey* GetKey(){
return _key;
}
BoundBlockStatement* GetBlock(){
return _block;
}
FunctionScriptType* GetType(){
return _type;
}
};
#endif //PORYGONLANG_BOUNDSTATEMENT_HPP