edited function definitions
This commit is contained in:
@ -185,6 +185,7 @@ definition:
|
|||||||
|| type_of_param_type == TYPE_PRIMITIVE
|
|| type_of_param_type == TYPE_PRIMITIVE
|
||||||
|| 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_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 being passed in to function definition is %s which is invalid", getAdInfo(parameter));
|
printdebug("[TYPE CHECK] type of parameter being passed in to function definition is %s which is invalid", getAdInfo(parameter));
|
||||||
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
|
||||||
@ -192,7 +193,15 @@ definition:
|
|||||||
if(type_of_param_type == TYPE_UNDEFINED){
|
if(type_of_param_type == TYPE_UNDEFINED){
|
||||||
CreateEntry(cur,type_of_param_type, undefined, NULL, NULL);
|
CreateEntry(cur,type_of_param_type, undefined, NULL, NULL);
|
||||||
} else {
|
} else {
|
||||||
CreateEntry(cur, getAdInfoType(parameter), parameter,NULL, getAdInfo(parameter));
|
if(type_of_param_type == TYPE_FUNCTION_TYPE){
|
||||||
|
CreateEntry(cur, TYPE_FUNCTION_DECLARATION, parameter,NULL, getAdInfo(parameter));
|
||||||
|
}
|
||||||
|
if(type_of_param_type == TYPE_ARRAY_TYPE){
|
||||||
|
CreateEntry(cur, TYPE_ARRAY, parameter,NULL, getAdInfo(parameter));
|
||||||
|
}
|
||||||
|
if(type_of_param_type == TYPE_PRIMITIVE_TYPE){
|
||||||
|
CreateEntry(cur, TYPE_PRIMITIVE, parameter,NULL, getAdInfo(parameter));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (TableNode* entry = getFirstEntry(getRecList(parameter)); entry!= NULL; entry = getNextEntry(entry)){
|
for (TableNode* entry = getFirstEntry(getRecList(parameter)); entry!= NULL; entry = getNextEntry(entry)){
|
||||||
@ -200,22 +209,32 @@ definition:
|
|||||||
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_DECLARATION
|
||||||
|| type_of_param_type == TYPE_ARRAY
|
|| type_of_param_type == TYPE_ARRAY
|
||||||
|
|| type_of_param_type == TYPE_PRIMITIVE
|
||||||
|| 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_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 being passed in to AS function definition is %s which is invalid", getName(entry));
|
printdebug("[TYPE CHECK] type of parameter (if record) inside record being passed in to function definition is %s which is invalid", getAdInfo(parameter));
|
||||||
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", getName(entry));
|
||||||
|
}
|
||||||
|
if(type_of_param_type == TYPE_UNDEFINED){
|
||||||
|
CreateEntry(cur,type_of_param_type, undefined, NULL, NULL);
|
||||||
|
} else {
|
||||||
|
if(type_of_param_type == TYPE_FUNCTION_TYPE){
|
||||||
|
CreateEntry(cur, TYPE_FUNCTION_DECLARATION, entry,NULL, getAdInfo(entry));
|
||||||
|
}
|
||||||
|
if(type_of_param_type == TYPE_ARRAY_TYPE){
|
||||||
|
CreateEntry(cur, TYPE_ARRAY, entry,NULL, getAdInfo(entry));
|
||||||
|
}
|
||||||
|
if(type_of_param_type == TYPE_PRIMITIVE_TYPE){
|
||||||
|
CreateEntry(cur, TYPE_PRIMITIVE, entry,NULL, getAdInfo(entry));
|
||||||
|
}
|
||||||
|
/*printdebug("creating entry of type %s for function", getType(entry));
|
||||||
|
CreateEntry(cur, getTypeEntry(entry), "undefined", NULL);*/
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(type_of_param_type == TYPE_UNDEFINED){
|
|
||||||
CreateEntry(cur,type_of_param_type, undefined, NULL, NULL);
|
|
||||||
} else {
|
|
||||||
CreateEntry(cur,type_of_param_type, entry, NULL, getAdInfo(entry));
|
|
||||||
/*printdebug("creating entry of type %s for function", getType(entry));
|
|
||||||
CreateEntry(cur, getTypeEntry(entry), "undefined", NULL);*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} idlist {
|
} idlist {
|
||||||
printdebug("Currently see a function definition taking one paramter (with as) of name %s and number of arguments %d", $1,$5);
|
printdebug("Currently see a function definition taking one paramter (with as) of name %s and number of arguments %d", $1,$5);
|
||||||
|
@ -5,7 +5,7 @@ type rec: [integer: x; integer: y]
|
|||||||
type T1: integer -> integer
|
type T1: integer -> integer
|
||||||
type T2: rec -> integer
|
type T2: rec -> integer
|
||||||
type arr: 1 -> integer
|
type arr: 1 -> integer
|
||||||
|
type w : rec
|
||||||
function foo: T1
|
function foo: T1
|
||||||
function bar1: T2
|
function bar1: T2
|
||||||
function bar2: T2
|
function bar2: T2
|
||||||
|
Reference in New Issue
Block a user