need to update argument list for the right context
This commit is contained in:
@ -1242,12 +1242,20 @@ assignable:
|
|||||||
cur = CreateScope(cur, -2,-1);
|
cur = CreateScope(cur, -2,-1);
|
||||||
}else{
|
}else{
|
||||||
cur = CreateScope(cur, -1,-1);
|
cur = CreateScope(cur, -1,-1);
|
||||||
}}
|
}
|
||||||
|
|
||||||
|
if(getAdInfoType((TableNode*)$1) == TYPE_FUNCTION_DECLARATION){
|
||||||
|
//the function context is created. Pushing the type of the function since that has the information needed
|
||||||
|
PushFunction(1, getTypeEntry((TableNode*)$1));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
//we have to consider emmissions in ablocks
|
//we have to consider emmissions in ablocks
|
||||||
ablock
|
ablock
|
||||||
{
|
{
|
||||||
//PopContext();
|
//PopContext();
|
||||||
//int type = getAdInfoType(look_up(getParent(cur), getName((TableNode*)$1)));
|
//int type = getAdInfoType(look_up(getParent(cur), getName((TableNode*)$1)));
|
||||||
|
PopFunction();
|
||||||
int type = getAdInfoType(getTypeEntry((TableNode*)$1));
|
int type = getAdInfoType(getTypeEntry((TableNode*)$1));
|
||||||
printdebug("%stype is %d", COLOR_PURPLE, type);
|
printdebug("%stype is %d", COLOR_PURPLE, type);
|
||||||
printdebug("%s", getName((TableNode*)$1));
|
printdebug("%s", getName((TableNode*)$1));
|
||||||
|
@ -124,6 +124,48 @@ int getArgumentNumber(Function_Stack *fs) {
|
|||||||
return fs->arg;
|
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) {
|
TableNode* getFunctionTypeContext(Function_Stack *fs) {
|
||||||
if (fs == NULL) {
|
if (fs == NULL) {
|
||||||
printdebug(
|
printdebug(
|
||||||
|
@ -149,6 +149,8 @@ int getPrimSize(TableNode *definition);
|
|||||||
AdInfo *CreateArrayInfo(int dim, TableNode *type);
|
AdInfo *CreateArrayInfo(int dim, TableNode *type);
|
||||||
int getNumArrDim(TableNode *definition);
|
int getNumArrDim(TableNode *definition);
|
||||||
TableNode *getArrType(TableNode *definition);
|
TableNode *getArrType(TableNode *definition);
|
||||||
|
TableNode* getRecordNumberType(TableNode* record, int arg);
|
||||||
|
TableNode* getFunctionNumberType(TableNode* function, int arg);
|
||||||
AdInfo *CreateRecordInfo(int length, SymbolTable *recordScope);
|
AdInfo *CreateRecordInfo(int length, SymbolTable *recordScope);
|
||||||
int getRecTotal(TableNode *node);
|
int getRecTotal(TableNode *node);
|
||||||
TableNode *setRecOffsetInfo(SymbolTable *scope, TableNode *node);
|
TableNode *setRecOffsetInfo(SymbolTable *scope, TableNode *node);
|
||||||
|
Reference in New Issue
Block a user