Project

General

Profile

« Previous | Next » 

Revision fc36d0a0

Added by Xavier Thirioux over 1 year ago

added some cleaning about hash-tables used for typing, clocking, etc.

View differences:

src/typing.ml
267 267
    (* Expected type ty1, got type ty2 *)
268 268
    let try_unify ?(sub=false) ?(semi=false) ty1 ty2 loc =
269 269
      try
270
        (*Format.eprintf "try_unify %B %B %a %a@." sub semi print_ty ty1 print_ty ty2;*)
270 271
        unify ~sub:sub ~semi:semi ty1 ty2
271 272
      with
272 273
      | Unify _ ->
......
531 532
           expr.expr_type <- Expr_type_hub.export typ_out;
532 533
           typ_out
533 534
      in 
534
      Log.report ~level:3 (fun fmt -> Format.fprintf fmt "Type of expr %a: %a@." Printers.pp_expr expr (* Types. *)print_ty resulting_ty);
535
      Log.report ~level:4 (fun fmt -> Format.fprintf fmt "Type of expr %a: %a@." Printers.pp_expr expr (* Types. *)print_ty resulting_ty);
535 536
      resulting_ty
536 537

  
537 538
    and type_branches ?(is_annot=false) env in_main loc const hl =
......
625 626
      | _                   -> ()
626 627

  
627 628
    let type_var_decl vd_env env vdecl =
628
      (*Format.eprintf "Typing.type_var_decl START %a:%a@." Printers.pp_var vdecl Printers.print_dec_ty vdecl.var_dec_type.ty_dec_desc;*)
629
      (*Format.eprintf "Typing.type_var_decl START %a in %a@." Printers.pp_var vdecl (Env.pp_env print_ty) env;*)
629 630
      check_type_declaration vdecl.var_loc vdecl.var_dec_type.ty_dec_desc;
631
      
630 632
      let eval_const id = (* Types. *)get_static_value (Env.lookup_value env id) in
631 633
      let type_dim d =
632 634
        begin
......
634 636
          Dimension.eval Basic_library.eval_env eval_const d;
635 637
        end in
636 638
      let ty = type_coretype type_dim vdecl.var_dec_type.ty_dec_desc in
637

  
638 639
      let ty_static =
639 640
        if vdecl.var_dec_const
640 641
        then (* Type_predef. *)type_static (Dimension.mkdim_var ()) ty
......
645 646
      try_unify ty_static (Expr_type_hub.import vdecl.var_type) vdecl.var_loc;
646 647
      let new_env = Env.add_value env vdecl.var_id ty_static in
647 648
      type_coreclock (new_env,vd_env) vdecl.var_dec_clock vdecl.var_id vdecl.var_loc;
648
      (*Format.eprintf "END %a@." Types.print_ty ty_static;*)
649
      (*Format.eprintf "END@.";*)
649 650
      new_env
650 651

  
651 652
    let type_var_decl_list vd_env env l =
......
675 676
    (** [type_node env nd loc] types node [nd] in environment env. The
676 677
    location is used for error reports. *)
677 678
    let type_node env nd loc =
679
      (*Log.report ~level:3 (fun fmt -> Format.fprintf fmt "Typing node %s in %a@." nd.node_id (Env.pp_env print_ty) env);*)
678 680
      let is_main = nd.node_id = !Options.main_node in
679 681
      let vd_env_ol = nd.node_outputs@nd.node_locals in
680 682
      let vd_env =  nd.node_inputs@vd_env_ol in
681 683
      check_vd_env vd_env;
684
      
682 685
      let init_env = env in
683 686
      let delta_env = type_var_decl_list vd_env init_env nd.node_inputs in
684 687
      let delta_env = type_var_decl_list vd_env delta_env nd.node_outputs in

Also available in: Unified diff