aboutsummaryrefslogtreecommitdiff
path: root/lib/syntax/nested_strings.ml
diff options
context:
space:
mode:
authorChimrod <>2023-11-09 16:04:09 +0100
committerChimrod <>2023-11-09 16:14:17 +0100
commit0d5bcaea3370697822675d9f8d25bca34c02505e (patch)
treef9aed3bae5e94ae2ae2b214ecf4f051b3aa9819c /lib/syntax/nested_strings.ml
parentebf072326e2315ace952c80dbc442198c44faf7d (diff)
Made the compose evaluation lazy
Diffstat (limited to 'lib/syntax/nested_strings.ml')
-rw-r--r--lib/syntax/nested_strings.ml28
1 files changed, 18 insertions, 10 deletions
diff --git a/lib/syntax/nested_strings.ml b/lib/syntax/nested_strings.ml
index fcd0b91..7e49ace 100644
--- a/lib/syntax/nested_strings.ml
+++ b/lib/syntax/nested_strings.ml
@@ -10,35 +10,42 @@ module Expression = TypeBuilder.Make (struct
type t = Report.t list
type t' = Report.t list
- let v : Get_type.t * t -> t' = snd
+ let v : Get_type.t Lazy.t * t -> t' = snd
(** Identify the expressions reprented as string. That’s here that the report
are added.
All the rest of the module only push thoses warning to the top level. *)
- let literal : S.pos -> (Get_type.t * t) T.literal list -> Get_type.t -> t =
+ let literal :
+ S.pos -> (Get_type.t Lazy.t * t) T.literal list -> Get_type.t Lazy.t -> t
+ =
fun pos content _type_of ->
match content with
| [ T.Expression [ (t', _) ]; T.Text "" ] -> (
- match Get_type.get_type t' with
+ match Get_type.get_type (Lazy.force t') with
| Get_type.Integer -> []
| _ ->
let msg = Report.debug pos "This expression can be simplified" in
[ msg ])
| _ -> []
- let ident : (S.pos, Get_type.t * t) S.variable -> Get_type.t -> t =
+ let ident :
+ (S.pos, Get_type.t Lazy.t * t) S.variable -> Get_type.t Lazy.t -> t =
fun variable _type_of ->
match variable.index with None -> [] | Some (_, t) -> t
- let integer : S.pos -> string -> Get_type.t -> t =
+ let integer : S.pos -> string -> Get_type.t Lazy.t -> t =
fun pos t _type_of ->
ignore pos;
ignore t;
[]
let function_ :
- S.pos -> T.function_ -> (Get_type.t * t) list -> Get_type.t -> t =
+ S.pos ->
+ T.function_ ->
+ (Get_type.t Lazy.t * t) list ->
+ Get_type.t Lazy.t ->
+ t =
fun pos f expressions _type_of ->
ignore pos;
ignore f;
@@ -48,7 +55,8 @@ module Expression = TypeBuilder.Make (struct
in
exprs
- let uoperator : S.pos -> T.uoperator -> Get_type.t * t -> Get_type.t -> t =
+ let uoperator :
+ S.pos -> T.uoperator -> Get_type.t Lazy.t * t -> Get_type.t Lazy.t -> t =
fun pos op r _type_of ->
ignore op;
ignore pos;
@@ -57,9 +65,9 @@ module Expression = TypeBuilder.Make (struct
let boperator :
S.pos ->
T.boperator ->
- Get_type.t * t ->
- Get_type.t * t ->
- Get_type.t ->
+ Get_type.t Lazy.t * t ->
+ Get_type.t Lazy.t * t ->
+ Get_type.t Lazy.t ->
t =
fun pos op (_, r1) (_, r2) _type_of ->
ignore pos;