Generate correct error message when encountering IL lists embedded in IL formal invocations.
authormjsousa
Thu, 22 Aug 2013 18:50:43 +0100
changeset 844 39c755f41ee8
parent 843 f9a059c24aea
child 845 5fa872f3d073
Generate correct error message when encountering IL lists embedded in IL formal invocations.
absyntax_utils/function_call_param_iterator.cc
stage4/generate_c/generate_c_il.cc
stage4/generate_c/generate_c_inlinefcall.cc
--- a/absyntax_utils/function_call_param_iterator.cc	Thu Aug 22 16:53:17 2013 +0100
+++ b/absyntax_utils/function_call_param_iterator.cc	Thu Aug 22 18:50:43 2013 +0100
@@ -464,12 +464,13 @@
 void *function_call_param_iterator_c::visit(il_param_assignment_c *symbol) {
   TRACE("il_param_assignment_c");
 
-  // TODO : We do not yet handle a instruction list passed as parameter !!!
-  // since we do not yet support it, it is best to simply stop than to fail silently...
-  if (NULL != symbol->simple_instr_list) ERROR;
+  symbol_c *expression = NULL;
+  if (!((NULL != symbol->simple_instr_list) ^ (NULL != symbol->il_operand))) ERROR;
+  if    (NULL != symbol->simple_instr_list) expression = symbol->simple_instr_list;
+  if    (NULL != symbol->il_operand       ) expression = symbol->il_operand;
 
   current_assign_direction = assign_in;
-  return handle_parameter_assignment((symbol_c *)symbol->il_assign_operator->accept(*this), symbol->il_operand);
+  return handle_parameter_assignment((symbol_c *)symbol->il_assign_operator->accept(*this), expression);
 }
 
 /*  il_assign_out_operator variable */
--- a/stage4/generate_c/generate_c_il.cc	Thu Aug 22 16:53:17 2013 +0100
+++ b/stage4/generate_c/generate_c_il.cc	Thu Aug 22 18:50:43 2013 +0100
@@ -840,6 +840,14 @@
       break;
     }
     
+    /* We do not yet support embedded IL lists, so we abort the compiler if we find one */
+    /* Note that in IL function calls the syntax does not allow embeded IL lists, so this check is not necessary here! */
+    /*
+    {simple_instr_list_c *instruction_list = dynamic_cast<simple_instr_list_c *>(param_value);
+     if (NULL != instruction_list) STAGE4_ERROR(param_value, param_value, "The compiler does not yet support formal invocations in IL that contain embedded IL lists. Aborting!");
+    }
+    */
+    
     if ((param_value == NULL) && (param_direction == function_param_iterator_c::direction_in)) {
       /* No value given for parameter, so we must use the default... */
       /* First check whether default value specified in function declaration...*/
@@ -1061,6 +1069,11 @@
     if ((param_value == NULL) && !fp_iterator.is_en_eno_param_implicit())
       param_value = function_call_param_iterator.next_nf();
 
+    /* We do not yet support embedded IL lists, so we abort the compiler if we find one */
+    {simple_instr_list_c *instruction_list = dynamic_cast<simple_instr_list_c *>(param_value);
+     if (NULL != instruction_list) STAGE4_ERROR(param_value, param_value, "The compiler does not yet support formal invocations in IL that contain embedded IL lists. Aborting!");
+    }
+    
     symbol_c *param_type = fp_iterator.param_type();
     if (param_type == NULL) ERROR;
     
@@ -1229,6 +1242,11 @@
       break;
     }
     
+    /* We do not yet support embedded IL lists, so we abort the compiler if we find one */
+    {simple_instr_list_c *instruction_list = dynamic_cast<simple_instr_list_c *>(param_value);
+     if (NULL != instruction_list) STAGE4_ERROR(param_value, param_value, "The compiler does not yet support formal invocations in IL that contain embedded IL lists. Aborting!");
+    }
+    
     if ((param_value == NULL) && (param_direction == function_param_iterator_c::direction_in)) {
       /* No value given for parameter, so we must use the default... */
       /* First check whether default value specified in function declaration...*/
--- a/stage4/generate_c/generate_c_inlinefcall.cc	Thu Aug 22 16:53:17 2013 +0100
+++ b/stage4/generate_c/generate_c_inlinefcall.cc	Thu Aug 22 18:50:43 2013 +0100
@@ -512,6 +512,14 @@
           break;
         }
       
+        /* We do not yet support embedded IL lists, so we abort the compiler if we find one */
+        /* Note that in IL function calls the syntax does not allow embeded IL lists, so this check is not necessary here! */
+        /*
+        {simple_instr_list_c *instruction_list = dynamic_cast<simple_instr_list_c *>(param_value);
+         if (NULL != instruction_list) STAGE4_ERROR(param_value, param_value, "The compiler does not yet support formal invocations in IL that contain embedded IL lists. Aborting!");
+        }
+        */
+
         if ((param_value == NULL) && (param_direction == function_param_iterator_c::direction_in)) {
           /* No value given for parameter, so we must use the default... */
           /* First check whether default value specified in function declaration...*/
@@ -669,7 +677,12 @@
         if ((param_value == NULL) && (fp_iterator.is_extensible_param())) {
           break;
         }
-    
+        
+        /* We do not yet support embedded IL lists, so we abort the compiler if we find one */
+        {simple_instr_list_c *instruction_list = dynamic_cast<simple_instr_list_c *>(param_value);
+         if (NULL != instruction_list) STAGE4_ERROR(param_value, param_value, "The compiler does not yet support formal invocations in IL that contain embedded IL lists. Aborting!");
+        }
+
         if ((param_value == NULL) && (param_direction == function_param_iterator_c::direction_in)) {
           /* No value given for parameter, so we must use the default... */
           /* First check whether default value specified in function declaration...*/