Skip to content
Browse files

Fix IEX's s helper to correctly handle MF and MFA requests

  • Loading branch information...
1 parent 4c1f445 commit 295d275d13dd89a3c662be84bec79c9c527cd6d3 @yrashk yrashk committed Dec 2, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/iex/lib/iex/helpers.ex
View
10 lib/iex/lib/iex/helpers.ex
@@ -344,7 +344,7 @@ defmodule IEx.Helpers do
@doc false
def s(module, function) when is_atom(function) do
- specs = lc {{f, _arity}, _spec} = spec inlist beam_specs(module),
+ specs = lc {_kind, {{f, _arity}, _spec}} = spec inlist beam_specs(module),
f == function do
print_spec(spec)
spec
@@ -369,7 +369,13 @@ defmodule IEx.Helpers do
@doc false
def s(module, function, arity) do
- spec = List.keyfind(beam_specs(module), { function, arity }, 0)
+ case Enum.filter(beam_specs(module),
@josevalim
Elixir member
josevalim added a note Dec 2, 2012

Please move the filtering into its own line. Otherwise it gets quite hard to read. :(

@yrashk
yrashk added a note Dec 2, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ fn({_type, {{f,a}, _value}}) ->
+ f == function and a == arity
+ end) do
+ [spec] -> :ok
+ _ -> spec = nil
+ end
if spec do
print_spec(spec)

0 comments on commit 295d275

Please sign in to comment.
Something went wrong with that request. Please try again.