Current section
6 Versions
Jump to
Current section
6 Versions
Compare versions
4
files changed
+7
additions
-7
deletions
| @@ -12,4 +12,4 @@ | |
| 12 12 | {<<"maintainers">>,[<<"Moritz Schmale">>]}. |
| 13 13 | {<<"name">>,<<"loppers">>}. |
| 14 14 | {<<"requirements">>,[]}. |
| 15 | - {<<"version">>,<<"0.1.2">>}. |
| 15 | + {<<"version">>,<<"0.1.3">>}. |
| @@ -13,7 +13,7 @@ defmodule Loppers.Match do | |
| 13 13 | # ABC.fun(1, 2, 3) |
| 14 14 | # {{:., [], [{:__aliases__, [alias: false], [:ABC]}, :fun]}, [], [1, 2, 3]} |
| 15 15 | |
| 16 | - def matches?({{:., _dot_meta, [{:__aliases__, aliases, called_as}, called_fn]}, _fn_meta, arguments}, {mod, list_fn}) |
| 16 | + def matches?({{:., _dot_meta, [{:__aliases__, aliases, called_as}, called_fn]}, _fn_meta, _arguments}, {mod, list_fn}) |
| 17 17 | when called_fn == list_fn or list_fn == :__all__ do |
| 18 18 | called_module = case Keyword.get(aliases, :alias, false) do |
| 19 19 | false -> list_to_module(called_as) |
| @@ -24,7 +24,7 @@ defmodule Loppers.Match do | |
| 24 24 | end |
| 25 25 | |
| 26 26 | # special case for calling erlang module functions |
| 27 | - def matches?({{:., _dot_context, [erlang_module, called_fn]}, _fn_context, arguments}, {mod, list_fn}) |
| 27 | + def matches?({{:., _dot_context, [erlang_module, called_fn]}, _fn_context, _arguments}, {mod, list_fn}) |
| 28 28 | when (called_fn == list_fn or list_fn == :__all__) |
| 29 29 | and erlang_module == mod do |
| 30 30 | true |
| @@ -34,10 +34,10 @@ defmodule Loppers.Match do | |
| 34 34 | # map(:a, :b) |
| 35 35 | # {:map, [context: Elixir, import: Enum], [:a, :b]} |
| 36 36 | |
| 37 | - def matches?({function, context, arguments}, {mod, function}) do |
| 37 | + def matches?({called_fn, context, _arguments}, {mod, list_fn}) do |
| 38 38 | called_module = Keyword.get(context, :import) |
| 39 39 | |
| 40 | - mod == called_module |
| 40 | + mod == called_module && (list_fn == called_fn || list_fn == :__all__) |
| 41 41 | end |
| @@ -18,7 +18,7 @@ defmodule Loppers.Validate do | |
| 18 18 | end |
| 19 19 | |
| 20 20 | # special case for binary pattern match |
| 21 | - def validate({:=, _meta, [{:<<>>, _meta, _args} = lhs, rhs]} = ast, acc, validator) do |
| 21 | + def validate({:=, _meta1, [{:<<>>, _meta2, _args} = lhs, rhs]} = ast, acc, validator) do |
| 22 22 | acc = validator.(ast, acc) |
| 23 23 | acc = validator.(lhs, acc) |
| 24 24 | validate(rhs, acc, validator) |
| @@ -3,7 +3,7 @@ defmodule Loppers.Mixfile do | |
| 3 3 | |
| 4 4 | def project do |
| 5 5 | [app: :loppers, |
| 6 | - version: "0.1.2", |
| 6 | + version: "0.1.3", |
| 7 7 | elixir: "~> 1.4", |
| 8 8 | build_embedded: Mix.env == :prod, |
| 9 9 | start_permanent: Mix.env == :prod, |