Skip to content

Commit

Permalink
use other methods more
Browse files Browse the repository at this point in the history
  • Loading branch information
Akuli committed Jan 10, 2025
1 parent 7c53678 commit 76432fc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
8 changes: 1 addition & 7 deletions compiler/build_cf_graph.jou
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 1 addition & 6 deletions compiler/typecheck/step3_function_and_method_bodies.jou
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 76432fc

Please sign in to comment.