fixed type check issues with records as params
This commit is contained in:
@ -208,32 +208,37 @@ definition:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
printdebug("record found");
|
||||||
for (TableNode* entry = getFirstEntry(getRecList(parameter)); entry!= NULL; entry = getNextEntry(entry)){
|
for (TableNode* entry = getFirstEntry(getRecList(parameter)); entry!= NULL; entry = getNextEntry(entry)){
|
||||||
int type_of_param_type = getAdInfoType(entry);
|
int type_of_param_type = getAdInfoType(entry);
|
||||||
if( type_of_param_type == TYPE_UNDEFINED
|
if( type_of_param_type == TYPE_UNDEFINED
|
||||||
|| type_of_param_type == TYPE_FUNCTION_DECLARATION
|
|| type_of_param_type == TYPE_FUNCTION_TYPE
|
||||||
|| type_of_param_type == TYPE_ARRAY
|
|| type_of_param_type == TYPE_ARRAY_TYPE
|
||||||
|| type_of_param_type == TYPE_PRIMITIVE
|
|| type_of_param_type == TYPE_PRIMITIVE_TYPE
|
||||||
|| type_of_param_type == TYPE_ALL_ELSE
|
|| type_of_param_type == TYPE_ALL_ELSE
|
||||||
|| type_of_param_type == TYPE_SYSTEM_DEFINED
|
|| type_of_param_type == TYPE_SYSTEM_DEFINED
|
||||||
|| type_of_param_type == TYPE_RECORD
|
|| type_of_param_type == TYPE_RECORD_TYPE
|
||||||
|| type_of_param_type == TYPE_STRING){ // note that strings are actually arrays so this is unused
|
|| type_of_param_type == TYPE_STRING){ // note that strings are actually arrays so this is unused
|
||||||
printdebug("[TYPE CHECK] type of parameter (if record) inside record being passed in to function definition is %s which is invalid", getAdInfo(parameter));
|
printdebug("[TYPE CHECK] type of parameter (if record) inside record being passed in to function definition is %s which is invalid", getType(entry));
|
||||||
type_of_param_type = TYPE_UNDEFINED; // setting tag as undefined in these cases
|
type_of_param_type = TYPE_UNDEFINED; // setting tag as undefined in these cases
|
||||||
}else{
|
}else{
|
||||||
printdebug("type of parameter correctly being passed in to AS function definition is %s which is valid", getName(entry));
|
printdebug("type of parameter correctly being passed in to AS function definition is %s which is valid", getType(entry));
|
||||||
}
|
}
|
||||||
if(type_of_param_type == TYPE_UNDEFINED){
|
if(type_of_param_type == TYPE_UNDEFINED){
|
||||||
|
printdebug("undefined type of parameter inside record");
|
||||||
CreateEntry(cur,type_of_param_type, undefined, NULL, NULL);
|
CreateEntry(cur,type_of_param_type, undefined, NULL, NULL);
|
||||||
} else {
|
} else {
|
||||||
if(type_of_param_type == TYPE_FUNCTION_TYPE){
|
if(type_of_param_type == TYPE_FUNCTION_DECLARATION){
|
||||||
CreateEntry(cur, TYPE_FUNCTION_DECLARATION, entry,NULL, getAdInfo(entry));
|
printdebug("function declaration of parameter inside record");
|
||||||
|
CreateEntry(cur, TYPE_FUNCTION_DECLARATION, getTypeEntry(entry),NULL, getAdInfo(entry));
|
||||||
}
|
}
|
||||||
if(type_of_param_type == TYPE_ARRAY_TYPE){
|
if(type_of_param_type == TYPE_ARRAY){
|
||||||
CreateEntry(cur, TYPE_ARRAY, entry,NULL, getAdInfo(entry));
|
printdebug("array type of parameter inside record");
|
||||||
|
CreateEntry(cur, TYPE_ARRAY, getTypeEntry(entry),NULL, getAdInfo(entry));
|
||||||
}
|
}
|
||||||
if(type_of_param_type == TYPE_PRIMITIVE_TYPE){
|
if(type_of_param_type == TYPE_PRIMITIVE){
|
||||||
CreateEntry(cur, TYPE_PRIMITIVE, entry,NULL, getAdInfo(entry));
|
printdebug("primitive type of parameter inside record");
|
||||||
|
CreateEntry(cur, TYPE_PRIMITIVE, getTypeEntry(entry),NULL, getAdInfo(entry));
|
||||||
}
|
}
|
||||||
/*printdebug("creating entry of type %s for function", getType(entry));
|
/*printdebug("creating entry of type %s for function", getType(entry));
|
||||||
CreateEntry(cur, getTypeEntry(entry), "undefined", NULL);*/
|
CreateEntry(cur, getTypeEntry(entry), "undefined", NULL);*/
|
||||||
|
@ -48,7 +48,6 @@ foo (x) := {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bar1(a,b) := {
|
bar1(a,b) := {
|
||||||
[integer : t]
|
|
||||||
return a * b;
|
return a * b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user