|
@@ -25,51 +25,8 @@ open Common
|
|
|
open Type
|
|
|
open Typecore
|
|
|
|
|
|
-(* Dt *)
|
|
|
-
|
|
|
type pvar = tvar * pos
|
|
|
|
|
|
-type con_def =
|
|
|
- | CEnum of tenum * tenum_field
|
|
|
- | CConst of tconstant
|
|
|
- | CAny
|
|
|
- | CType of module_type
|
|
|
- | CArray of int
|
|
|
- | CFields of int * (string * tclass_field) list
|
|
|
- | CExpr of texpr
|
|
|
-
|
|
|
-and con = {
|
|
|
- c_def : con_def;
|
|
|
- c_type : t;
|
|
|
- c_pos : pos;
|
|
|
-}
|
|
|
-
|
|
|
-type st_def =
|
|
|
- | SVar of tvar
|
|
|
- | SField of st * string
|
|
|
- | SEnum of st * string * int
|
|
|
- | SArray of st * int
|
|
|
- | STuple of st * int * int
|
|
|
-
|
|
|
-and st = {
|
|
|
- st_def : st_def;
|
|
|
- st_type : t;
|
|
|
- st_pos : pos;
|
|
|
-}
|
|
|
-
|
|
|
-type dt =
|
|
|
- | Out of texpr * texpr option * dt option
|
|
|
- | Switch of st * (con * dt) list
|
|
|
- | Bind of (pvar * st) list * dt
|
|
|
- | Goto of int
|
|
|
-
|
|
|
-type decision_tree = {
|
|
|
- dt_dt_lookup : dt array;
|
|
|
- dt_first : int;
|
|
|
- dt_type : t;
|
|
|
- dt_var_init : (tvar * texpr option) list;
|
|
|
-}
|
|
|
-
|
|
|
(* Pattern *)
|
|
|
|
|
|
type pat_def =
|
|
@@ -1118,7 +1075,7 @@ let make_dt ctx e cases def with_type p =
|
|
|
| _ -> assert false
|
|
|
end;
|
|
|
{
|
|
|
- dt_first = Hashtbl.find mctx.dt_cache dt;
|
|
|
+ dt_first = (match dt with Goto i -> i | _ -> Hashtbl.find mctx.dt_cache dt);
|
|
|
dt_dt_lookup = DynArray.to_array mctx.dt_lut;
|
|
|
dt_type = t;
|
|
|
dt_var_init = List.rev !var_inits;
|