Handle bound classes as constants during evaluation
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-06-13 17:12:46 +02:00
parent 1cb65f17c9
commit 10a2535c96
12 changed files with 225 additions and 204 deletions

View File

@@ -1,3 +1,5 @@
#include <utility>
#ifndef PORYGONLANG_BOUNDFUNCTIONDECLARATIONSTATEMENT_HPP
#define PORYGONLANG_BOUNDFUNCTIONDECLARATIONSTATEMENT_HPP
@@ -6,33 +8,32 @@
#include "BoundStatement.hpp"
class BoundFunctionDeclarationStatement : public BoundStatement{
BoundVariableKey* _key;
std::shared_ptr<BoundBlockStatement> _block;
std::shared_ptr<FunctionScriptType> _type;
const BoundVariableKey* _key;
const std::shared_ptr<BoundBlockStatement> _block;
const std::shared_ptr<FunctionScriptType> _type;
public:
BoundFunctionDeclarationStatement(std::shared_ptr<FunctionScriptType> type, BoundVariableKey* key, BoundBlockStatement* block){
_key = key;
_block = shared_ptr<BoundBlockStatement>(block);
_type = type;
BoundFunctionDeclarationStatement(std::shared_ptr<FunctionScriptType> type, BoundVariableKey* key, BoundBlockStatement* block)
:_key(key), _block(block), _type(std::move(type))
{
}
~BoundFunctionDeclarationStatement() final{
delete _key;
}
BoundStatementKind GetKind() final{
const BoundStatementKind GetKind() const final{
return BoundStatementKind ::FunctionDeclaration;
}
BoundVariableKey* GetKey(){
const BoundVariableKey* GetKey() const{
return _key;
}
std::shared_ptr<BoundBlockStatement> GetBlock(){
const std::shared_ptr<BoundBlockStatement> GetBlock() const{
return _block;
}
std::shared_ptr<FunctionScriptType> GetType(){
const std::shared_ptr<FunctionScriptType> GetType() const{
return _type;
}
};