File tree Expand file tree Collapse file tree 4 files changed +17
-32
lines changed
Expand file tree Collapse file tree 4 files changed +17
-32
lines changed Original file line number Diff line number Diff line change @@ -4434,7 +4434,6 @@ lambda/lambda.cmo : \
44344434 typing/path.cmi \
44354435 utils/misc.cmi \
44364436 parsing/longident.cmi \
4437- parsing/location.cmi \
44384437 typing/ident.cmi \
44394438 typing/env.cmi \
44404439 lambda/debuginfo.cmi \
@@ -4448,7 +4447,6 @@ lambda/lambda.cmx : \
44484447 typing/path.cmx \
44494448 utils/misc.cmx \
44504449 parsing/longident.cmx \
4451- parsing/location.cmx \
44524450 typing/ident.cmx \
44534451 typing/env.cmx \
44544452 lambda/debuginfo.cmx \
Original file line number Diff line number Diff line change @@ -727,17 +727,18 @@ let transl_extension_path loc env path =
727727let transl_class_path loc env path =
728728 transl_path Env. find_class_address loc env path
729729
730- let transl_prim mod_name name =
731- let pers = Ident. create_persistent mod_name in
732- let env = Env. add_persistent_structure pers Env. empty in
733- let lid =
734- Longident. Ldot (Location. mknoloc (Longident. Lident mod_name),
735- Location. mknoloc name)
736- in
737- match Env. find_value_by_name lid env with
738- | path , _ -> transl_value_path Loc_unknown env path
739- | exception Not_found ->
740- fatal_error (" Primitive " ^ name ^ " not found." )
730+ let transl_prim modname field =
731+ let mod_ident = Ident. create_persistent modname in
732+ let env = Env. add_persistent_structure mod_ident Env. initial in
733+ match Env. open_pers_signature modname env with
734+ | Error `Not_found ->
735+ fatal_errorf " Module %s unavailable." modname
736+ | Ok env -> (
737+ match Env. find_value_by_name (Longident. Lident field) env with
738+ | exception Not_found ->
739+ fatal_errorf " Primitive %s.%s not found." modname field
740+ | path , _ -> transl_value_path Loc_unknown env path
741+ )
741742
742743(* Compile a sequence of expressions *)
743744
Original file line number Diff line number Diff line change @@ -428,7 +428,7 @@ val transl_prim: string -> string -> lambda
428428(* * Translate a value from a persistent module. For instance:
429429
430430 {[
431- transl_internal_value "CamlinternalLazy" "force"
431+ transl_prim "CamlinternalLazy" "force"
432432 ]}
433433*)
434434
Original file line number Diff line number Diff line change @@ -2142,25 +2142,11 @@ let get_pat_args_lazy p rem =
21422142
21432143let prim_obj_tag = Primitive. simple ~name: " caml_obj_tag" ~arity: 1 ~alloc: false
21442144
2145- let get_mod_field modname field =
2146- lazy
2147- (let mod_ident = Ident. create_persistent modname in
2148- let env =
2149- Env. add_persistent_structure mod_ident Env. initial
2150- in
2151- match Env. open_pers_signature modname env with
2152- | Error `Not_found ->
2153- fatal_errorf " Module %s unavailable." modname
2154- | Ok env -> (
2155- match Env. find_value_by_name (Longident. Lident field) env with
2156- | exception Not_found ->
2157- fatal_errorf " Primitive %s.%s not found." modname field
2158- | path , _ -> transl_value_path Loc_unknown env path
2159- ))
2160-
2161- let code_force_lazy_block = get_mod_field " CamlinternalLazy" " force_lazy_block"
2145+ let code_force_lazy_block =
2146+ lazy (transl_prim " CamlinternalLazy" " force_lazy_block" )
21622147
2163- let code_force_lazy = get_mod_field " CamlinternalLazy" " force_gen"
2148+ let code_force_lazy =
2149+ lazy (transl_prim " CamlinternalLazy" " force_gen" )
21642150
21652151(* inline_lazy_force inlines the beginning of the code of Lazy.force. When
21662152 the value argument is tagged as:
You can’t perform that action at this time.
0 commit comments