aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZachary Pierson <zacpiersonhehe@gmail.com>2017-03-31 05:31:45 -0500
committerZachary Pierson <zacpiersonhehe@gmail.com>2017-03-31 05:31:45 -0500
commit24b33374b7830fae01be1915adb14b4e45ff9550 (patch)
treebe167942eae880e27b7d95d0e935937bee6dbb05 /src
parent3315dc7f25095ddcc35a366ae4314e8463c0818a (diff)
Reverted the main proc changed, after a chat with Bill about better solutions.
Diffstat (limited to 'src')
-rw-r--r--src/check_decl.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/src/check_decl.c b/src/check_decl.c
index 0be0b6dba..7cf4080ce 100644
--- a/src/check_decl.c
+++ b/src/check_decl.c
@@ -249,30 +249,13 @@ void check_proc_lit(Checker *c, Entity *e, DeclInfo *d) {
bool is_no_inline = (pd->tags & ProcTag_no_inline) != 0;
if ((d->scope->is_file || d->scope->is_global) &&
- str_eq(e->token.string, str_lit("main"))) {
+ str_eq(e->token.string, str_lit("main"))) {
if (proc_type != NULL) {
TypeProc *pt = &proc_type->Proc;
-
- // This is an ugly monstrosity, but I see no other way.
- bool valid_param = pt->param_count == 0 || (pt->params->kind == Type_Tuple &&
- pt->params->Tuple.variable_count == 2 &&
- pt->params->Tuple.variables[0]->kind == Entity_Variable &&
- pt->params->Tuple.variables[0]->type->kind == Type_Basic &&
- pt->params->Tuple.variables[0]->type->Basic.kind == Basic_i32 &&
- pt->params->Tuple.variables[1]->kind == Entity_Variable &&
- pt->params->Tuple.variables[1]->type->kind == Type_Slice &&
- pt->params->Tuple.variables[1]->type->Slice.elem->kind == Type_Pointer &&
- pt->params->Tuple.variables[1]->type->Slice.elem->Pointer.elem->kind == Type_Basic &&
- pt->params->Tuple.variables[1]->type->Slice.elem->Pointer.elem->Basic.kind == Basic_u8);
-
- bool valid_result = pt->result_count == 0 || (pt->results->kind == Type_Tuple &&
- pt->results->Tuple.variable_count == 1 &&
- pt->results->Tuple.variables[0]->kind == Entity_Variable &&
- pt->results->Tuple.variables[0]->type->kind == Type_Basic &&
- pt->results->Tuple.variables[0]->type->Basic.kind == Basic_i32);
- if (!valid_param || !valid_result) {
+ if (pt->param_count != 0 ||
+ pt->result_count != 0) {
gbString str = type_to_string(proc_type);
- error(e->token, "Procedure type of `main` was expected to be `proc()` or `proc(i32, []^byte) -> i32`, got %s", str);
+ error(e->token, "Procedure type of `main` was expected to be `proc()`, got %s", str);
gb_string_free(str);
}
}