stage3/remove_forward_dependencies.cc
changeset 971 8aee27d46208
parent 959 8bfcc8e62bd6
child 1041 56ebe2a31b5b
equal deleted inserted replaced
970:0ede7ca157e2 971:8aee27d46208
   106   /*******************************************/
   106   /*******************************************/
   107   /* B 1.1 - Letters, digits and identifiers */
   107   /* B 1.1 - Letters, digits and identifiers */
   108   /*******************************************/
   108   /*******************************************/
   109   // return NULL if the symbol is already in the declared_identifiers symbol table, otherwise return the missing symbol!
   109   // return NULL if the symbol is already in the declared_identifiers symbol table, otherwise return the missing symbol!
   110   void *visit(            poutype_identifier_c *symbol)
   110   void *visit(            poutype_identifier_c *symbol)
   111     {if (declared_identifiers->find_value(symbol) != declared_identifiers->end_value()) return NULL; else return symbol;}
   111     {if (declared_identifiers->find(symbol) != declared_identifiers->end()) return NULL; else return symbol;}
   112 };   /* class find_forward_dependencies_c */
   112 };   /* class find_forward_dependencies_c */
   113 
   113 
   114 
   114 
   115 
   115 
   116 
   116 
   192   if (inserted_symbols.find(symbol) != inserted_symbols.end())                 return NULL; // already previously inserted into new_tree and declared_identifiers. Do not handle again!
   192   if (inserted_symbols.find(symbol) != inserted_symbols.end())                 return NULL; // already previously inserted into new_tree and declared_identifiers. Do not handle again!
   193   if ((search1 != NULL) && (search1->accept(*find_forward_dependencies) != NULL)) return NULL; // A forward depency has not yet been satisfied. Wait for a later iteration to try again! 
   193   if ((search1 != NULL) && (search1->accept(*find_forward_dependencies) != NULL)) return NULL; // A forward depency has not yet been satisfied. Wait for a later iteration to try again! 
   194   if ((search2 != NULL) && (search2->accept(*find_forward_dependencies) != NULL)) return NULL; // A forward depency has not yet been satisfied. Wait for a later iteration to try again!
   194   if ((search2 != NULL) && (search2->accept(*find_forward_dependencies) != NULL)) return NULL; // A forward depency has not yet been satisfied. Wait for a later iteration to try again!
   195   if ((search3 != NULL) && (search3->accept(*find_forward_dependencies) != NULL)) return NULL; // A forward depency has not yet been satisfied. Wait for a later iteration to try again!
   195   if ((search3 != NULL) && (search3->accept(*find_forward_dependencies) != NULL)) return NULL; // A forward depency has not yet been satisfied. Wait for a later iteration to try again!
   196   /* no forward dependencies found => insert into new AST, and add to the 'defined identifiers' and 'inserted symbol' lists */
   196   /* no forward dependencies found => insert into new AST, and add to the 'defined identifiers' and 'inserted symbol' lists */
   197   if (declared_identifiers.find_value(name) == declared_identifiers.end_value())
   197   if (declared_identifiers.find(name) == declared_identifiers.end())
   198       declared_identifiers.insert(name, NULL);  // only add if not yet in the symbol table (an overloaded version of this same POU could have been inderted previously!)
   198       declared_identifiers.insert(name, NULL);  // only add if not yet in the symbol table (an overloaded version of this same POU could have been inderted previously!)
   199   inserted_symbols.insert(symbol);
   199   inserted_symbols.insert(symbol);
   200   new_tree->add_element(current_code_generation_pragma);  
   200   new_tree->add_element(current_code_generation_pragma);  
   201   new_tree->add_element(symbol);  
   201   new_tree->add_element(symbol);  
   202   return NULL;
   202   return NULL;