File tree Expand file tree Collapse file tree 4 files changed +16
-6
lines changed Expand file tree Collapse file tree 4 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,10 @@ let prim = Lam.prim
32
32
let lam_extension_id loc (head : Lam.t ) =
33
33
prim ~primitive: lam_caml_id ~args: [head] loc
34
34
35
+ let lazy_block_info : Lam_tag_info.t =
36
+ Blk_record
37
+ [|Literals. lazy_done;
38
+ Literals. lazy_val|]
35
39
36
40
let unbox_extension info (args : Lam.t list ) mutable_flag loc =
37
41
prim ~primitive: (Pmakeblock (0 ,info,mutable_flag)) ~args loc
@@ -281,15 +285,15 @@ let lam_prim ~primitive:( p : Lambda.primitive) ~args loc : Lam.t =
281
285
[ Lam. const Const_js_true ;
282
286
result
283
287
] in
284
- prim ~primitive: (Pmakeblock (tag,Blk_record [| " RE_LAZY_DONE " ; " value " |] ,Mutable )) ~args loc
288
+ prim ~primitive: (Pmakeblock (tag,lazy_block_info ,Mutable )) ~args loc
285
289
| [computation] ->
286
290
let args =
287
291
[ Lam. const Const_js_false ;
288
292
(* FIXME: arity 0 does not get proper supported*)
289
293
prim ~primitive: (Pjs_fn_make 0 ) ~args: [Lam. function_ ~arity: 1 ~params: [Ident. create " param" ] ~body: computation]
290
294
loc
291
295
] in
292
- prim ~primitive: (Pmakeblock (tag,Blk_record [| " RE_LAZY_DONE " ; " value " |] ,Mutable )) ~args loc
296
+ prim ~primitive: (Pmakeblock (tag,lazy_block_info ,Mutable )) ~args loc
293
297
294
298
| _ -> assert false
295
299
end
Original file line number Diff line number Diff line change @@ -146,4 +146,7 @@ let polyvar_value = "VAL"
146
146
147
147
let cons = " ::"
148
148
let hd = " hd"
149
- let tl = " tl"
149
+ let tl = " tl"
150
+
151
+ let lazy_done = " LAZY_DONE"
152
+ let lazy_val = " VAL"
Original file line number Diff line number Diff line change @@ -144,4 +144,6 @@ val polyvar_value : string
144
144
145
145
val cons : string
146
146
val hd : string
147
- val tl : string
147
+ val tl : string
148
+ val lazy_done : string
149
+ val lazy_val : string
Original file line number Diff line number Diff line change 26
26
27
27
(* Internals of forcing lazy values. *)
28
28
type 'a t = {
29
- mutable tag : bool [@ bs.as "RE_LAZY_DONE " ] ;
29
+ mutable tag : bool [@ bs.as "LAZY_DONE " ] ;
30
30
(* Invariant: name *)
31
- mutable value : 'a (* its type is ['a] or [unit -> 'a ] *)
31
+ mutable value : 'a [@ bs.as "VAL" ]
32
+ (* its type is ['a] or [unit -> 'a ] *)
32
33
}
33
34
34
35
You can’t perform that action at this time.
0 commit comments