Delete no longer needed copy_candidate_datatype_list() function.
authorMario de Sousa <msousa@fe.up.pt>
Thu, 08 Mar 2012 19:14:45 +0000
changeset 467 4910eaa1206a
parent 466 d97a29b7fa8b
child 468 46f8154d506e
Delete no longer needed copy_candidate_datatype_list() function.
stage3/datatype_functions.cc
stage3/datatype_functions.hh
stage3/fill_candidate_datatypes.cc
stage3/narrow_candidate_datatypes.cc
--- a/stage3/datatype_functions.cc	Thu Mar 08 18:57:55 2012 +0000
+++ b/stage3/datatype_functions.cc	Thu Mar 08 19:14:45 2012 +0000
@@ -190,18 +190,6 @@
 
 
 
-/* Copy the elements in the candidate_datatype_list in one symbol (from)
- * into the candidate_datatype_list of another symbol (to)
- */
-void copy_candidate_datatype_list(symbol_c *from, symbol_c *to) {
-	if ((NULL == from) || (NULL == to))
-		return;
-	for(unsigned int i = 0; i < from->candidate_datatypes.size(); i++)
-		to->candidate_datatypes.push_back(from->candidate_datatypes[i]);
-	/* for some reason, the following alternative implementation results in a segmentation fault! I am not going to bother with this for now! */
-// 	std::copy(from->candidate_datatypes.begin(), from->candidate_datatypes.end(), to->candidate_datatypes.begin());
-}
-
 
 
 /* Intersect two candidate_datatype_lists.
--- a/stage3/datatype_functions.hh	Thu Mar 08 18:57:55 2012 +0000
+++ b/stage3/datatype_functions.hh	Thu Mar 08 19:14:45 2012 +0000
@@ -142,11 +142,6 @@
  */
 int search_in_candidate_datatype_list(symbol_c *datatype, std::vector <symbol_c *> candidate_datatypes);
 
-/* Copy the elements in the candidate_datatype_list in one symbol (from)
- * into the candidate_datatype_list of another symbol (to)
- */
-void copy_candidate_datatype_list(symbol_c *from, symbol_c *to);
-
 /* Intersect two candidate_datatype_lists.
  * Remove from list1 (origin, dest.) all elements that are not found in list2 (with).
  * In essence, list1 will contain the result of the intersection of list1 with list2.
--- a/stage3/fill_candidate_datatypes.cc	Thu Mar 08 18:57:55 2012 +0000
+++ b/stage3/fill_candidate_datatypes.cc	Thu Mar 08 19:14:45 2012 +0000
@@ -301,7 +301,7 @@
 	 * here).
 	 */
 	if (NULL != prev_il_instruction)
-		copy_candidate_datatype_list(prev_il_instruction/*from*/, il_instruction/*to*/);
+		il_instruction->candidate_datatypes = prev_il_instruction->candidate_datatypes; 
 
 	if (debug) std::cout << "handle_implicit_il_fb_call() [" << prev_il_instruction->candidate_datatypes.size() << "] ==> " << il_instruction->candidate_datatypes.size() << " result.\n";
 }
@@ -849,7 +849,7 @@
 		prev_il_instruction = NULL;
 
 		/* This object has (inherits) the same candidate datatypes as the il_instruction */
-		copy_candidate_datatype_list(symbol->il_instruction /*from*/, symbol /*to*/);	
+		symbol->candidate_datatypes = symbol->il_instruction->candidate_datatypes;
 	}
 
 	return NULL;
@@ -867,7 +867,7 @@
 	symbol->il_simple_operator->accept(*this);
 	il_operand = NULL;
 	/* This object has (inherits) the same candidate datatypes as the il_simple_operator */
-	copy_candidate_datatype_list(symbol->il_simple_operator /*from*/, symbol /*to*/);
+	symbol->candidate_datatypes = symbol->il_simple_operator->candidate_datatypes;
 	return NULL;
 }
 
@@ -940,7 +940,7 @@
   il_operand = NULL;
   
   /* This object has the same candidate datatypes as the il_expr_operator. */
-  copy_candidate_datatype_list(symbol->il_expr_operator/*from*/, symbol/*to*/);
+  symbol->candidate_datatypes = symbol->il_expr_operator->candidate_datatypes;
   return NULL;
 }
 
@@ -951,7 +951,7 @@
   symbol->il_jump_operator->accept(*this);
   il_operand = NULL;
   /* This object has the same candidate datatypes as the il_jump_operator. */
-  copy_candidate_datatype_list(symbol->il_jump_operator/*from*/, symbol/*to*/);
+  symbol->candidate_datatypes = symbol->il_jump_operator->candidate_datatypes;
   return NULL;
 }
 
@@ -998,7 +998,7 @@
 	 *       print_datatypes_error_c, so the code will never reach stage 4!
 	 */
 	symbol->il_call_operator->accept(*this);
-	copy_candidate_datatype_list(symbol->il_call_operator/*from*/, symbol/*to*/);
+	symbol->candidate_datatypes = symbol->il_call_operator->candidate_datatypes;
 
 	if (debug) std::cout << "FB [] ==> "  << symbol->candidate_datatypes.size() << " result.\n";
 	return NULL;
@@ -1040,7 +1040,7 @@
     symbol->elements[i]->accept(*this);
 
   /* This object has (inherits) the same candidate datatypes as the last il_instruction */
-  copy_candidate_datatype_list(symbol->elements[symbol->n-1] /*from*/, symbol /*to*/);	
+  symbol->candidate_datatypes = symbol->elements[symbol->n-1]->candidate_datatypes;
   
   if (debug) std::cout << "simple_instr_list_c [" << symbol->candidate_datatypes.size() << "] result.\n";
   return NULL;
@@ -1058,7 +1058,7 @@
   prev_il_instruction = NULL;
 
   /* This object has (inherits) the same candidate datatypes as the il_simple_instruction it points to */
-  copy_candidate_datatype_list(symbol->il_simple_instruction /*from*/, symbol /*to*/);	
+  symbol->candidate_datatypes = symbol->il_simple_instruction->candidate_datatypes;
   return NULL;
 }
 
--- a/stage3/narrow_candidate_datatypes.cc	Thu Mar 08 18:57:55 2012 +0000
+++ b/stage3/narrow_candidate_datatypes.cc	Thu Mar 08 19:14:45 2012 +0000
@@ -346,7 +346,6 @@
 	 * The above will be done by the visit(il_fb_call_c *) method, so we must make sure to
 	 * correctly set up the il_fb_call.datatype variable!
 	 */
-// 	copy_candidate_datatype_list(il_instruction/*from*/, &il_fb_call/*to*/);
 	il_fb_call.called_fb_declaration = called_fb_declaration;
 	il_fb_call.accept(*this);