Skip to content

Commit

Permalink
[C2HEXA] MemberExpr, CharacterLiteral
Browse files Browse the repository at this point in the history
  • Loading branch information
PeyTy committed Jul 3, 2024
1 parent 4d31bee commit 7db1226
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions source/toHexa/clang/clangGenerator.hexa
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 7db1226

Please sign in to comment.