Parse exprs in parens

This commit is contained in:
2026-04-09 11:43:00 +10:00
parent 70dc5eb5a0
commit 6988f314b0

View File

@@ -226,6 +226,9 @@ ResultType(SolsType, charptr) getNodeType(SolsNode* node, SolsScope* scope) {
}
return Success(SolsType, charptr, *var->typeinfo.returnType);
}
case SNT_EXPR_IN_PAREN: {
return getNodeType(&node->children.at[node->children.count - 1], scope);
}
}
return Error(SolsType, charptr, "Not yet implemented");
}
@@ -606,6 +609,13 @@ ResultType(GroundProgram, charptr) generateCodeBlockNode(SolsNode* node, SolsSco
return Success(GroundProgram, charptr, groundCreateProgram());
}
ResultType(GroundProgram, charptr) generateExprInParenNode(SolsNode* node, SolsScope* scope) {
// All that needs to be done is to return the child's return id
node->accessArg = node->children.at[node->children.count - 1].accessArg;
(void)scope;
return Success(GroundProgram, charptr, groundCreateProgram());
}
static inline ResultType(GroundProgram, charptr) generateWhileNode(SolsNode* node, SolsScope* scope) {
GroundProgram gp = groundCreateProgram();
@@ -1019,6 +1029,7 @@ ResultType(GroundProgram, charptr) generateCode(SolsNode* node, SolsScope* scope
case SNT_OP_EQGREATER: generate(EqGreater);
case SNT_OP_LESSER: generate(Lesser);
case SNT_OP_EQLESSER: generate(EqLesser);
case SNT_EXPR_IN_PAREN: generate(ExprInParen);
case SNT_CODE_BLOCK: generate(CodeBlock);
case SNT_IF: generate(If);
case SNT_WHILE: generate(While);