fixed seg fault for non record function calls
This commit is contained in:
@ -707,6 +707,7 @@ assignable:
|
|||||||
TableNode *param = getParameter(typeNode);
|
TableNode *param = getParameter(typeNode);
|
||||||
printTableNode(param);
|
printTableNode(param);
|
||||||
|
|
||||||
|
if (getAdInfoType(param) == TYPE_RECORD) {
|
||||||
SymbolTable *recList = getRecList(param);
|
SymbolTable *recList = getRecList(param);
|
||||||
TableNode *lastCheckedRef = getFirstEntry(recList);
|
TableNode *lastCheckedRef = getFirstEntry(recList);
|
||||||
TableNode *lastCheckedAct = getFirstEntry(cur);
|
TableNode *lastCheckedAct = getFirstEntry(cur);
|
||||||
@ -731,7 +732,15 @@ assignable:
|
|||||||
lastCheckedRef = tn;
|
lastCheckedRef = tn;
|
||||||
} else {break;}
|
} else {break;}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (strcmp(getName(param), getName(getFirstEntry(cur))) != 0) {
|
||||||
|
printdebug("expected %s expression in function call but got %s", getName(param), getName(getFirstEntry(cur)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getNextEntry(getFirstEntry(cur)) != NULL) {
|
||||||
|
printdebug("expected 1 parameter, but got multiple in function call");
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
char *expected = getName(getParameter(look_up(getParent(cur), getName((TableNode*)$1))));
|
char *expected = getName(getParameter(look_up(getParent(cur), getName((TableNode*)$1))));
|
||||||
char *actual = getType(getFirstEntry(cur));
|
char *actual = getType(getFirstEntry(cur));
|
||||||
|
@ -335,7 +335,7 @@ SymbolTable *getRecList(TableNode *definition) {
|
|||||||
if (strcmp(getType(definition), "record") != 0) {
|
if (strcmp(getType(definition), "record") != 0) {
|
||||||
printdebug(
|
printdebug(
|
||||||
"not checking the list of types of a record -- invalid "
|
"not checking the list of types of a record -- invalid "
|
||||||
"op");
|
"op of type %s", getType(definition));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return definition->additionalinfo->RecAdInfo->recordScope;
|
return definition->additionalinfo->RecAdInfo->recordScope;
|
||||||
|
@ -14,11 +14,11 @@ foo (x) := {
|
|||||||
return x * x;
|
return x * x;
|
||||||
}
|
}
|
||||||
|
|
||||||
bar1 (a) := {
|
bar1 (x, y) := {
|
||||||
return a.x * a.y;
|
return x * y;
|
||||||
}
|
}
|
||||||
|
|
||||||
bar2 as (r,s) := {
|
bar2 (r,s) := {
|
||||||
return r * s;
|
return r * s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user