Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [BUG] Anonymous functions cause funcfiletrace to produce function-relative line numbers



On 16 Dec 2017, at 15:10, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>Does the same thing happen whenever a function is defined like this --
>...
>--  in an autoload file (zsh included)?

I wasn't sure what you meant here, since i am auto-loading the functions defined
that way. Someone on IRC suggested maybe you meant something like this?

  % < foo
  #
  panic() {
    print -rC2 -- $functrace $funcfiletrace
    exit 1
  }
  puts() {
    panic
  }
  puts

  % < tracetest.zsh
  fpath=( . )
  autoload -Uz foo
  main() {
    () { foo }
  }
  main

If that's the case, i actually *don't* see the problem there (with pws's patch):

  puts:1           /Users/dana/.../zsh/foo:7
  foo:9            /Users/dana/.../zsh/foo:9
  (anon):0         tracetest.zsh:4
  main:1           tracetest.zsh:4
  tracetest.zsh:6  tracetest.zsh:6

All those numbers look correct to me.

I also repeated my previous test case, but with `autoload -Uk` instead of `-Uz`,
and i got the same result as before, so the problem evidently isn't limited to
the combination of zsh-style auto-loading + ksh-style definitions.

(Let me know if i've misinterpreted your question)

dana



Messages sorted by: Reverse Date, Date, Thread, Author