Commit a2497dc0 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

estamiton: check variable types in copy statements

parent 83afb256
......@@ -1363,18 +1363,28 @@ void
ParsingDriver::copy_prior(string *to_declaration_type, string *to_name1, string *to_name2, string *to_subsample_name,
string *from_declaration_type, string *from_name1, string *from_name2, string *from_subsample_name)
{
check_symbol_existence(*to_name1);
check_symbol_existence(*from_name1);
if (!to_name2->empty())
check_symbol_existence(*to_name2);
if (strcmp(to_declaration_type->c_str(), "par") == 0)
check_symbol_is_parameter(to_name1);
else
{
check_symbol_is_endogenous_or_exogenous(to_name1);
if (!to_name2->empty())
check_symbol_is_endogenous_or_exogenous(to_name2);
}
if (!from_name2->empty())
check_symbol_existence(*from_name2);
if (strcmp(from_declaration_type->c_str(), "par") == 0)
check_symbol_is_parameter(from_name1);
else
{
check_symbol_is_endogenous_or_exogenous(from_name1);
if (!from_name2->empty())
check_symbol_is_endogenous_or_exogenous(from_name2);
}
mod_file->addStatement(new PriorEqualStatement(*to_declaration_type, *to_name1, *to_name2, *to_subsample_name,
*from_declaration_type, *from_name1, *from_name2, *from_subsample_name,
mod_file->symbol_table));
delete to_declaration_type;
delete to_name1;
delete to_name2;
......@@ -1400,14 +1410,23 @@ void
ParsingDriver::copy_options(string *to_declaration_type, string *to_name1, string *to_name2, string *to_subsample_name,
string *from_declaration_type, string *from_name1, string *from_name2, string *from_subsample_name)
{
check_symbol_existence(*to_name1);
check_symbol_existence(*from_name1);
if (!to_name2->empty())
check_symbol_existence(*to_name2);
if (strcmp(to_declaration_type->c_str(), "par") == 0)
check_symbol_is_parameter(to_name1);
else
{
check_symbol_is_endogenous_or_exogenous(to_name1);
if (!to_name2->empty())
check_symbol_is_endogenous_or_exogenous(to_name2);
}
if (!from_name2->empty())
check_symbol_existence(*from_name2);
if (strcmp(from_declaration_type->c_str(), "par") == 0)
check_symbol_is_parameter(from_name1);
else
{
check_symbol_is_endogenous_or_exogenous(from_name1);
if (!from_name2->empty())
check_symbol_is_endogenous_or_exogenous(from_name2);
}
mod_file->addStatement(new OptionsEqualStatement(*to_declaration_type, *to_name1, *to_name2, *to_subsample_name,
*from_declaration_type, *from_name1, *from_name2, *from_subsample_name,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment