estamiton: check variable types in copy statements

issue#70
Houtan Bastani 2012-04-04 10:43:29 +02:00
parent 6006579de8
commit d5b8adedac
1 changed files with 33 additions and 14 deletions

View File

@ -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 (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 (!to_name2->empty())
check_symbol_existence(*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 (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 (!to_name2->empty())
check_symbol_existence(*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,