Commit d7a0ac39 authored by johnvg@science.ru.nl's avatar johnvg@science.ru.nl
Browse files

remove tests for BEArraySelectFun or BEArrayUpdateFun in function BESpecialArrayFunctionSymbol

parent feb4a221
...@@ -553,10 +553,8 @@ void BEBindSpecialType (int special_type_n,int type_index,int module_index) ...@@ -553,10 +553,8 @@ void BEBindSpecialType (int special_type_n,int type_index,int module_index)
BESymbolP BESymbolP
BESpecialArrayFunctionSymbol (BEArrayFunKind arrayFunKind, int functionIndex, int moduleIndex) BESpecialArrayFunctionSymbol (BEArrayFunKind arrayFunKind, int functionIndex, int moduleIndex)
{ {
Bool isSpecialArrayFunction;
BEModuleP module; BEModuleP module;
SymbolP functionSymbol; SymbolP functionSymbol,previousFunctionSymbol;
SymbDefP sdef;
SymbDefP originalsdef; SymbDefP originalsdef;
TypeAlt *typeAlt; TypeAlt *typeAlt;
TypeNode elementType, arrayType; TypeNode elementType, arrayType;
...@@ -572,61 +570,44 @@ BESpecialArrayFunctionSymbol (BEArrayFunKind arrayFunKind, int functionIndex, in ...@@ -572,61 +570,44 @@ BESpecialArrayFunctionSymbol (BEArrayFunKind arrayFunKind, int functionIndex, in
originalsdef = functionSymbol->symb_def; originalsdef = functionSymbol->symb_def;
typeAlt = originalsdef->sdef_rule_type->rule_type_rule; typeAlt = originalsdef->sdef_rule_type->rule_type_rule;
isSpecialArrayFunction = False;
switch (arrayFunKind) switch (arrayFunKind)
{ {
case BEArraySelectFun:
Assert (originalsdef->sdef_arfun == BEArraySelectFun || originalsdef->sdef_arfun == BEUnqArraySelectFun);
break;
case BE_UnqArraySelectFun: case BE_UnqArraySelectFun:
case BE_UnqArraySelectLastFun: case BE_UnqArraySelectLastFun:
Assert (typeAlt->type_alt_lhs->type_node_arity == 2); Assert (typeAlt->type_alt_lhs->type_node_arity == 2);
elementType = typeAlt->type_alt_rhs; elementType = typeAlt->type_alt_rhs;
arrayType = typeAlt->type_alt_lhs->type_node_arguments->type_arg_node; arrayType = typeAlt->type_alt_lhs->type_node_arguments->type_arg_node;
isSpecialArrayFunction = True;
Assert (originalsdef->sdef_arfun == BEArraySelectFun); Assert (originalsdef->sdef_arfun == BEArraySelectFun);
break; break;
case BE_ArrayUpdateFun: case BE_ArrayUpdateFun:
isSpecialArrayFunction = True;
elementType = typeAlt->type_alt_lhs->type_node_arguments->type_arg_next->type_arg_next->type_arg_node; elementType = typeAlt->type_alt_lhs->type_node_arguments->type_arg_next->type_arg_next->type_arg_node;
arrayType = typeAlt->type_alt_lhs->type_node_arguments->type_arg_node; arrayType = typeAlt->type_alt_lhs->type_node_arguments->type_arg_node;
/* fall through! */
case BEArrayUpdateFun:
Assert (originalsdef->sdef_arfun == BEArrayUpdateFun); Assert (originalsdef->sdef_arfun == BEArrayUpdateFun);
break; break;
default: default:
Assert (False); Assert (False);
break; return (functionSymbol);
} }
if (isSpecialArrayFunction)
{
SymbolP previousFunctionSymbol;
Bool allreadyCreated;
previousFunctionSymbol = functionSymbol; previousFunctionSymbol = functionSymbol;
functionSymbol = functionSymbol->symb_next; functionSymbol = functionSymbol->symb_next;
allreadyCreated = False; if (functionSymbol != NULL && functionSymbol->symb_kind == definition){
if (functionSymbol != NULL && functionSymbol->symb_kind == definition) if (functionSymbol->symb_def->sdef_arfun == (ArrayFunKind) arrayFunKind)
{ return functionSymbol;
sdef = functionSymbol->symb_def;
allreadyCreated = sdef->sdef_arfun == (ArrayFunKind) arrayFunKind; if (arrayFunKind == BE_UnqArraySelectLastFun && functionSymbol->symb_def->sdef_arfun == BE_UnqArraySelectFun){
if (!allreadyCreated && arrayFunKind == BE_UnqArraySelectLastFun && sdef->sdef_arfun == BE_UnqArraySelectFun)
{
previousFunctionSymbol = functionSymbol; previousFunctionSymbol = functionSymbol;
functionSymbol = functionSymbol->symb_next; functionSymbol = functionSymbol->symb_next;
if (functionSymbol != NULL && functionSymbol->symb_kind == definition) if (functionSymbol != NULL && functionSymbol->symb_kind == definition &&
functionSymbol->symb_def->sdef_arfun == (ArrayFunKind) arrayFunKind)
{ {
sdef = functionSymbol->symb_def; return functionSymbol;
allreadyCreated = sdef->sdef_arfun == (ArrayFunKind) arrayFunKind;
} }
} }
} }
if (!allreadyCreated)
{ {
char *functionName, *functionPrefix; char *functionName, *functionPrefix;
TypeAlt *newTypeAlt; TypeAlt *newTypeAlt;
...@@ -738,8 +719,6 @@ BESpecialArrayFunctionSymbol (BEArrayFunKind arrayFunKind, int functionIndex, in ...@@ -738,8 +719,6 @@ BESpecialArrayFunctionSymbol (BEArrayFunKind arrayFunKind, int functionIndex, in
functionSymbol = newFunctionSymbol; functionSymbol = newFunctionSymbol;
} }
}
return (functionSymbol); return (functionSymbol);
} /* BESpecialArrayFunctionSymbol */ } /* BESpecialArrayFunctionSymbol */
......
Markdown is supported
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