aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.c
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-04-17 19:58:43 +0100
committerGinger Bill <bill@gingerbill.org>2017-04-17 19:58:43 +0100
commit0c22081e5f5aef99b702b159d9568d90f661b1e8 (patch)
treeba1034206dbe428a85ab6c79d65f84f8e90e5560 /src/check_expr.c
parent6d9fadf351d2e21e0afc357d698882c2c3198374 (diff)
Fix error printing for basic directives
Diffstat (limited to 'src/check_expr.c')
-rw-r--r--src/check_expr.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/check_expr.c b/src/check_expr.c
index afb8ce0c4..e5c88d66a 100644
--- a/src/check_expr.c
+++ b/src/check_expr.c
@@ -2366,9 +2366,9 @@ bool check_is_castable_to(Checker *c, Operand *operand, Type *y) {
return true;
}
if (is_type_string(src) && is_type_u8_slice(dst)) {
- if (is_type_typed(src)) {
+ // if (is_type_typed(src)) {
return true;
- }
+ // }
}
// proc <-> proc
@@ -2404,6 +2404,8 @@ void check_cast(Checker *c, Operand *x, Type *type) {
} else if (check_is_castable_to(c, x, type)) {
if (x->mode != Addressing_Constant) {
x->mode = Addressing_Value;
+ } else if (is_type_slice(type) && is_type_string(x->type)) {
+ x->mode = Addressing_Value;
}
can_convert = true;
}
@@ -4935,6 +4937,7 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
check_ident(c, o, node, NULL, type_hint, false);
case_end;
+
case_ast_node(bl, BasicLit, node);
Type *t = t_invalid;
switch (bl->kind) {
@@ -5929,6 +5932,11 @@ gbString write_expr_to_string(gbString str, AstNode *node) {
str = string_append_token(str, *bl);
case_end;
+ case_ast_node(bd, BasicDirective, node);
+ str = gb_string_appendc(str, "#");
+ str = gb_string_append_length(str, bd->name.text, bd->name.len);
+ case_end;
+
case_ast_node(pl, ProcLit, node);
str = write_expr_to_string(str, pl->type);
case_end;