Fixed casting + grouping, resolved #67

This commit is contained in:
2023-07-31 16:17:33 +10:00
parent 35bfa1b9f1
commit 10dbe8f8f1
5 changed files with 40 additions and 24 deletions

View File

@@ -757,7 +757,7 @@ static Toy_Opcode fnCall(Toy_Parser* parser, Toy_ASTNode** nodeHandle) {
//casting value
Toy_ASTNode* rhsNode = NULL;
grouping(parser, &rhsNode);
parsePrecedence(parser, &rhsNode, PREC_TERNARY);
//emit the cast node
@@ -766,6 +766,8 @@ static Toy_Opcode fnCall(Toy_Parser* parser, Toy_ASTNode** nodeHandle) {
//pass it off to the caller
*nodeHandle = lhsNode;
consume(parser, TOY_TOKEN_PAREN_RIGHT, "Expected ')' at end of cast grouping");
return TOY_OP_GROUPING_BEGIN; //dummy value
}