Skip to content

macro esc function cannot be used with @code_exp or @code_string #79

@Sixzero

Description

@Sixzero

Guys, I use CodeTracking in my code, and I want to use @code_expr in a macro, but esc seems like a big problem here:

# file Foo.jl
using CodeTracking
macro foo(ex)
  quote
    bar = @code_string $esc(ex)
    # do something with bar
  end
end
myfn() = 1
@foo myfn()

ERROR: LoadError: expression is not a function call, or is too complex for @code_string to analyze; break it down to simpler parts if possible. In some cases, you may want to use Meta.@lower.

I believe it tries to @code_string the interpolate symbol.
Or in case: @code_string esc($ex)
It just returns the code_string of Escaping, what is not the intended behaviour, what we should have.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions