Project

General

Profile

Revision 17abbe95 src/typing.ml

View differences:

src/typing.ml
331 331
    expr.expr_type <- ty;
332 332
    ty
333 333
  | Expr_appl (id, args, r) ->
334
    (* application of non internal function is not legal in a constant
335
       expression *)
334
    (* application of non internal function is not legal in a constant expression *)
336 335
    (match r with
337 336
    | None        -> ()
338
    | Some (x, l) -> 
339
      check_constant expr.expr_loc const false;
340
      let expr_x = expr_of_ident x expr.expr_loc in	
341
      let typ_l = 
342
	Type_predef.type_clock 
343
	  (type_const expr.expr_loc (Const_tag l)) in
344
      type_subtyping_arg env in_main ~sub:false const expr_x typ_l);
337
    | Some (x, l) -> check_constant expr.expr_loc const false;
338
                     let expr_x = expr_of_ident x expr.expr_loc in	
339
		     let typ_l = Type_predef.type_clock (type_const expr.expr_loc (Const_tag l)) in
340
		     type_subtyping_arg env in_main ~sub:false const expr_x typ_l);
345 341
    let touts = type_appl env in_main expr.expr_loc const id args in
346 342
    expr.expr_type <- touts;
347 343
    touts
......
587 583
      type_imported_fun env nd decl.top_decl_loc
588 584
  | Consts clist ->
589 585
      type_top_consts env clist
590
  | Open _  -> env
586
  | Include _  -> env
591 587

  
592 588
let type_prog env decls =
593 589
try
594
  List.fold_left type_top_decl env decls
590
  ignore(List.fold_left type_top_decl env decls)
595 591
with Failure _ as exc -> raise exc
596 592

  
597 593
(* Once the Lustre program is fully typed,
......
636 632
  | ImportedFun nd ->
637 633
      ()
638 634
  | Consts clist -> ()
639
  | Open _  -> ()
635
  | Include _  -> ()
640 636

  
641 637
let uneval_prog_generics prog =
642 638
 List.iter uneval_top_generics prog
643

  
644
let check_env_compat declared computed =
645
  Env.iter declared (fun k decl_type_k -> 
646
    let computed_t = Env.lookup_value computed k in
647
    try_unify decl_type_k computed_t Location.dummy_loc
648
  ) 
649

  
650 639
(* Local Variables: *)
651 640
(* compile-command:"make -C .." *)
652 641
(* End: *)

Also available in: Unified diff