Skip to content

Commit 91582a6

Browse files
committed
Add optional types to func_specializations(f[, tt])
Also add `method_specializations(m)::Vector`
1 parent 3c4ba75 commit 91582a6

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "LookingGlass"
22
uuid = "1fcbbee2-b350-4a01-aad8-439064dba09e"
33
authors = ["Nathan Daly"]
4-
version = "0.3.0"
4+
version = "0.3.1"
55

66
[deps]
77
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

src/LookingGlass.jl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ macro quot(e) QuoteNode(e) end
3131
# ---------------------------------------------------------------------------
3232

3333
"""
34-
func_specializations(f) -> Dict(MethodInstance => Method)
34+
func_specializations(f[, tt]) -> Dict(MethodInstance => Method)
3535
3636
Return all the specializations (MethodInstances) of each method of the given function (or
3737
callable object), if there are any.
@@ -57,10 +57,17 @@ function func_specializations end
5757
func_specializations(f) =
5858
Dict(mi => m
5959
for m in methods(f).ms
60-
for mi in _iterate_method_specializations(m)
60+
for mi in _method_specializations(m)
6161
)
62+
func_specializations(f, tt) =
63+
Dict(mi => m
64+
for m in methods(f, tt).ms
65+
for mi in _method_specializations(m)
66+
)
67+
68+
method_specializations(m) = collect(_method_specializations(m))
6269

63-
function _iterate_method_specializations(m)
70+
function _method_specializations(m::Method)
6471
s = m.specializations
6572
if VERSION > v"1.5-"
6673
return (s[i] for i in 1:length(s) if isassigned(s, i))

0 commit comments

Comments
 (0)