Skip to content

Commit

Permalink
Throw compile error when multiple args are used with defw
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyalIcing committed Aug 11, 2023
1 parent e4242af commit bb54502
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/orb/def_dsl.ex
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,18 @@ defmodule Orb.DefDSL do

defp define_elixir_def(call, visibility) do
{name, func_args} = Macro.decompose_call(call)
{_, meta, _} = call
# arity = length(args)

def_args = case func_args do
[] -> []
[keywords] -> for {keyword, _type} <- keywords do
[keywords] -> (for {keyword, _type} <- keywords do
Macro.var(keyword, nil)
end
end)
multiple when is_list(multiple) ->
raise CompileError, line: meta[:line], file: meta[:file], description: "Cannot define function with multiple arguments: use keyword list instead."
end

meta = elem(call, 1)
def_call = {name, meta, def_args}

def_kind = case visibility do
Expand Down

0 comments on commit bb54502

Please sign in to comment.