|
@@ -1004,6 +1004,40 @@ end|}
|
|
};
|
|
};
|
|
]
|
|
]
|
|
|
|
|
|
|
|
+let inline_for () =
|
|
|
|
+ _test_instruction {|for i = 0 to 5: msg i|}
|
|
|
|
+ [
|
|
|
|
+ Tree.Ast.For
|
|
|
|
+ {
|
|
|
|
+ loc = _position;
|
|
|
|
+ variable =
|
|
|
|
+ {
|
|
|
|
+ Tree.Ast.pos = _position;
|
|
|
|
+ name = "I";
|
|
|
|
+ index = None;
|
|
|
|
+ local = false;
|
|
|
|
+ };
|
|
|
|
+ start = Tree.Ast.Integer (_position, "0");
|
|
|
|
+ to_ = Tree.Ast.Integer (_position, "5");
|
|
|
|
+ step = None;
|
|
|
|
+ statements =
|
|
|
|
+ [
|
|
|
|
+ Tree.Ast.Call
|
|
|
|
+ ( _position,
|
|
|
|
+ T.Msg,
|
|
|
|
+ [
|
|
|
|
+ Tree.Ast.Ident
|
|
|
|
+ {
|
|
|
|
+ Tree.Ast.pos = _position;
|
|
|
|
+ name = "I";
|
|
|
|
+ index = None;
|
|
|
|
+ local = false;
|
|
|
|
+ };
|
|
|
|
+ ] );
|
|
|
|
+ ];
|
|
|
|
+ };
|
|
|
|
+ ]
|
|
|
|
+
|
|
let test =
|
|
let test =
|
|
( "Syntax",
|
|
( "Syntax",
|
|
[
|
|
[
|
|
@@ -1077,4 +1111,5 @@ let test =
|
|
Alcotest.test_case "for step ... end" `Quick test_for_end_with_step;
|
|
Alcotest.test_case "for step ... end" `Quick test_for_end_with_step;
|
|
Alcotest.test_case "local variable" `Quick test_local;
|
|
Alcotest.test_case "local variable" `Quick test_local;
|
|
Alcotest.test_case "local variable in for loop" `Quick test_local_for;
|
|
Alcotest.test_case "local variable in for loop" `Quick test_local_for;
|
|
|
|
+ Alcotest.test_case "inline for" `Quick inline_for;
|
|
] )
|
|
] )
|