*
* \warning
* This function will operate correctly if a node being processed is removed
- * from list. However, if nodes are added to the list after the node being
- * processed, some of the added noded may not be processed.
+ * from the list. However, if nodes are added to the list after the node being
+ * processed, some of the added nodes may not be processed.
*/
ir_visitor_status
visit_list_elements(ir_hierarchical_visitor *v, exec_list *l)
{
- exec_node *next;
ir_instruction *prev_base_ir = v->base_ir;
- for (exec_node *n = l->head; n->next != NULL; n = next) {
- next = n->next;
-
+ foreach_list_safe(n, l) {
ir_instruction *const ir = (ir_instruction *) n;
v->base_ir = ir;
ir_visitor_status s = ir->accept(v);
if (s != visit_continue)
return (s == visit_continue_with_parent) ? visit_continue : s;
+ s = visit_list_elements(v, &this->parameters);
+ if (s == visit_stop)
+ return s;
+
s = visit_list_elements(v, &this->body);
return (s == visit_stop) ? s : v->visit_leave(this);
}
return (s == visit_continue_with_parent) ? visit_continue : s;
}
+ if (this->offset) {
+ s = this->offset->accept(v);
+ if (s != visit_continue)
+ return (s == visit_continue_with_parent) ? visit_continue : s;
+ }
+
switch (this->op) {
case ir_tex:
break;
break;
}
- return visit_continue_with_parent;
+ return (s == visit_stop) ? s : v->visit_leave(this);
}
if (s != visit_continue)
return (s == visit_continue_with_parent) ? visit_continue : s;
+ /* The array index is not the target of the assignment, so clear the
+ * 'in_assignee' flag. Restore it after returning from the array index.
+ */
+ const bool was_in_assignee = v->in_assignee;
+ v->in_assignee = false;
s = this->array_index->accept(v);
+ v->in_assignee = was_in_assignee;
+
if (s != visit_continue)
return (s == visit_continue_with_parent) ? visit_continue : s;
if (s != visit_continue)
return (s == visit_continue_with_parent) ? visit_continue : s;
+ v->in_assignee = true;
s = this->lhs->accept(v);
+ v->in_assignee = false;
if (s != visit_continue)
return (s == visit_continue_with_parent) ? visit_continue : s;