From 7db122648666fd4f38838208da3cfb9b63c41b5e Mon Sep 17 00:00:00 2001 From: Miraculous Ladybugreport <3642643+PeyTy@users.noreply.github.com> Date: Wed, 3 Jul 2024 15:27:30 +0300 Subject: [PATCH] [C2HEXA] MemberExpr, CharacterLiteral --- source/toHexa/clang/clangGenerator.hexa | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/source/toHexa/clang/clangGenerator.hexa b/source/toHexa/clang/clangGenerator.hexa index 0c1d13c..553c2b4 100644 --- a/source/toHexa/clang/clangGenerator.hexa +++ b/source/toHexa/clang/clangGenerator.hexa @@ -200,6 +200,11 @@ class ClangGenerator { // TODO FORMAT } case CharacterLiteral: + // TODO meta + // const value = s.value as unknown as number // TODO + // const char = JSON.stringify(String.fromCharCode(value)) + // return s.value + '/* ' + char + ' */' + return Node.Int(parseInt(node.value)) case OffsetOfExpr: case AtomicExpr: case VAArgExpr: @@ -222,6 +227,17 @@ class ClangGenerator { // TODO type return Node.Float(parseFloat(node.value), Meta.Default) case MemberExpr: + // TODO `let { name } = node` + let name = toCamelCase(node.name) + if name == "" { + return nodeToNode(node.inner[0]) + } + + if let referencedDecl = node.inner[0].referencedDecl { + // TODO return Node.Dot(referencedDecl.name, name) + } + + return Node.Dot(nodeToNode(node.inner[0]), name) case ParmVarDecl: case TextComment: case ParagraphComment: