From 2629f2a471f1b230d4f2425e3b45a84c18632533 Mon Sep 17 00:00:00 2001 From: Miraculous Ladybugreport <3642643+PeyTy@users.noreply.github.com> Date: Fri, 12 Jul 2024 01:56:09 +0300 Subject: [PATCH] [C2HEXA] Fix false calling --- source/toHexa/clang/clangGenerator.hexa | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source/toHexa/clang/clangGenerator.hexa b/source/toHexa/clang/clangGenerator.hexa index c6ea397..91b2c0f 100644 --- a/source/toHexa/clang/clangGenerator.hexa +++ b/source/toHexa/clang/clangGenerator.hexa @@ -206,6 +206,14 @@ class ClangGenerator { return Node.Block([node]) } + fun nodeToStatementNode(node ClangNode) Node? { + switch node.kind { + case ParenExpr: + return Node.Block([nodeToNode(node.inner[0])]) + } + return nodeToNode(node) + } + fun nodeToNode(node ClangNode) Node? { switch node.kind { // Roots @@ -291,7 +299,7 @@ class ClangGenerator { result.push(nodeToNode(node)) result.push(nodeToNode(node.inner[0])) case _: - result.push(nodeToNode(node)) + result.push(nodeToStatementNode(node)) } } @@ -312,7 +320,7 @@ class ClangGenerator { // TODO FORMAT `while(i` while i < node.inner.length - (hasElse ? 1: 0) { let ex = node.inner[i++] - body.push(nodeToNode(ex)) + body.push(nodeToStatementNode(ex)) } if hasElse {