@@ -221,13 +221,21 @@ translate({Kind, Line, [Call]}, S) when ?FUNS(Kind) ->
221221translate ({Kind , Line , [Call , Expr ]}, S ) when ? FUNS (Kind ) ->
222222 assert_module_scope (Line , Kind , S ),
223223 assert_no_function_scope (Line , Kind , S ),
224+
224225 { TCall , Guards } = elixir_clauses :extract_guards (Call ),
225- { Name , Args } = elixir_clauses :extract_args (TCall ),
226+ { Name , Args } = case elixir_clauses :extract_args (TCall ) of
227+ error -> syntax_error (Line , S # elixir_scope .file ,
228+ " invalid syntax in ~s ~s " , [Kind , 'Elixir.Macro' :to_binary (TCall )]);
229+ Tuple -> Tuple
230+ end ,
231+
226232 assert_no_aliases_name (Line , Name , Args , S ),
233+
227234 TName = elixir_tree_helpers :abstract_syntax (Name ),
228235 TArgs = elixir_tree_helpers :abstract_syntax (Args ),
229236 TGuards = elixir_tree_helpers :abstract_syntax (Guards ),
230237 TExpr = elixir_tree_helpers :abstract_syntax (Expr ),
238+
231239 { elixir_def :wrap_definition (Kind , Line , TName , TArgs , TGuards , TExpr , S ), S };
232240
233241translate ({Kind , Line , [Name , Args , Guards , Expr ]}, S ) when ? FUNS (Kind ) ->
0 commit comments