aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-07-07 17:50:45 +0100
committerGinger Bill <bill@gingerbill.org>2017-07-07 17:50:45 +0100
commitc63cb98019b3c9d0303094e2b1c67d9fff2b0e06 (patch)
treeac93723c5efbb0adee95cf311fdc3cb10b7ee616 /src/check_expr.cpp
parent773cf5ca08de0476b0b8b1ae4c25ac6da62a8059 (diff)
Fix `else do`
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index d69fcb6c7..da3967805 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -1384,6 +1384,39 @@ bool is_polymorphic_type_assignable(Checker *c, Type *poly, Type *source, bool c
case Type_Proc:
if (source->kind == Type_Proc) {
// TODO(bill): Polymorphic type assignment
+ #if 0
+ TypeProc *x = &poly->Proc;
+ TypeProc *y = &source->Proc;
+ if (x->calling_convention != y->calling_convention) {
+ return false;
+ }
+ if (x->c_vararg != y->c_vararg) {
+ return false;
+ }
+ if (x->variadic != y->variadic) {
+ return false;
+ }
+ if (x->param_count != y->param_count) {
+ return false;
+ }
+ if (x->result_count != y->result_count) {
+ return false;
+ }
+ for (isize i = 0; i < x->param_count; i++) {
+ Entity *a = x->params->Tuple.variables[i];
+ Entity *b = y->params->Tuple.variables[i];
+ bool ok = is_polymorphic_type_assignable(c, a->type, b->type, false, modify_type);
+ if (!ok) return false;
+ }
+ for (isize i = 0; i < x->result_count; i++) {
+ Entity *a = x->results->Tuple.variables[i];
+ Entity *b = y->results->Tuple.variables[i];
+ bool ok = is_polymorphic_type_assignable(c, a->type, b->type, false, modify_type);
+ if (!ok) return false;
+ }
+ // TODO(bill): Polymorphic type assignment
+ return true;
+ #endif
}
return false;
case Type_Map:
@@ -6735,6 +6768,10 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
} break;
default: {
+ if (cl->elems.count == 0) {
+ break; // NOTE(bill): No need to init
+ }
+
gbString str = type_to_string(type);
error(node, "Invalid compound literal type `%s`", str);
gb_string_free(str);