aboutsummaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-12-22 15:31:58 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-12-22 15:31:58 -0500
commit2a12cb869ba7ae81513e771bb0dab670a80f0e32 (patch)
tree185d04899cbe0cf69ce6aa1195e53d51e54ea3b1 /compile.c
parent46b61d3ed2ae5bd5f74c9d580f5501b1226d9f4e (diff)
Bugfixes for table updates and array concat updates
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/compile.c b/compile.c
index 38b6f754..018827ff 100644
--- a/compile.c
+++ b/compile.c
@@ -366,7 +366,7 @@ static CORD compile_lvalue(env_t *env, ast_t *ast)
if (table_type->default_value) {
type_t *value_type = get_type(env, table_type->default_value);
return CORD_all("*Table$get_or_setdefault(",
- compile_lvalue(env, index->indexed), ", ",
+ compile_to_pointer_depth(env, index->indexed, 1, false), ", ",
compile_type(table_type->key_type), ", ",
compile_type(value_type), ", ",
compile(env, index->index), ", ",
@@ -871,7 +871,7 @@ CORD compile_statement(env_t *env, ast_t *ast)
if (update->lhs->tag == Var)
return CORD_all("Array$insert_all(&", lhs, ", ", rhs, ", I(0), ", padded_item_size, ");");
else
- return CORD_all(lhs, "Array$concat(", lhs, ", ", rhs, ", ", padded_item_size, ");");
+ return CORD_all(lhs, " = Array$concat(", lhs, ", ", rhs, ", ", padded_item_size, ");");
} else {
code_err(ast, "'++=' is not implemented for %T types", lhs_t);
}
@@ -3682,7 +3682,7 @@ CORD compile(env_t *env, ast_t *ast)
if (table_type->default_value) {
type_t *value_type = get_type(env, table_type->default_value);
return CORD_all("Table$get_or_default(",
- compile(env, indexing->indexed), ", ",
+ compile_to_pointer_depth(env, indexing->indexed, 0, false), ", ",
compile_type(table_type->key_type), ", ",
compile_type(value_type), ", ",
compile(env, indexing->index), ", ",