From d3aa4fffeb22aa7684a20529c622a411533f776e Mon Sep 17 00:00:00 2001 From: Niels Bross Date: Wed, 11 Sep 2024 13:21:03 +0200 Subject: [PATCH] Quick fix for binary expr codegen. Add uv hint --- Codegen.jai | 2 ++ module.jai | 3 +++ 2 files changed, 5 insertions(+) diff --git a/Codegen.jai b/Codegen.jai index b264469..b35ca10 100644 --- a/Codegen.jai +++ b/Codegen.jai @@ -386,6 +386,7 @@ emit_node :: (state : *Codegen_State, node : *AST_Node, indentation : int) { } case .Binary; { indent(*state.builder, indentation); + append(*state.builder, "("); lhs := node.children[0]; rhs := node.children[1]; emit_node(state, lhs, 0); @@ -394,6 +395,7 @@ emit_node :: (state : *Codegen_State, node : *AST_Node, indentation : int) { emit_operator(state, node.token.kind); append(*state.builder, " "); emit_node(state, rhs, 0); + append(*state.builder, ")"); } case .Unary; { assert(false, "Not implemented yet: unary"); diff --git a/module.jai b/module.jai index 2a2de04..dd45541 100644 --- a/module.jai +++ b/module.jai @@ -56,6 +56,7 @@ Hint_Kind :: enum { None; Position; + UV; Target; Custom; @@ -348,6 +349,8 @@ type_variable_to_field :: (checker : *Semantic_Checker, variable : *Type_Variabl if hint.ident_value == "position" { // @Incomplete(nb): Should be a lookup table somewhere field_hint.kind = .Position; + } else if hint.ident_value == "uv" { + field_hint.kind = .UV; } else if starts_with(hint.ident_value, "target") { // @Incomplete(nb): Should be a lookup table somewhere index_str : string;