stage3/forced_narrow_candidate_datatypes.cc
changeset 1041 56ebe2a31b5b
parent 693 51a2fa6441b9
child 1054 57c08195c962
equal deleted inserted replaced
1040:e8563dcaefca 1041:56ebe2a31b5b
   159 /*| instruction_list il_instruction */
   159 /*| instruction_list il_instruction */
   160 // SYM_LIST(instruction_list_c)
   160 // SYM_LIST(instruction_list_c)
   161 void *forced_narrow_candidate_datatypes_c::visit(instruction_list_c *symbol) {
   161 void *forced_narrow_candidate_datatypes_c::visit(instruction_list_c *symbol) {
   162   for(int j = 0; j < 2; j++) {
   162   for(int j = 0; j < 2; j++) {
   163     for(int i = symbol->n-1; i >= 0; i--) {
   163     for(int i = symbol->n-1; i >= 0; i--) {
   164       symbol->elements[i]->accept(*this);
   164       symbol->get_element(i)->accept(*this);
   165     }
   165     }
   166   }
   166   }
   167 
   167 
   168   /* Assert that this algorithm managed to remove all NULL datatypes! */
   168   /* Assert that this algorithm managed to remove all NULL datatypes! */
   169   /* NOTE: The forced_narrow_candidate_datatypes_c assumes that the original IEC 61131-3 source code does not have any bugs!
   169   /* NOTE: The forced_narrow_candidate_datatypes_c assumes that the original IEC 61131-3 source code does not have any bugs!
   170    *       This means we cannot run this assertion here, as the compiler will bork in the presence of bug in the code being compiled! Not good!!
   170    *       This means we cannot run this assertion here, as the compiler will bork in the presence of bug in the code being compiled! Not good!!
   171    */
   171    */
   172   /*
   172   /*
   173   for(int i = symbol->n-1; i >= 0; i--) {
   173   for(int i = symbol->n-1; i >= 0; i--) {
   174     if (NULL == symbol->elements[i]->datatype)
   174     if (NULL == symbol->get_element(i)->datatype)
   175       ERROR;
   175       ERROR;
   176   }
   176   }
   177   */
   177   */
   178   
   178   
   179   return NULL;
   179   return NULL;