absyntax_utils/function_param_iterator.cc
changeset 1041 56ebe2a31b5b
parent 810 d9c48ad646f1
equal deleted inserted replaced
1040:e8563dcaefca 1041:56ebe2a31b5b
   165 
   165 
   166 void* function_param_iterator_c::handle_param_list(list_c *list) {
   166 void* function_param_iterator_c::handle_param_list(list_c *list) {
   167   switch (current_operation) {
   167   switch (current_operation) {
   168     case iterate_op:
   168     case iterate_op:
   169       if (next_param <= param_count + list->n)
   169       if (next_param <= param_count + list->n)
   170         return list->elements[next_param - param_count - 1];
   170         return list->get_element(next_param - param_count - 1);
   171 
   171 
   172       /* the desired param is not on this list... */
   172       /* the desired param is not on this list... */
   173       param_count += list->n;
   173       param_count += list->n;
   174       break;
   174       break;
   175 
   175 
   176     case search_op:
   176     case search_op:
   177       for(int i = 0; i < list->n; i++) {
   177       for(int i = 0; i < list->n; i++) {
   178         symbol_c *sym = list->elements[i];
   178         symbol_c *sym = list->get_element(i);
   179         extensible_input_parameter_c *extensible_parameter = dynamic_cast<extensible_input_parameter_c *>(sym);
   179         extensible_input_parameter_c *extensible_parameter = dynamic_cast<extensible_input_parameter_c *>(sym);
   180         if (extensible_parameter != NULL) {
   180         if (extensible_parameter != NULL) {
   181           sym = extensible_parameter->var_name;
   181           sym = extensible_parameter->var_name;
   182           current_param_is_extensible = true;
   182           current_param_is_extensible = true;
   183           _first_extensible_param_index = extract_first_index_value(extensible_parameter->first_index);
   183           _first_extensible_param_index = extract_first_index_value(extensible_parameter->first_index);
   241 }
   241 }
   242 
   242 
   243 void* function_param_iterator_c::iterate_list(list_c *list) {
   243 void* function_param_iterator_c::iterate_list(list_c *list) {
   244   void *res;
   244   void *res;
   245   for (int i = 0; i < list->n; i++) {
   245   for (int i = 0; i < list->n; i++) {
   246     res = list->elements[i]->accept(*this);
   246     res = list->get_element(i)->accept(*this);
   247     if (res != NULL)
   247     if (res != NULL)
   248         return res;
   248         return res;
   249   }
   249   }
   250   return NULL;
   250   return NULL;
   251 }
   251 }