Skip to content

Commit

Permalink
printing locations of method definitions. closes #182
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Aug 20, 2011
1 parent 190765c commit 18d8342
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion j/abstractarray.j
Original file line number Diff line number Diff line change
Expand Up @@ -1361,4 +1361,4 @@ end

summary{T,N}(s::SubArray{T,N}) =
strcat(dims2string(size(s)), " SubArray of ",
summary(s.parent))
summary(s.parent))
2 changes: 1 addition & 1 deletion src/boot.j
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ function append_any(xs...)
for x = xs
n += length(x)
end
out = Array{Any,1}((n,))
out = Array(Any, n)
i = 1
for x = xs
for y = x
Expand Down
19 changes: 18 additions & 1 deletion src/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1200,8 +1200,25 @@ static void print_methlist(char *name, jl_methlist_t *ml)
while (ml != NULL) {
ios_printf(s, "%s", name);
jl_show((jl_value_t*)ml->sig);
if (ml->func == NULL) // mark dummy cache entries
if (ml->func == NULL) {
// mark dummy cache entries
ios_printf(s, " *");
}
else {
jl_lambda_info_t *li = ml->func->linfo;
if (li != NULL && li->ast != NULL && jl_is_expr(li->ast)) {
jl_expr_t *body1 = (jl_expr_t*)jl_exprarg(jl_lam_body((jl_expr_t*)li->ast),0);
if (jl_is_expr(body1) &&
((jl_expr_t*)body1)->head == line_sym) {
long lno = jl_unbox_long(jl_exprarg(body1, 0));
char *fname = ((jl_sym_t*)jl_exprarg(body1, 1))->name;
char *sep = strrchr(fname, '/');
if (sep)
fname = sep+1;
ios_printf(s, " at %s:%d", fname, lno);
}
}
}
//if (ml->func && ml->func->linfo && ml->func->linfo->ast &&
// ml->func->linfo->inferred) {
// jl_show(ml->func->linfo->ast);
Expand Down

0 comments on commit 18d8342

Please sign in to comment.