BUGFIX: chained calls not being dottified

This commit is contained in:
2022-11-04 11:13:40 +01:00
parent cceefa6375
commit 5d240f85a6
4 changed files with 11 additions and 62 deletions

View File

@@ -798,12 +798,6 @@ static Opcode dot(Parser* parser, ASTNode** nodeHandle) {
return OP_EOF;
}
//hijack the function call, and hack in an extra parameter
if (node->binary.opcode == OP_FN_CALL) {
node->binary.right->fnCall.argumentCount++;
node->binary.opcode = OP_DOT;
}
(*nodeHandle) = node;
return OP_DOT; //signal that the function name and arguments are in the wrong order
}
@@ -1090,6 +1084,7 @@ static void dottify(Parser* parser, ASTNode** nodeHandle) {
if ((*nodeHandle)->type == AST_NODEBINARY) {
if ((*nodeHandle)->binary.opcode == OP_FN_CALL) {
(*nodeHandle)->binary.opcode = OP_DOT;
(*nodeHandle)->binary.right->fnCall.argumentCount++;
}
dottify(parser, &(*nodeHandle)->binary.left);
dottify(parser, &(*nodeHandle)->binary.right);