Quellcode durchsuchen

Updated the tests

Chimrod vor 5 Monaten
Ursprung
Commit
aeb98de6cf
4 geänderte Dateien mit 69 neuen und 0 gelöschten Zeilen
  1. 15 0
      lib/syntax/dead_end.ml
  2. 19 0
      lib/syntax/dup_test.ml
  3. 16 0
      lib/syntax/nested_strings.ml
  4. 19 0
      lib/syntax/type_of.ml

+ 15 - 0
lib/syntax/dead_end.ml

@@ -145,6 +145,21 @@ module Instruction = struct
       Expression.t' ->
       t =
    fun _ _ _ _ -> default
+
+  let for_ :
+      S.pos ->
+      (S.pos, Expression.t') S.variable ->
+      start:Expression.t' ->
+      to_:Expression.t' ->
+      step:Expression.t' option ->
+      t list ->
+      t =
+   fun pos variable ~start ~to_ ~step statements ->
+    ignore variable;
+    ignore start;
+    ignore to_;
+    ignore step;
+    check_block pos statements
 end
 
 module Location = struct

+ 19 - 0
lib/syntax/dup_test.ml

@@ -135,6 +135,25 @@ module Instruction = struct
 
   let call : S.pos -> T.keywords -> Expression.t' list -> t =
    fun _ _ _ -> default
+
+  let for_ :
+      S.pos ->
+      (S.pos, Expression.t') S.variable ->
+      start:Expression.t' ->
+      to_:Expression.t' ->
+      step:Expression.t' option ->
+      t list ->
+      t =
+   fun _loc variable ~start ~to_ ~step statements ->
+    ignore variable;
+    ignore start;
+    ignore to_;
+    ignore step;
+    List.fold_left ~init:default statements ~f:(fun state ex ->
+        {
+          predicates = [];
+          duplicates = List.rev_append ex.duplicates state.duplicates;
+        })
 end
 
 module Location = struct

+ 16 - 0
lib/syntax/nested_strings.ml

@@ -141,6 +141,22 @@ struct
     match variable.index with
     | None -> expression
     | Some v -> List.rev_append v expression
+
+  let for_ :
+      S.pos ->
+      (S.pos, Expression.t') S.variable ->
+      start:Expression.t' ->
+      to_:Expression.t' ->
+      step:Expression.t' option ->
+      t list ->
+      t =
+   fun pos variable ~start ~to_ ~step statements ->
+    ignore variable;
+    ignore start;
+    ignore to_;
+    ignore step;
+    ignore pos;
+    List.concat statements
 end
 
 module Location = struct

+ 19 - 0
lib/syntax/type_of.ml

@@ -469,6 +469,25 @@ module Instruction = struct
             Helper.compare_args ~strict:true ~level:Report.Warn pos expected
               [ op1; op2 ] report
         | reports -> reports @ report)
+
+  let for_ :
+      S.pos ->
+      (S.pos, Expression.t') S.variable ->
+      start:Expression.t' ->
+      to_:Expression.t' ->
+      step:Expression.t' option ->
+      t list ->
+      t =
+   fun _loc variable ~start ~to_ ~step statements ->
+    ignore variable;
+    ignore start;
+    ignore to_;
+    ignore step;
+    (* TODO ensure all the variable are INT *)
+    let report = [] in
+    List.fold_left statements ~init:report ~f:(fun acc a ->
+        let report = a in
+        (List.rev_append report) acc)
 end
 
 module Location = struct