Escape the esc function

It is not uncommon that most of the expression returned by a macro needs to be escaped.

For example

using MacroTools

const IGNORE = [true]

macro foo(f)
    fdict = MacroTools.splitdef(f)
    fdict[:body] = quote
        if IGNORE[1]
            return nothing
        end
        $(fdict[:body])
    end
    return $(esc(MacroTools.combinedef(dict)))
end

Here, I inserted a hook such that the function will not be executed if IGNORE[1] is true. IGNORE is set to a vector such that I can change the true to false at runtime.

Clearly, the const IGNORE should be resolved in the macro environment. However, it would be rather tedious to manually escape everything else except for IGNORE.

Is there a way to somehow label the constant IGNORE such that it will not be escaped even it’s inside the esc function?

I’m afraid it’s not common enough for a rather complex and dedicated syntax. We already have the powerful AST related structures.