Skip to content

Commit

Permalink
Pass reference to intl instance to fui.text()
Browse files Browse the repository at this point in the history
  • Loading branch information
dapetcu21 committed Sep 30, 2021
1 parent 431c752 commit 9510af5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions fuior_compiler/native_extension/src/fuior_emit_lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ static void emit_intl_string_key(fuior_state * state, TSNode node) {
free(s);
}

static void emit_intl_interpolations(fuior_state * state, TSNode node, const char * prefix) {
static bool emit_intl_interpolations(fuior_state * state, TSNode node, const char * prefix) {
int interpolation_count = 0;
for (uint32_t i = 0, n = ts_node_named_child_count(node); i < n; i += 1) {
TSNode child = ts_node_named_child(node, i);
Expand All @@ -243,7 +243,9 @@ static void emit_intl_interpolations(fuior_state * state, TSNode node, const cha
state->indent -= 1;
emit_indent(state);
emit("}");
return true;
}
return false;
}

static void emit_intl_string(fuior_state * state, TSNode node) {
Expand Down Expand Up @@ -409,7 +411,10 @@ static void emit_text_statement(fuior_state * state, TSNode node) {
emit("nil, ");
}
emit_intl_string_key(state, child);
emit_intl_interpolations(state, child, ", ");
if (!emit_intl_interpolations(state, child, ", ")) {
emit(", nil");
}
emit(", intl");
}
}

Expand Down

0 comments on commit 9510af5

Please sign in to comment.