I think it works now as the types are in the same order as instructions

So I guess that works
This commit is contained in:
Tristan B. Velloza Kildaire 2022-02-20 14:27:56 +02:00
parent 76f0d6e1a9
commit 4677cacdf1
1 changed files with 36 additions and 34 deletions

View File

@ -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) // while(formalTypeackCount < formalTypes.length)
{ // {
/* Check if the type stack is empty */ // /* Check if the type stack is empty */
if(isTypesEmpty) // if(isTypesEmpty)
{ // {
gprintln("Expected arguments for function that still requires formal parameters", DebugType.ERROR); // gprintln("Expected arguments for function that still requires formal parameters", DebugType.ERROR);
assert(false); // assert(false);
} // }
/* If the type stack is not empty */ // /* If the type stack is not empty */
else // else
{ // {
/* Pop a type of the type stack (argument/actual type) */ // /* Pop a type of the type stack (argument/actual type) */
Type actualType = popType(); // Type actualType = popType();
/* Get the formal type */ // /* Get the formal type */
} // }
/* Get current formal type */ // /* Get current formal type */
Type formalType = formalTypes[] // Type formalType = formalTypes[]
isSameType // isSameType
formalTypeackCount++; // formalTypeackCount++;
} // }
} // }