
#ifndef PORYGONLANG_BOUNDFUNCTIONDECLARATIONSTATEMENT_HPP
#define PORYGONLANG_BOUNDFUNCTIONDECLARATIONSTATEMENT_HPP

#include <memory>
#include "BoundStatement.hpp"
#include "../../ScriptTypes/FunctionScriptType.hpp"

namespace Porygon::Binder {
    class BoundFunctionDeclarationStatement : public BoundStatement {
        const BoundVariableKey *_key;
        const std::shared_ptr<BoundBlockStatement> _block;
        const std::shared_ptr<const GenericFunctionScriptType> _type;
    public:
        BoundFunctionDeclarationStatement(std::shared_ptr<const GenericFunctionScriptType> type, const BoundVariableKey *key,
                                          BoundBlockStatement *block)
                : _key(key), _block(block), _type(std::move(type)) {
        }

        ~BoundFunctionDeclarationStatement() final {
            delete _key;
        }

        [[nodiscard]]
        inline BoundStatementKind GetKind() const final {
            return BoundStatementKind::FunctionDeclaration;
        }

        [[nodiscard]]
        inline const BoundVariableKey *GetKey() const {
            return _key;
        }

        [[nodiscard]]
        inline std::shared_ptr<const BoundBlockStatement> GetBlock() const {
            return _block;
        }

        [[nodiscard]]
        inline std::shared_ptr<const GenericFunctionScriptType> GetType() const {
            return _type;
        }
    };
}

#endif //PORYGONLANG_BOUNDFUNCTIONDECLARATIONSTATEMENT_HPP
