Skip to content

Commit

Permalink
[typer] cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Simn committed Jun 9, 2020
1 parent aa51275 commit 1cc4752
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 19 deletions.
10 changes: 0 additions & 10 deletions src/context/typecore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ and typer = {
}

and monomorphs = {
mutable percall : (tmono * pos) list;
mutable perfunction : (tmono * pos) list;
}

Expand Down Expand Up @@ -523,19 +522,10 @@ let merge_core_doc ctx mt =
let spawn_constrained_monos ctx p map params =
let monos = List.map (fun (s,_) ->
let mono = Monomorph.create() in
(* if Meta.has (Meta.Custom ":debug.monomorphs") ctx.curfield.cf_meta then Monomorph.add_constraint mono "debug" p (MDebug s); *)
ctx.monomorphs.percall <- (mono,p) :: ctx.monomorphs.percall;
TMono mono
) params in
monos

let with_contextual_monos ctx f =
let old_monos = ctx.monomorphs.percall in
ctx.monomorphs.percall <- [];
let r = f() in
ctx.monomorphs.percall <- old_monos;
r

(* -------------- debug functions to activate when debugging typer passes ------------------------------- *)
(*/*
Expand Down
4 changes: 1 addition & 3 deletions src/typing/calls.ml
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,7 @@ let type_generic_function ctx (e,fa) el ?(using_param=None) with_type p =
| WithType.WithType(t,_) -> unify ctx ret t p
| _ -> ()
end;
let el,_ = with_contextual_monos ctx (fun () ->
unify_call_args ctx el args ret p false false
) in
let el,_ = unify_call_args ctx el args ret p false false in
begin try
check_constraints ctx cf.cf_name cf.cf_params monos map false p
with Unify_error l ->
Expand Down
1 change: 0 additions & 1 deletion src/typing/typeloadModule.ml
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,6 @@ let type_types_into_module ctx m tdecls p =
opened = [];
in_call_args = false;
monomorphs = {
percall = [];
perfunction = [];
};
vthis = None;
Expand Down
7 changes: 2 additions & 5 deletions src/typing/typer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2403,10 +2403,8 @@ and type_call_target ctx e with_type inline p =

and type_call ?(mode=MGet) ctx e el (with_type:WithType.t) inline p =
let def () =
with_contextual_monos ctx (fun () ->
let e = type_call_target ctx e with_type inline p in
build_call ~mode ctx e el with_type p;
)
let e = type_call_target ctx e with_type inline p in
build_call ~mode ctx e el with_type p;
in
match e, el with
| (EConst (Ident "trace"),p) , e :: el ->
Expand Down Expand Up @@ -2698,7 +2696,6 @@ let rec create com =
vthis = None;
in_call_args = false;
monomorphs = {
percall = [];
perfunction = [];
};
on_error = (fun ctx msg p -> ctx.com.error msg p);
Expand Down

0 comments on commit 1cc4752

Please sign in to comment.