wrote on n sub unit test and made necessary fixes

This commit is contained in:
Samuel D. Crow
2022-08-04 21:18:26 -05:00
parent ede1b24458
commit 7930b048b8
5 changed files with 88 additions and 36 deletions

View File

@@ -33,18 +33,18 @@ void fn::dumpFunctionIDs()
void fn::generateOnNSub(expression *e, unsigned int skip)
{
label *r=new label();
output_cpp << "callStack=new subroutine(" << r->getID() << ");\n";
label *retLabel=new label();
output_cpp << "callStack=new subroutine(" << retLabel->getID() << ");\n";
label::generateOnNTo(e, skip);
r->generate();
retLabel->generate();
}
void fn::generateGosub(label *sub)
{
label *r=new label();
output_cpp << "callStack=new subroutine(" << r->getID() << ");\n";
label *retLabel=new label();
output_cpp << "callStack=new subroutine(" << retLabel->getID() << ");\n";
sub->generateJumpTo();
r->generate();
retLabel->generate();
}
fn *fn::getSub(string &name)
@@ -285,7 +285,7 @@ fn::fn(enum CODES t, operands *returnCode)
{
funcs_h << "struct f" << this->id <<":public subroutine\n{\nf"
<< this->id << "(unsigned int x):subroutine(x)\n{}\n"
<< "virtual ~f" << this->id <<"()\n{}\n\n";
<< "virtual ~f" << this->id <<"()\n{}\n";
}
/*keep track of where the return code will be sent to*/
this->rc=returnCode;