@@ -41,17 +41,17 @@ fn_arity(Args) -> length(Args).
4141capture (Meta , {'/' , _ , [{{'.' , _ , [M , F ]} = Dot , RequireMeta , []}, A ]}, S , E ) when is_atom (F ), is_integer (A ) ->
4242 Args = args_from_arity (Meta , A , E ),
4343 handle_capture_possible_warning (Meta , RequireMeta , M , F , A , E ),
44- capture_require ({Dot , RequireMeta , Args }, S , E , true );
44+ capture_require ({Dot , RequireMeta , Args }, S , E , arity );
4545
4646capture (Meta , {'/' , _ , [{F , ImportMeta , C }, A ]}, S , E ) when is_atom (F ), is_integer (A ), is_atom (C ) ->
4747 Args = args_from_arity (Meta , A , E ),
48- capture_import ({F , ImportMeta , Args }, S , E , true );
48+ capture_import ({F , ImportMeta , Args }, S , E , arity );
4949
5050capture (_Meta , {{'.' , _ , [_ , Fun ]}, _ , Args } = Expr , S , E ) when is_atom (Fun ), is_list (Args ) ->
51- capture_require (Expr , S , E , is_sequential_and_not_empty (Args ));
51+ capture_require (Expr , S , E , check_sequential_and_not_empty (Args ));
5252
5353capture (Meta , {{'.' , _ , [_ ]}, _ , Args } = Expr , S , E ) when is_list (Args ) ->
54- capture_expr (Meta , Expr , S , E , false );
54+ capture_expr (Meta , Expr , S , E , non_sequential );
5555
5656capture (Meta , {'__block__' , _ , [Expr ]}, S , E ) ->
5757 capture (Meta , Expr , S , E );
@@ -60,31 +60,31 @@ capture(Meta, {'__block__', _, _} = Expr, _S, E) ->
6060 file_error (Meta , E , ? MODULE , {block_expr_in_capture , Expr });
6161
6262capture (_Meta , {Atom , _ , Args } = Expr , S , E ) when is_atom (Atom ), is_list (Args ) ->
63- capture_import (Expr , S , E , is_sequential_and_not_empty (Args ));
63+ capture_import (Expr , S , E , check_sequential_and_not_empty (Args ));
6464
6565capture (Meta , {Left , Right }, S , E ) ->
6666 capture (Meta , {'{}' , Meta , [Left , Right ]}, S , E );
6767
6868capture (Meta , List , S , E ) when is_list (List ) ->
69- capture_expr (Meta , List , S , E , is_sequential_and_not_empty (List ));
69+ capture_expr (Meta , List , S , E , check_sequential_and_not_empty (List ));
7070
7171capture (Meta , Integer , _S , E ) when is_integer (Integer ) ->
7272 file_error (Meta , E , ? MODULE , {capture_arg_outside_of_capture , Integer });
7373
7474capture (Meta , Arg , _S , E ) ->
7575 invalid_capture (Meta , Arg , E ).
7676
77- capture_import ({Atom , ImportMeta , Args } = Expr , S , E , Sequential ) ->
78- Res = Sequential andalso
77+ capture_import ({Atom , ImportMeta , Args } = Expr , S , E , ArgsType ) ->
78+ Res = ArgsType /= non_sequential andalso
7979 elixir_dispatch :import_function (ImportMeta , Atom , length (Args ), E ),
80- handle_capture (Res , ImportMeta , ImportMeta , Expr , S , E , Sequential ).
80+ handle_capture (Res , ImportMeta , ImportMeta , Expr , S , E , ArgsType ).
8181
82- capture_require ({{'.' , DotMeta , [Left , Right ]}, RequireMeta , Args }, S , E , Sequential ) ->
82+ capture_require ({{'.' , DotMeta , [Left , Right ]}, RequireMeta , Args }, S , E , ArgsType ) ->
8383 case escape (Left , E , []) of
8484 {EscLeft , []} ->
8585 {ELeft , SE , EE } = elixir_expand :expand (EscLeft , S , E ),
8686
87- Res = Sequential andalso case ELeft of
87+ Res = ArgsType /= non_sequential andalso case ELeft of
8888 {Name , _ , Context } when is_atom (Name ), is_atom (Context ) ->
8989 {remote , ELeft , Right , length (Args )};
9090 _ when is_atom (ELeft ) ->
@@ -94,23 +94,23 @@ capture_require({{'.', DotMeta, [Left, Right]}, RequireMeta, Args}, S, E, Sequen
9494 end ,
9595
9696 Dot = {{'.' , DotMeta , [ELeft , Right ]}, RequireMeta , Args },
97- handle_capture (Res , RequireMeta , DotMeta , Dot , SE , EE , Sequential );
97+ handle_capture (Res , RequireMeta , DotMeta , Dot , SE , EE , ArgsType );
9898
9999 {EscLeft , Escaped } ->
100100 Dot = {{'.' , DotMeta , [EscLeft , Right ]}, RequireMeta , Args },
101- capture_expr (RequireMeta , Dot , S , E , Escaped , Sequential )
101+ capture_expr (RequireMeta , Dot , S , E , Escaped , ArgsType )
102102 end .
103103
104- handle_capture (false , Meta , _DotMeta , Expr , S , E , Sequential ) ->
105- capture_expr (Meta , Expr , S , E , Sequential );
106- handle_capture (LocalOrRemote , Meta , DotMeta , _Expr , S , E , _Sequential ) ->
104+ handle_capture (false , Meta , _DotMeta , Expr , S , E , ArgsType ) ->
105+ capture_expr (Meta , Expr , S , E , ArgsType );
106+ handle_capture (LocalOrRemote , Meta , DotMeta , _Expr , S , E , _ArgsType ) ->
107107 {LocalOrRemote , Meta , DotMeta , S , E }.
108108
109- capture_expr (Meta , Expr , S , E , Sequential ) ->
110- capture_expr (Meta , Expr , S , E , [], Sequential ).
111- capture_expr (Meta , Expr , S , E , Escaped , Sequential ) ->
109+ capture_expr (Meta , Expr , S , E , ArgsType ) ->
110+ capture_expr (Meta , Expr , S , E , [], ArgsType ).
111+ capture_expr (Meta , Expr , S , E , Escaped , ArgsType ) ->
112112 case escape (Expr , E , Escaped ) of
113- {_ , []} when not Sequential ->
113+ {_ , []} when ArgsType == non_sequential ->
114114 invalid_capture (Meta , Expr , E );
115115 {{{'.' , _ , [_ , _ ]} = Dot , _ , Args }, []} ->
116116 Meta2 = lists :keydelete (no_parens , 1 , Meta ),
@@ -166,12 +166,12 @@ args_from_arity(_Meta, A, _E) when is_integer(A), A >= 0, A =< 255 ->
166166args_from_arity (Meta , A , E ) ->
167167 file_error (Meta , E , ? MODULE , {invalid_arity_for_capture , A }).
168168
169- is_sequential_and_not_empty ([]) -> false ;
170- is_sequential_and_not_empty (List ) -> is_sequential (List , 1 ).
169+ check_sequential_and_not_empty ([]) -> non_sequential ;
170+ check_sequential_and_not_empty (List ) -> check_sequential (List , 1 ).
171171
172- is_sequential ([{'&' , _ , [Int ]} | T ], Int ) -> is_sequential (T , Int + 1 );
173- is_sequential ([], _Int ) -> true ;
174- is_sequential (_ , _Int ) -> false .
172+ check_sequential ([{'&' , _ , [Int ]} | T ], Int ) -> check_sequential (T , Int + 1 );
173+ check_sequential ([], _Int ) -> sequential ;
174+ check_sequential (_ , _Int ) -> non_sequential .
175175
176176handle_capture_possible_warning (Meta , DotMeta , Mod , Fun , Arity , E ) ->
177177 case (Arity =:= 0 ) andalso (lists :keyfind (no_parens , 1 , DotMeta ) /= {no_parens , true }) of
0 commit comments