diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-03-03 18:16:33 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-03-03 18:16:33 -0500 |
| commit | 23478e7036fe9fbee17263e52d5d8a37adce1c95 (patch) | |
| tree | 7c588c0f7b7ac2f81dbbd960a8f70b197613b229 /compile.c | |
| parent | 8fab88c56f95c03ffcb4be178f5dbb21b239d95e (diff) | |
Rename as_str -> as_text
Diffstat (limited to 'compile.c')
| -rw-r--r-- | compile.c | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -67,25 +67,25 @@ CORD compile_statement(env_t *env, ast_t *ast) return stmt; } -CORD expr_as_string(env_t *env, CORD expr, type_t *t, CORD color) +CORD expr_as_texting(env_t *env, CORD expr, type_t *t, CORD color) { switch (t->tag) { - case MemoryType: return CORD_asprintf("Memory__as_str($stack(%r), %r, &Memory)", expr, color); - case BoolType: return CORD_asprintf("Bool__as_str($stack(%r), %r, &Bool)", expr, color); + case MemoryType: return CORD_asprintf("Memory__as_text($stack(%r), %r, &Memory)", expr, color); + case BoolType: return CORD_asprintf("Bool__as_text($stack(%r), %r, &Bool)", expr, color); case IntType: { CORD name = type_to_cord(t); - return CORD_asprintf("%r__as_str($stack(%r), %r, &%r)", name, expr, color, name); + return CORD_asprintf("%r__as_text($stack(%r), %r, &%r)", name, expr, color, name); } case NumType: { CORD name = type_to_cord(t); - return CORD_asprintf("%r__as_str($stack(%r), %r, &Num%r)", name, expr, color, name); + return CORD_asprintf("%r__as_text($stack(%r), %r, &Num%r)", name, expr, color, name); } - case TextType: return CORD_asprintf("Text__as_str($stack(%r), %r, &Text)", expr, color); - case ArrayType: return CORD_asprintf("Array__as_str($stack(%r), %r, %r)", expr, color, compile_type_info(env, t)); - case TableType: return CORD_asprintf("Table_as_str($stack(%r), %r, %r)", expr, color, compile_type_info(env, t)); - case FunctionType: return CORD_asprintf("Func__as_str($stack(%r), %r, %r)", expr, color, compile_type_info(env, t)); - case PointerType: return CORD_asprintf("Pointer__as_str($stack(%r), %r, %r)", expr, color, compile_type_info(env, t)); - case StructType: case EnumType: return CORD_asprintf("(%r)->CustomInfo.as_str($stack(%r), %r, %r)", + case TextType: return CORD_asprintf("Text__as_text($stack(%r), %r, &Text)", expr, color); + case ArrayType: return CORD_asprintf("Array__as_text($stack(%r), %r, %r)", expr, color, compile_type_info(env, t)); + case TableType: return CORD_asprintf("Table_as_text($stack(%r), %r, %r)", expr, color, compile_type_info(env, t)); + case FunctionType: return CORD_asprintf("Func__as_text($stack(%r), %r, %r)", expr, color, compile_type_info(env, t)); + case PointerType: return CORD_asprintf("Pointer__as_text($stack(%r), %r, %r)", expr, color, compile_type_info(env, t)); + case StructType: case EnumType: return CORD_asprintf("(%r)->CustomInfo.as_text($stack(%r), %r, %r)", compile_type_info(env, t), expr, color, compile_type_info(env, t)); default: compiler_err(NULL, NULL, NULL, "Stringifying is not supported for %T", t); } @@ -95,7 +95,7 @@ CORD compile_string(env_t *env, ast_t *ast, CORD color) { type_t *t = get_type(env, ast); CORD expr = compile(env, ast); - return expr_as_string(env, expr, t, color); + return expr_as_texting(env, expr, t, color); } static CORD compile_to_pointer_depth(env_t *env, ast_t *ast, int64_t target_depth, bool allow_optional) @@ -882,7 +882,7 @@ CORD compile(env_t *env, ast_t *ast) CORD expr_cord = "CORD_all("; i = 1; for (ast_list_t *target = assign->targets; target; target = target->next) { - CORD item = expr_as_string(env, CORD_asprintf("$%ld", i++), get_type(env, target->ast), "USE_COLOR"); + CORD item = expr_as_texting(env, CORD_asprintf("$%ld", i++), get_type(env, target->ast), "USE_COLOR"); expr_cord = CORD_all(expr_cord, item, target->next ? ", \", \", " : CORD_EMPTY); } expr_cord = CORD_cat(expr_cord, ")"); |
