Commit 7c4342fa authored by Ronny Wichers Schreur's avatar Ronny Wichers Schreur 🏘
Browse files

SwitchNode in CollectSharedNodeIdsInNode

parent 6e8ea8e3
...@@ -3469,20 +3469,7 @@ static NodeDefs *CollectSharedNodeIdsInNode (Node* node_p,NodeId parent_node_id, ...@@ -3469,20 +3469,7 @@ static NodeDefs *CollectSharedNodeIdsInNode (Node* node_p,NodeId parent_node_id,
last = CollectSharedNodeIdsInNode (&at_node,parent_node_id,last); last = CollectSharedNodeIdsInNode (&at_node,parent_node_id,last);
} }
if (node->node_kind!=IfNode){ if (node->node_kind==IfNode){
ArgP arg;
#ifdef ADD_ARGUMENTS_TO_HIGHER_ORDER_FUNCTIONS
if (node->node_kind==NormalNode && node->node_symbol->symb_kind==apply_symb)
(void) create_new_function_with_more_arguments (node,1);
#endif
for_l (arg,node->node_arguments,arg_next){
arg->arg_state=LazyState;
last = CollectSharedNodeIdsInNode (&arg->arg_node,parent_node_id,last);
}
/* RWS SwitchNode */
} else {
NodeDefs *shared; NodeDefs *shared;
Args cond_arg,then_arg,else_arg; Args cond_arg,then_arg,else_arg;
int local_scope; int local_scope;
...@@ -3540,6 +3527,23 @@ static NodeDefs *CollectSharedNodeIdsInNode (Node* node_p,NodeId parent_node_id, ...@@ -3540,6 +3527,23 @@ static NodeDefs *CollectSharedNodeIdsInNode (Node* node_p,NodeId parent_node_id,
AddStrictLhsNodeIdsToNodeDefs (node->node_then_strict_node_ids,&node->node_then_node_defs); AddStrictLhsNodeIdsToNodeDefs (node->node_then_strict_node_ids,&node->node_then_node_defs);
AddStrictLhsNodeIdsToNodeDefs (node->node_else_strict_node_ids,&node->node_else_node_defs); AddStrictLhsNodeIdsToNodeDefs (node->node_else_strict_node_ids,&node->node_else_node_defs);
} }
else if (node->node_kind==SwitchNode)
{
error_in_function ("CollectSharedNodeIdsInNode");
}
else {
ArgP arg;
#ifdef ADD_ARGUMENTS_TO_HIGHER_ORDER_FUNCTIONS
if (node->node_kind==NormalNode && node->node_symbol->symb_kind==apply_symb)
(void) create_new_function_with_more_arguments (node,1);
#endif
for_l (arg,node->node_arguments,arg_next){
arg->arg_state=LazyState;
last = CollectSharedNodeIdsInNode (&arg->arg_node,parent_node_id,last);
}
}
} }
return last; return last;
...@@ -3775,8 +3779,10 @@ static void AnnotateStrictNodeIds (Node node,StrictNodeIdP strict_node_ids,NodeD ...@@ -3775,8 +3779,10 @@ static void AnnotateStrictNodeIds (Node node,StrictNodeIdP strict_node_ids,NodeD
node_id->nid_node->node_annotation=StrictAnnot; node_id->nid_node->node_annotation=StrictAnnot;
} }
/* RWS SwitchNode */ switch (node->node_kind)
if (node->node_kind==IfNode){ {
case IfNode:
{
ArgS *arg; ArgS *arg;
arg=node->node_arguments; arg=node->node_arguments;
...@@ -3785,6 +3791,35 @@ static void AnnotateStrictNodeIds (Node node,StrictNodeIdP strict_node_ids,NodeD ...@@ -3785,6 +3791,35 @@ static void AnnotateStrictNodeIds (Node node,StrictNodeIdP strict_node_ids,NodeD
AnnotateStrictNodeIds (arg->arg_node,node->node_then_strict_node_ids,&node->node_then_node_defs); AnnotateStrictNodeIds (arg->arg_node,node->node_then_strict_node_ids,&node->node_then_node_defs);
arg = arg->arg_next; arg = arg->arg_next;
AnnotateStrictNodeIds (arg->arg_node,node->node_else_strict_node_ids,&node->node_else_node_defs); AnnotateStrictNodeIds (arg->arg_node,node->node_else_strict_node_ids,&node->node_else_node_defs);
break;
}
case SwitchNode:
{
ArgS *arg_p;
for_l (arg_p,node->node_arguments,arg_next){
NodeP node;
node=arg_p->arg_node;
if (node->node_kind==CaseNode){
NodeP case_alt_node_p;
case_alt_node_p=node->node_arguments->arg_node;
/* Codewarrior bug if (case_alt_node_p->node_kind==PushNode){ */
if (node->node_arguments->arg_node->node_kind==PushNode)
AnnotateStrictNodeIds (case_alt_node_p->node_arguments->arg_next->arg_node,node->node_strict_node_ids,&node->node_node_defs);
else
AnnotateStrictNodeIds (node->node_arguments->arg_node,node->node_strict_node_ids,&node->node_node_defs);
} else if (node->node_kind==DefaultNode){
AnnotateStrictNodeIds (node->node_arguments->arg_node,node->node_strict_node_ids,&node->node_node_defs);
} else
error_in_function ("AnnotateStrictNodeIds");
}
break;
}
default:
break;
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment