From d5b8adedac13c318a5aa9713a0890a6348d259d6 Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan.bastani@ens.fr>
Date: Wed, 4 Apr 2012 10:43:29 +0200
Subject: [PATCH] estamiton: check variable types in copy statements

---
 ParsingDriver.cc | 47 +++++++++++++++++++++++++++++++++--------------
 1 file changed, 33 insertions(+), 14 deletions(-)

diff --git a/ParsingDriver.cc b/ParsingDriver.cc
index e956a68a..03069ee4 100644
--- a/ParsingDriver.cc
+++ b/ParsingDriver.cc
@@ -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,
-- 
GitLab