|
|
@ -344,48 +344,50 @@ public final class TypeChecker
|
|
|
|
/* TODO: Current bug is that the instructions are byte then int but types are popping int then byte
|
|
|
|
/* TODO: Current bug is that the instructions are byte then int but types are popping int then byte
|
|
|
|
due to the insertion being puishing infront, I recommend we do an initial run through first */
|
|
|
|
due to the insertion being puishing infront, I recommend we do an initial run through first */
|
|
|
|
|
|
|
|
|
|
|
|
/* Formal types (per function definition) */
|
|
|
|
ulong parmCount = paremeters.length-1;
|
|
|
|
Type[] formalTypes;
|
|
|
|
|
|
|
|
foreach(Variable parameter; paremeters)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
formalTypes ~= getType(func.parentOf(), parameter.getType());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* If there are no parameters */
|
|
|
|
// /* Formal types (per function definition) */
|
|
|
|
if(!paremeters.length)
|
|
|
|
// Type[] formalTypes;
|
|
|
|
{
|
|
|
|
// foreach(Variable parameter; paremeters)
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// formalTypes ~= getType(func.parentOf(), parameter.getType());
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
// /* If there are no parameters */
|
|
|
|
else
|
|
|
|
// if(!paremeters.length)
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
ulong formalTypeCount = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// else
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// ulong formalTypeCount = 0;
|
|
|
|
|
|
|
|
|
|
|
|
while(formalTypeackCount < formalTypes.length)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/* Check if the type stack is empty */
|
|
|
|
|
|
|
|
if(isTypesEmpty)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
gprintln("Expected arguments for function that still requires formal parameters", DebugType.ERROR);
|
|
|
|
|
|
|
|
assert(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If the type stack is not empty */
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/* Pop a type of the type stack (argument/actual type) */
|
|
|
|
|
|
|
|
Type actualType = popType();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Get the formal type */
|
|
|
|
// while(formalTypeackCount < formalTypes.length)
|
|
|
|
}
|
|
|
|
// {
|
|
|
|
|
|
|
|
// /* Check if the type stack is empty */
|
|
|
|
|
|
|
|
// if(isTypesEmpty)
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// gprintln("Expected arguments for function that still requires formal parameters", DebugType.ERROR);
|
|
|
|
|
|
|
|
// assert(false);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// /* If the type stack is not empty */
|
|
|
|
|
|
|
|
// else
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// /* Pop a type of the type stack (argument/actual type) */
|
|
|
|
|
|
|
|
// Type actualType = popType();
|
|
|
|
|
|
|
|
|
|
|
|
/* Get current formal type */
|
|
|
|
// /* Get the formal type */
|
|
|
|
Type formalType = formalTypes[]
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
isSameType
|
|
|
|
// /* Get current formal type */
|
|
|
|
|
|
|
|
// Type formalType = formalTypes[]
|
|
|
|
|
|
|
|
|
|
|
|
formalTypeackCount++;
|
|
|
|
// isSameType
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
// formalTypeackCount++;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|