Function calling fix

This commit is contained in:
2026-01-12 14:45:07 +11:00
parent ca8db171d9
commit c5b67bff72
2 changed files with 6 additions and 5 deletions

View File

@@ -655,7 +655,7 @@ namespace Solstice {
if (isTemp(children[1].outputId)) codeBlock.toBeDropped.push_back(children[1].outputId);
code.push_back(codeBlock);
// Make sure we know what the variable type is
variables[children[0].outputId] = children[1].data.getTypeString();
variables[children[0].outputId] = checkNodeReturnType(children[1]);
break;
}
case SolNodeType::FunctionCall: {
@@ -1268,7 +1268,7 @@ namespace Solstice {
}
case SolNodeType::BracketStart: {
// function call
if (rootNode.children.back().nodeType == SolNodeType::Identifier) {
if (!rootNode.children.empty() && rootNode.children.back().nodeType == SolNodeType::Identifier) {
SolNode fnCallNode(SolNodeType::FunctionCall);
fnCallNode.line = tokenObj.line;
fnCallNode.lineContent = tokenObj.lineContent;
@@ -1317,8 +1317,9 @@ namespace Solstice {
tokens.push_back(tokenopt.value());
}
auto node = Parser(tokens).parse();
node.nodeType = SolNodeType::Expression;
rootNode.addNode(node);
if (!node.children.empty()) {
rootNode.addNode(node.children.back());
}
}
break;
}