Permalink
Browse files

compile

  • Loading branch information...
1 parent 68a814a commit 929a7324fc5c630ef339a702d3cffdb203be171a Jun FURUSE committed Jul 26, 2011
Showing with 31 additions and 32 deletions.
  1. +1 −0 ocamlspot/ocaml.ml
  2. +1 −1 ocamlspot/spot.ml
  3. +18 −21 ocamlspot/spoteval.ml
  4. +5 −5 ocamlspot/spoteval.mli
  5. +5 −5 ocamlspot/spotfile.ml
  6. +1 −0 ocamlspot/tests/Makefile.targets
View
1 ocamlspot/ocaml.ml
@@ -16,3 +16,4 @@
module Ident = Ident
module Path = Path
module Format = Utils.Format
+module Env = Env
View
2 ocamlspot/spot.ml
@@ -305,7 +305,7 @@ module Kind = struct
| "ct" | "class_type" -> Class_type
| _ -> raise Not_found
- (* CR jfuruse: DUP *)
+ (* CR jfuruse: DUP (kident_of_sigitem in include_coercion) *)
let kidents_of_mty env mty =
let open Typedtree in
let open Types in
View
39 ocamlspot/spoteval.ml
@@ -44,10 +44,10 @@ module Value : sig
| Module_type of Typedtree.module_type
type t =
- | Ident of PIdent.t * TypeEnv.t
+ | Ident of PIdent.t
| Structure of PIdent.t * structure * structure option (* sig part *) * TypeEnv.t
| Closure of PIdent.t * env * Ident.t * module_expr_or_type * TypeEnv.t
- | Parameter of PIdent.t * TypeEnv.t
+ | Parameter of PIdent.t
| Error of exn
and structure = structure_item list
@@ -106,10 +106,10 @@ end = struct
| Module_type of Typedtree.module_type
type t =
- | Ident of PIdent.t * TypeEnv.t
+ | Ident of PIdent.t
| Structure of PIdent.t * structure * structure option (* sig part *) * TypeEnv.t
| Closure of PIdent.t * env * Ident.t * module_expr_or_type * TypeEnv.t
- | Parameter of PIdent.t * TypeEnv.t
+ | Parameter of PIdent.t
| Error of exn
and structure = structure_item list
@@ -162,8 +162,7 @@ end = struct
items :=
(id,
(kind, eager (Ident ({ PIdent.filepath = "";
- ident = Some id },
- TypeEnv.initial))))
+ ident = Some id } ))))
:: !items
in
Predef.build_initial_env
@@ -206,8 +205,8 @@ end = struct
open Format
let rec t ppf = function
- | Ident (id, _) -> fprintf ppf "Ident(%a)" PIdent.format id
- | Parameter (id, _) -> fprintf ppf "Parameter(%a)" PIdent.format id
+ | Ident id -> fprintf ppf "Ident(%a)" PIdent.format id
+ | Parameter id -> fprintf ppf "Parameter(%a)" PIdent.format id
| Structure (pid, str, None, _) ->
fprintf ppf "@[<v2>Structure(%a)@ %a None@]"
PIdent.format pid
@@ -283,7 +282,7 @@ module Eval = struct
let str_of_global_ident = ref (fun ~load_paths:_ _ -> assert false : load_paths: string list -> Ident.t -> string * Value.structure)
let packed = ref (fun _ _ -> assert false : Env.t -> string -> Value.t)
- let z_of_id tenv env id = eager (Ident ({ PIdent.filepath = env.Env.path; ident = Some id }, tenv))
+ let z_of_id env id = eager (Ident { PIdent.filepath = env.Env.path; ident = Some id })
let rec find_path env (kind, p) : Value.z =
match p with
@@ -338,7 +337,7 @@ module Eval = struct
lazy begin
match !!(find_path env (Kind.Module, p)) with
| Ident _ -> (try assert false with e -> Error e)
- | Parameter (pid, tenv) -> Parameter (pid, tenv)
+ | Parameter pid -> Parameter pid
| Closure _ -> (try assert false with e -> Error e)
| Error exn -> Error exn
| Structure (pid, str, _ (* CR jfuruse *), _tenv) ->
@@ -428,9 +427,8 @@ module Eval = struct
(* expand internal Include and get alist by Ident.t *)
(* the list order is REVERSED and is last-defined-first,
but it is REQUIRED for environment query *)
- and structure tenv env0 str : Value.structure =
+ and structure _tenv env0 str : Value.structure =
- let z_of_id = z_of_id tenv in
List.fold_left (fun str sitem ->
match sitem.str_desc with
| Tstr_eval _ -> str
@@ -513,8 +511,8 @@ module Eval = struct
match v_mexp with
| Structure (_, str, _ (* CR jfuruse *), _) ->
List.map (fun (id, (k, v)) -> (k, Ocaml.Ident.name id), v) str
- | Parameter (pid, tenv) ->
- List.map (fun (k,_,id) -> (k, Ocaml.Ident.name id), eager (Parameter (pid, tenv))) kids
+ | Parameter pid ->
+ List.map (fun (k,_,id) -> (k, Ocaml.Ident.name id), eager (Parameter pid)) kids
| Ident _ -> assert false
| Closure _ -> assert false
| Error _ -> [] (* error *)
@@ -534,9 +532,8 @@ module Eval = struct
in
str' @ str) [] str.str_items
- and signature tenv env0 sg : Value.structure =
+ and signature _tenv env0 sg : Value.structure =
- let z_of_id = z_of_id tenv in
List.fold_left (fun str sitem ->
match sitem.sig_desc with
| Tsig_open _ -> str
@@ -603,8 +600,8 @@ module Eval = struct
match v_mexp with
| Structure (_, str, _ (* CR jfuruse *), _) ->
List.map (fun (id, (k, v)) -> (k, Ocaml.Ident.name id), v) str
- | Parameter (pid, tenv) ->
- List.map (fun (k,id) -> (k, Ocaml.Ident.name id), eager (Parameter (pid, tenv))) kids
+ | Parameter pid ->
+ List.map (fun (k,id) -> (k, Ocaml.Ident.name id), eager (Parameter pid)) kids
| Ident _ -> assert false
| Closure _ -> assert false
| Error _ -> [] (* error *)
@@ -627,7 +624,7 @@ module Eval = struct
and apply v1 v2 =
lazy begin match !!v1 with
| Ident _ -> assert false
- | Parameter (pid, tenv) -> Parameter (pid, tenv)
+ | Parameter pid -> Parameter pid
| Structure _ -> assert false
| Error exn -> Error exn
| Closure (_, env, id, mexp_or_mty, _tenv) ->
@@ -652,7 +649,7 @@ module Eval = struct
let z = lazy begin
let str =
match !!(module_expr env None mexp) with
- | Structure (_pid, str, _) -> str
+ | Structure (_pid, str, _, _) -> str
| _ -> assert false
in
!!(find_ident str (k, Ocaml.Ident.name id', Ocaml.Ident.binding_time id'))
@@ -663,7 +660,7 @@ module Eval = struct
let z = lazy begin
let str =
match !!(module_type env None mty) with
- | Structure (_pid, str, _) -> str
+ | Structure (_pid, str, _, _) -> str
| _ -> assert false
in
!!(find_ident str (k, Ocaml.Ident.name id, Ocaml.Ident.binding_time id))
View
10 ocamlspot/spoteval.mli
@@ -28,10 +28,10 @@ module Value : sig
type t =
| Ident of PIdent.t
- | Structure of PIdent.t * structure * structure option
- | Closure of PIdent.t * env * Ident.t * module_expr_or_type
+ | Structure of PIdent.t * structure * structure option (* sig part *) * Ocaml.Env.t
+ | Closure of PIdent.t * env * Ident.t * module_expr_or_type * Ocaml.Env.t
| Parameter of PIdent.t
- | Error of exn
+ | Error of exn
and structure = structure_item list
@@ -116,8 +116,8 @@ module Eval : sig
Ident.t option ->
Value.module_expr_or_type -> Value.z
- val structure : Env.t -> Typedtree.structure -> Value.structure
- val signature : Env.t -> Typedtree.signature -> Value.structure
+ val structure : Ocaml.Env.t -> Env.t -> Typedtree.structure -> Value.structure
+ val signature : Ocaml.Env.t -> Env.t -> Typedtree.signature -> Value.structure
val apply : Value.z -> Value.z -> Value.z
View
10 ocamlspot/spotfile.ml
@@ -372,8 +372,8 @@ module Make(Spotconfig : Spotconfig_intf.S) = struct
match v with
| Value.Ident id -> id, find_loc id
| Value.Parameter id -> id, find_loc id
- | Value.Structure (id, _, _) -> id, find_loc id
- | Value.Closure (id, _, _, _) -> id, find_loc id
+ | Value.Structure (id, _, _, _) -> id, find_loc id
+ | Value.Closure (id, _, _, _, _) -> id, find_loc id
| Value.Error (Failure _ as e) -> raise e
| Value.Error (Load.Old_spot _ as exn) -> raise exn
| Value.Error exn -> raise exn
@@ -384,10 +384,10 @@ module Make(Spotconfig : Spotconfig_intf.S) = struct
let structure =
match file.top with (* The only use of .top *)
| Some (Saved_type (Typedtree.Saved_implementation str)) ->
- Eval.structure (empty_env file) str
+ Eval.structure Ocaml.Env.initial (* XXX *) (empty_env file) str
| Some (Saved_type (Typedtree.Saved_signature sg)) ->
- Eval.signature (empty_env file) sg
+ Eval.signature Ocaml.Env.initial (empty_env file) sg
| Some (Packed paths) ->
let id_strs =
@@ -399,7 +399,7 @@ module Make(Spotconfig : Spotconfig_intf.S) = struct
) paths
in
List.map (fun (id, pident, str) ->
- id, (Kind.Module, eager (Value.Structure (pident, str, None)))) id_strs
+ id, (Kind.Module, eager (Value.Structure (pident, str, None, Ocaml.Env.initial)))) id_strs
| Some _ -> assert false
| None -> assert false
in
View
1 ocamlspot/tests/Makefile.targets
@@ -12,6 +12,7 @@ exception.cmo \
external.cmo \
external_include.cmo \
fstclassmodule.cmo \
+fstclassmodule2.cmo \
functor.cmo \
functor_parameter.cmo \
immediate_include.cmo \

0 comments on commit 929a732

Please sign in to comment.