aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-01-10 21:13:20 +0000
committergingerBill <bill@gingerbill.org>2018-01-10 21:13:20 +0000
commit82057f08cee867057919c00a96f938283baad4fd (patch)
tree8a58411dc2b217c12c712e9006cb175cc9274024
parent1553421e1a0980361275cefda35afb4695bc6e87 (diff)
Fix issue #172
-rw-r--r--src/ir.cpp4
-rw-r--r--src/parser.cpp2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 40bef0805..789c32317 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -1626,9 +1626,11 @@ irValue *ir_emit_call(irProcedure *p, irValue *value, irValue **args, isize arg_
context_ptr = ir_find_or_generate_context_ptr(p);
}
+ bool is_c_vararg = pt->Proc.c_vararg;
isize param_count = pt->Proc.param_count;
- if (pt->Proc.c_vararg) {
+ if (is_c_vararg) {
GB_ASSERT(param_count-1 <= arg_count);
+ param_count -= 1;
} else {
GB_ASSERT_MSG(param_count == arg_count, "%td == %td", param_count, arg_count);
}
diff --git a/src/parser.cpp b/src/parser.cpp
index 5e5fb7ac0..7810c0e01 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -3965,7 +3965,7 @@ AstNode *parse_switch_stmt(AstFile *f) {
body = ast_block_stmt(f, list, open, close);
if (!is_type_match) {
- tag = convert_stmt_to_expr(f, tag, str_lit("match expression"));
+ tag = convert_stmt_to_expr(f, tag, str_lit("switch expression"));
return ast_switch_stmt(f, token, init, tag, body);
} else {
return ast_type_switch_stmt(f, token, tag, body);