Project

General

Profile

Revision e49b6d55 src/corelang.ml

View differences:

src/corelang.ml
473 473
let sort_handlers hl =
474 474
 List.sort (fun (t, _) (t', _) -> compare t t') hl
475 475

  
476
let num_10 = Num.num_of_int 10
477
  
478
let rec is_eq_const c1 c2 =
479
  match c1, c2 with
480
  | Const_real (n1, i1, _), Const_real (n2, i2, _)
481
    -> Num.(let n1 = n1 // (num_10 **/ (num_of_int i1)) in
482
	    let n2 = n2 // (num_10 **/ (num_of_int i2)) in
483
	    eq_num n1 n2)
484
  | Const_struct lcl1, Const_struct lcl2
485
    -> List.length lcl1 = List.length lcl2
486
    && List.for_all2 (fun (l1, c1) (l2, c2) -> l1 = l2 && is_eq_const c1 c2) lcl1 lcl2
487
  | _  -> c1 = c2
488

  
476 489
let rec is_eq_expr e1 e2 = match e1.expr_desc, e2.expr_desc with
477
  | Expr_const c1, Expr_const c2 -> c1 = c2
490
  | Expr_const c1, Expr_const c2 -> is_eq_const c1 c2
478 491
  | Expr_ident i1, Expr_ident i2 -> i1 = i2
479 492
  | Expr_array el1, Expr_array el2 
480 493
  | Expr_tuple el1, Expr_tuple el2 -> 

Also available in: Unified diff