need to update argument list for the right context
This commit is contained in:
@ -124,6 +124,48 @@ int getArgumentNumber(Function_Stack *fs) {
|
||||
return fs->arg;
|
||||
}
|
||||
|
||||
TableNode* getRecordNumberType(TableNode* record, int arg){
|
||||
if(record == NULL){
|
||||
//case where NULL is being passed in
|
||||
return undefined;
|
||||
}
|
||||
if(getAdInfoType(record) != TYPE_RECORD_TYPE){
|
||||
//case where invalid argument number is being passed
|
||||
return undefined;
|
||||
}
|
||||
if(arg<getRecLength(record)){
|
||||
//case where invalid argument number is being passed
|
||||
return undefined;
|
||||
}
|
||||
int count = 1;
|
||||
TableNode* this = getFirstEntry(getRecList(record));
|
||||
while(this != NULL && count<arg){
|
||||
this = getNextEntry(this);
|
||||
count++;
|
||||
}
|
||||
if(this == NULL){
|
||||
//something went wrong. traversal is off
|
||||
return undefined;
|
||||
}
|
||||
return getTypeEntry(this);
|
||||
}
|
||||
|
||||
TableNode* getFunctionNumberType(TableNode* function, int arg){
|
||||
if(function ==NULL){
|
||||
//case where NULL is being passed in
|
||||
return undefined;
|
||||
}
|
||||
if(arg<1){
|
||||
//case where invalid argument number is being passed
|
||||
return undefined;
|
||||
}
|
||||
if(getAdInfoType(getParameter(function)) != TYPE_RECORD_TYPE){
|
||||
return getParameter(function);
|
||||
}else{
|
||||
return getRecordNumberType(getParameter(function), arg);
|
||||
}
|
||||
}
|
||||
|
||||
TableNode* getFunctionTypeContext(Function_Stack *fs) {
|
||||
if (fs == NULL) {
|
||||
printdebug(
|
||||
|
Reference in New Issue
Block a user