fixed seg fault for non record function calls
This commit is contained in:
@ -707,31 +707,40 @@ assignable:
|
||||
TableNode *param = getParameter(typeNode);
|
||||
printTableNode(param);
|
||||
|
||||
SymbolTable *recList = getRecList(param);
|
||||
TableNode *lastCheckedRef = getFirstEntry(recList);
|
||||
TableNode *lastCheckedAct = getFirstEntry(cur);
|
||||
while (getNextEntry(lastCheckedRef) != NULL) {
|
||||
lastCheckedRef = getNextEntry(lastCheckedRef);
|
||||
}
|
||||
if (getAdInfoType(param) == TYPE_RECORD) {
|
||||
SymbolTable *recList = getRecList(param);
|
||||
TableNode *lastCheckedRef = getFirstEntry(recList);
|
||||
TableNode *lastCheckedAct = getFirstEntry(cur);
|
||||
while (getNextEntry(lastCheckedRef) != NULL) {
|
||||
lastCheckedRef = getNextEntry(lastCheckedRef);
|
||||
}
|
||||
|
||||
|
||||
//this isn't very efficient, but will hopefully work
|
||||
while (lastCheckedAct != NULL && lastCheckedRef != NULL) {
|
||||
if (strcmp(getName(lastCheckedAct), getName(lastCheckedRef)) != 0) {
|
||||
printdebug("expected %s. expression in function call got %s. at line %d and column %d",getType(lastCheckedRef), getName(lastCheckedAct), @3.first_line, @3.first_column);
|
||||
printdebug("%d", strcmp(getName(lastCheckedAct), getName(lastCheckedRef)));
|
||||
}
|
||||
lastCheckedAct = getNextEntry(lastCheckedAct);
|
||||
TableNode *tn = getFirstEntry(recList);
|
||||
|
||||
if (tn != lastCheckedRef) {
|
||||
while (getNextEntry(tn) != lastCheckedRef) {
|
||||
tn = getNextEntry(tn);
|
||||
//this isn't very efficient, but will hopefully work
|
||||
while (lastCheckedAct != NULL && lastCheckedRef != NULL) {
|
||||
if (strcmp(getName(lastCheckedAct), getName(lastCheckedRef)) != 0) {
|
||||
printdebug("expected %s. expression in function call got %s. at line %d and column %d",getType(lastCheckedRef), getName(lastCheckedAct), @3.first_line, @3.first_column);
|
||||
printdebug("%d", strcmp(getName(lastCheckedAct), getName(lastCheckedRef)));
|
||||
}
|
||||
lastCheckedRef = tn;
|
||||
} else {break;}
|
||||
lastCheckedAct = getNextEntry(lastCheckedAct);
|
||||
TableNode *tn = getFirstEntry(recList);
|
||||
|
||||
if (tn != lastCheckedRef) {
|
||||
while (getNextEntry(tn) != lastCheckedRef) {
|
||||
tn = getNextEntry(tn);
|
||||
}
|
||||
lastCheckedRef = tn;
|
||||
} 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 {
|
||||
char *expected = getName(getParameter(look_up(getParent(cur), getName((TableNode*)$1))));
|
||||
char *actual = getType(getFirstEntry(cur));
|
||||
|
@ -335,7 +335,7 @@ SymbolTable *getRecList(TableNode *definition) {
|
||||
if (strcmp(getType(definition), "record") != 0) {
|
||||
printdebug(
|
||||
"not checking the list of types of a record -- invalid "
|
||||
"op");
|
||||
"op of type %s", getType(definition));
|
||||
return NULL;
|
||||
}
|
||||
return definition->additionalinfo->RecAdInfo->recordScope;
|
||||
@ -1423,4 +1423,4 @@ TableNode *printTableNode(TableNode *tn) {
|
||||
}
|
||||
|
||||
return tn;
|
||||
}
|
||||
}
|
||||
|
@ -14,11 +14,11 @@ foo (x) := {
|
||||
return x * x;
|
||||
}
|
||||
|
||||
bar1 (a) := {
|
||||
return a.x * a.y;
|
||||
bar1 (x, y) := {
|
||||
return x * y;
|
||||
}
|
||||
|
||||
bar2 as (r,s) := {
|
||||
bar2 (r,s) := {
|
||||
return r * s;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user