Support multiple function arguments
This commit is contained in:
@ -42,8 +42,16 @@ namespace elna::source
|
||||
{
|
||||
if (scope == nullptr)
|
||||
{
|
||||
enter("writei", std::make_shared<intrinsic_info>());
|
||||
enter("writeb", std::make_shared<intrinsic_info>());
|
||||
auto writei = std::make_shared<intrinsic_info>();
|
||||
writei->parameter_infos.emplace_back(int_type);
|
||||
enter("writei", writei);
|
||||
|
||||
auto writeb = std::make_shared<intrinsic_info>();
|
||||
writeb->parameter_infos.emplace_back(boolean_type);
|
||||
enter("writeb", writeb);
|
||||
|
||||
enter("Boolean", std::make_shared<type_info>(boolean_type));
|
||||
enter("Int", std::make_shared<type_info>(int_type));
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,10 +116,20 @@ namespace elna::source
|
||||
return m_value;
|
||||
}
|
||||
|
||||
variable_info::variable_info(const class type& type)
|
||||
: m_type(type)
|
||||
{
|
||||
}
|
||||
|
||||
variable_info::~variable_info()
|
||||
{
|
||||
}
|
||||
|
||||
const class type& variable_info::type() const noexcept
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
parameter_info::parameter_info(const class type& type)
|
||||
: m_type(type)
|
||||
{
|
||||
@ -126,6 +144,15 @@ namespace elna::source
|
||||
return m_type;
|
||||
}
|
||||
|
||||
intrinsic_info::~intrinsic_info()
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t intrinsic_info::parameter_stack_size() const noexcept
|
||||
{
|
||||
return this->parameter_infos.size() * sizeof(std::int32_t);
|
||||
}
|
||||
|
||||
procedure_info::procedure_info(std::shared_ptr<symbol_table> outer_scope)
|
||||
: local_table(std::make_shared<symbol_table>(outer_scope))
|
||||
{
|
||||
@ -135,22 +162,13 @@ namespace elna::source
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t procedure_info::stack_size() const noexcept
|
||||
{
|
||||
return this->local_stack_size;
|
||||
}
|
||||
|
||||
void procedure_info::stack_size(const std::size_t size) noexcept
|
||||
{
|
||||
this->local_stack_size = size;
|
||||
}
|
||||
|
||||
std::shared_ptr<symbol_table> procedure_info::scope()
|
||||
{
|
||||
return local_table;
|
||||
}
|
||||
|
||||
intrinsic_info::~intrinsic_info()
|
||||
std::size_t procedure_info::stack_size() const noexcept
|
||||
{
|
||||
return local_stack_size + argument_stack_size;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user