after removing each

This commit is contained in:
Mike Nolan 2024-09-01 22:24:36 -05:00
parent 1c607b3d7d
commit a29b328fd2
1 changed files with 2 additions and 39 deletions

View File

@ -1886,24 +1886,7 @@ namespace Tesses::WebServer::ScriptEngine
}
};
class EachNode : public Node {
public:
Node* item;
Node* list;
Node* body;
EachNode(Node* item,Node* list,Node* body)
{
this->item = item;
this->list = list;
this->body = body;
}
~EachNode()
{
delete item;
delete list;
delete body;
}
};
class FunctionDeclarationNode : public Node {
public:
@ -2954,26 +2937,7 @@ namespace Tesses::WebServer::ScriptEngine
NextTokenIs(";");
return new WhileNode(cond,body,true);
}
if(NextTokenIs("each"))
{
Ensure("(");
Node* list = ParseExpression();
Node* item = nullptr;
if(NextTokenIs(":"))
{
item = list;
list = ParseExpression();
}
else
{
item = new GetVariableExpression("item");
}
Ensure(")");
Node* body = ParseNode();
NextTokenIs(";");
return new EachNode(item,list,body);
}
if(NextTokenIs("func"))
{
Node* fn = ParseExpression();
@ -3377,7 +3341,6 @@ namespace Tesses::WebServer::ScriptEngine
auto whileNode = dynamic_cast<WhileNode*>(n);
auto breakNode = dynamic_cast<BreakNode*>(n);
auto cont = dynamic_cast<ContinueNode*>(n);
auto eachLoop = dynamic_cast<EachNode*>(n);
auto forLoop = dynamic_cast<ForNode*>(n);
auto lOr = dynamic_cast<LogicalOrExpression*>(n);
auto lAnd = dynamic_cast<LogicalAndExpression*>(n);