Allow using namespace to appear inside functions

This commit is contained in:
Gaith Hallak 2021-08-17 18:44:02 +03:00
parent 519e60039e
commit 976f6c42ba
2 changed files with 6 additions and 1 deletions

View File

@ -1798,6 +1798,10 @@ infer_block(Env, _, [{letval, Attrs, Pattern, E}|Rest], BlockType) ->
{'case', _, NewPattern, {typed, _, {block, _, NewRest}, _}} =
infer_case(Env, Attrs, Pattern, PatType, {block, Attrs, Rest}, BlockType),
[{letval, Attrs, NewPattern, NewE}|NewRest];
infer_block(Env, Attrs, [Using = {using, _, _} | Rest], BlockType) ->
infer_block(check_usings(Env, [Using]), Attrs, Rest, BlockType);
infer_block(Env, Attrs, [Using = {using, _, _, _} | Rest], BlockType) ->
infer_block(check_usings(Env, [Using]), Attrs, Rest, BlockType);
infer_block(Env, Attrs, [E|Rest], BlockType) ->
[infer_expr(Env, E)|infer_block(Env, Attrs, Rest, BlockType)].

View File

@ -263,7 +263,8 @@ body() ->
stmt() ->
?LAZY_P(choice(
[ expr()
[ using()
, expr()
, letdecl()
, {switch, keyword(switch), parens(expr()), maybe_block(branch())}
, {'if', keyword('if'), parens(expr()), body()}