Project

General

Profile

Revision 15003796 src/typing.ml

View differences:

src/typing.ml
390 390
(** [type_expr env in_main expr] types expression [expr] in environment
391 391
    [env], expecting it to be [const] or not. *)
392 392
and type_expr env in_main const expr =
393
  (* typing also the possible annotations *)
394
  let _ = (
395
    match expr.expr_annot with
396
      None -> () 
397
    | Some anns -> type_expr_annot env in_main const anns
398
  ) in
393 399
  let resulting_ty = 
394
  match expr.expr_desc with
400
    match expr.expr_desc with
395 401
  | Expr_const c ->
396 402
    let ty = type_const expr.expr_loc c in
397 403
    let ty = Type_predef.type_static (Dimension.mkdim_var ()) ty in
......
509 515
  with Unify (t1, t2) ->
510 516
    raise (Error (loc, Type_clash (t1,t2)))
511 517

  
518

  
519
and type_eexpr env in_main const ee =
520
  let ty = type_expr env in_main const ee.eexpr_qfexpr in
521
  ee.eexpr_type <- ty;
522
  ty
523

  
524
and type_expr_annot env in_main const anns =
525
  List.iter (fun (_, ee) ->
526
    ignore (type_eexpr env in_main const ee)
527
  ) anns.annots
528
    
529

  
512 530
(** [type_eq env eq] types equation [eq] in environment [env] *)
513 531
let type_eq env in_main undefined_vars eq =
514 532
(*Format.eprintf "Typing.type_eq %a@." Printers.pp_node_eq eq;*)
......
633 651
    let assert_expr =  assert_.assert_expr in
634 652
    type_subtyping_arg (new_env, vd_env) is_main false assert_expr Type_predef.type_bool
635 653
  )  nd.node_asserts;
654

  
655
  (* Typing node annotations *)
656
  List.iter (fun expr_annot ->
657
    type_expr_annot (new_env, vd_env) is_main false expr_annot
658
  )  nd.node_annot;
636 659
  
637 660
  (* check that table is empty *)
638 661
  let local_consts = List.fold_left (fun res vdecl -> if vdecl.var_dec_const then ISet.add vdecl.var_id res else res) ISet.empty nd.node_locals in

Also available in: Unified diff