Filename as default import name; as .; as _; panic()

This commit is contained in:
Ginger Bill
2016-09-21 14:46:56 +01:00
parent 31c11a5037
commit 0e2347e582
14 changed files with 313 additions and 167 deletions
+17 -1
View File
@@ -1534,7 +1534,9 @@ b32 check_is_castable_to(Checker *c, Operand *operand, Type *y) {
return true;
}
if (is_type_string(xb) && is_type_u8_slice(yb)) {
return true;
if (is_type_typed(xb)) {
return true;
}
}
// proc <-> proc
@@ -2422,6 +2424,20 @@ b32 check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id)
}
break;
case BuiltinProc_panic:
// panic :: proc(msg: string)
if (!is_type_string(operand->type)) {
gbString str = expr_to_string(ce->args[0]);
defer (gb_string_free(str));
error(ast_node_token(call),
"`%s` is not a string", str);
return false;
}
operand->mode = Addressing_NoValue;
break;
case BuiltinProc_copy: {
// copy :: proc(x, y: []Type) -> int
Type *dest_type = NULL, *src_type = NULL;