diff --git a/compiler/build_cf_graph.jou b/compiler/build_cf_graph.jou index f2a98e0f..4b1e7811 100644 --- a/compiler/build_cf_graph.jou +++ b/compiler/build_cf_graph.jou @@ -531,19 +531,13 @@ def build_function_or_method_call( if call->method_call_self != NULL: selfclass = get_expr_types(st, call->method_call_self)->type - if call->uses_arrow_operator: assert selfclass->kind == TypeKind::Pointer selfclass = selfclass->value_type - assert selfclass->kind == TypeKind::Class sig = selfclass->find_method(call->name) - else: - for f = st->filetypes->functions; f < &st->filetypes->functions[st->filetypes->nfunctions]; f++: - if strcmp(f->signature.name, call->name) == 0: - sig = &f->signature - break + sig = st->filetypes->find_function(call->name) assert sig != NULL diff --git a/compiler/typecheck/step3_function_and_method_bodies.jou b/compiler/typecheck/step3_function_and_method_bodies.jou index 195fdf4d..236c194a 100644 --- a/compiler/typecheck/step3_function_and_method_bodies.jou +++ b/compiler/typecheck/step3_function_and_method_bodies.jou @@ -1148,13 +1148,8 @@ def typecheck_step3_function_and_method_bodies(ft: FileTypes*, ast: AstFile*) -> for i = 0; i < ast->body.nstatements; i++: stmt = &ast->body.statements[i] if stmt->kind == AstStatementKind::Function and stmt->function.body.nstatements > 0: - sig: Signature* = NULL - for f = ft->functions; f < &ft->functions[ft->nfunctions]; f++: - if strcmp(f->signature.name, stmt->function.signature.name) == 0: - sig = &f->signature - break + sig = ft->find_function(stmt->function.signature.name) assert sig != NULL - typecheck_function_or_method_body(ft, sig, &stmt->function.body) if stmt->kind == AstStatementKind::Class: