Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pfitzseb committed Apr 21, 2016
1 parent b317330 commit e2a6b7e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions src/display/methods.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

using Hiccup, Lazy

isuntitled(p) = ismatch(r"^untitled-[\d\w]+(:\d+)?$", p)
Expand All @@ -14,11 +15,6 @@ function pkgpath(path)
m == nothing ? basename(path) : m.captures[1]
end

findpath(path) =
isabspath(path) || isuntitled(path) ?
(pkgpath(path), path) :
(normpath("base/$path"), basepath(path))

appendline(path, line) = line > 0 ? "$path:$line" : path

baselink(path, line) =
Expand All @@ -30,6 +26,11 @@ baselink(path, line) =

stripparams(t) = replace(t, r"\{([A-Za-z, ]*?)\}", "")

findpath(path) =
isabspath(path) || isuntitled(path) ?
(pkgpath(path), path) :
(normpath("base/$path"), basepath(path))

function methodarray(mt::MethodTable)
defs = Method[]
d = mt.defs
Expand All @@ -40,8 +41,8 @@ function methodarray(mt::MethodTable)
file(m) = m.func.code.file |> string |> basename
line(m) = m.func.code.line
sort!(defs, lt = (a, b) -> file(a) == file(b) ?
line(a) < line(b) :
file(a) < file(b))
line(a) < line(b) :
file(a) < file(b))
return defs
end

Expand Down Expand Up @@ -73,8 +74,9 @@ end

@render i::Inline ms::Vector{Method} begin
isempty(ms) && return "No methods found."
r(x) = render(i, x, options = options)
Tree(Text("$(length(ms)) method$(length(ms)==1?"":"s") found:"),
[table(".methods", [tr(td(a), td(b)) for (a, b) in map(view, ms)])])
[table(".methods", [tr(td(c(r(a))), td(c(r(b)))) for (a, b) in map(view, ms)])])
end

function view_obj(m::Method)
Expand Down
2 changes: 1 addition & 1 deletion src/eval.jl
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,6 @@ handle("methods") do data
elseif wordtype == DataType
result = @errs include_string(mod, "methodswith($word)")
end
@d(:items => method_obj(result),
@d(:items => method_obj(result),
:error => typeof(result)==EvalError ? true : false)
end

0 comments on commit e2a6b7e

Please sign in to comment.