diff options
Diffstat (limited to 'compile.c')
| -rw-r--r-- | compile.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -48,6 +48,12 @@ static bool promote(env_t *env, CORD *code, type_t *actual, type_t *needed) if (actual->tag == IntType || actual->tag == NumType) return true; + // Text to C String + if (actual->tag == TextType && !Match(actual, TextType)->lang && needed->tag == CStringType) { + *code = CORD_all("Text$as_c_string(", *code, ")"); + return true; + } + // Automatic dereferencing: if (actual->tag == PointerType && !Match(actual, PointerType)->is_optional && can_promote(Match(actual, PointerType)->pointed, needed)) { |
