Allow empty OUT arguments
This commit is contained in:
@@ -2161,3 +2161,11 @@ class SetX : Code
|
|||||||
vm.petitcomputer.xoff(func);
|
vm.petitcomputer.xoff(func);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Pop : Code
|
||||||
|
{
|
||||||
|
override void execute(VM vm)
|
||||||
|
{
|
||||||
|
vm.decSP();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -697,6 +697,11 @@ class Compiler
|
|||||||
genCode(new PopVarExpression(sc));
|
genCode(new PopVarExpression(sc));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case NodeType.VoidExpression:
|
||||||
|
{
|
||||||
|
genCode(new Pop());
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new SyntaxError();
|
throw new SyntaxError();
|
||||||
|
|
||||||
|
|||||||
@@ -970,7 +970,18 @@ class Parser
|
|||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
token = lex.front();
|
token = lex.front();
|
||||||
|
if (token.type == TokenType.Comma)
|
||||||
|
{
|
||||||
|
func.addOut(new VoidExpression(lex.location));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Expression arg = expression();
|
Expression arg = expression();
|
||||||
|
if (!arg)
|
||||||
|
{
|
||||||
|
func.addOut(new VoidExpression(lex.location));
|
||||||
|
break;
|
||||||
|
}
|
||||||
if(!isLValue(arg))
|
if(!isLValue(arg))
|
||||||
{
|
{
|
||||||
//to support func args... OUT (no argument)
|
//to support func args... OUT (no argument)
|
||||||
@@ -982,6 +993,7 @@ class Parser
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
func.addOut(arg);
|
func.addOut(arg);
|
||||||
|
}
|
||||||
token = lex.front();
|
token = lex.front();
|
||||||
if(token.type == TokenType.Comma)
|
if(token.type == TokenType.Comma)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user