fixup do statement

This commit is contained in:
Dmitriy Pleshevskiy 2024-05-20 17:26:50 +03:00
parent 654eda0737
commit 4d3ae67617
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2
2 changed files with 5 additions and 1 deletions

View file

@ -172,7 +172,7 @@ let
]));
if' = condition: trueBody: ifelse condition trueBody [ ];
do = body: spaceBetween [ kw_do ] ++ body ++ [ kw_end ];
do = body: spaceBetween ([ kw_do ] ++ body ++ [ kw_end ]);
isLuaNil = expr: getType expr == "nil";
LuaNil = { _type = "nil"; };

View file

@ -258,4 +258,8 @@ with nix2lua; pkgs.lib.runTests {
expr = toLua (requireTo "ls" "luasnip");
expected = ''local ls = require("luasnip")'';
};
"test returns a do-block" = {
expr = toLua (do [ (requireTo "ls" "luasnip") ]);
expected = ''do local ls = require("luasnip") end'';
};
}