Implement loading namespaces with the using keyword #829

Merged
ghallak merged 23 commits from ghallak/233 into master 2021-09-07 23:45:28 +09:00
2 changed files with 6 additions and 1 deletions
Showing only changes of commit 976f6c42ba - Show all commits

View File

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

View File

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