From 459116c10c11af2c112967c35ee74ae4feeba478 Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Tue, 9 May 2017 22:42:23 -0400 Subject: [PATCH] prepare for macrocall having a source location argument JuliaLang/julia#21746 --- REQUIRE | 2 +- src/DocSystem.jl | 2 +- src/Utilities/Utilities.jl | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/REQUIRE b/REQUIRE index 7911ddf256b..f5bc1ea65f3 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,3 +1,3 @@ julia 0.5 -Compat 0.17 +Compat 0.25 DocStringExtensions 0.2 diff --git a/src/DocSystem.jl b/src/DocSystem.jl index e3b89c3fbcd..48ae5b1b969 100644 --- a/src/DocSystem.jl +++ b/src/DocSystem.jl @@ -88,7 +88,7 @@ binding(m::Module, λ::Any) = binding(λ) function signature(x, str::AbstractString) ts = Base.Docs.signature(x) - (Meta.isexpr(x, :macrocall, 1) && !endswith(strip(str), "()")) ? :(Union{}) : ts + (Meta.isexpr(x, :macrocall, 1 + Compat.macros_have_sourceinfo) && !endswith(strip(str), "()")) ? :(Union{}) : ts end if VERSION < v"0.5.0-dev" Base.Docs.signature(::Any) = :(Union{}) diff --git a/src/Utilities/Utilities.jl b/src/Utilities/Utilities.jl index c4ce0a28b9c..bafc61e57bd 100644 --- a/src/Utilities/Utilities.jl +++ b/src/Utilities/Utilities.jl @@ -238,7 +238,7 @@ Returns a expression that, when evaluated, returns an [`Object`](@ref) represent function object(ex::Union{Symbol, Expr}, str::AbstractString) binding = Expr(:call, Binding, splitexpr(Docs.namify(ex))...) signature = Base.Docs.signature(ex) - isexpr(ex, :macrocall, 1) && !endswith(str, "()") && (signature = :(Union{})) + isexpr(ex, :macrocall, 1 + Compat.macros_have_sourceinfo) && !endswith(str, "()") && (signature = :(Union{})) Expr(:call, Object, binding, signature) end @@ -275,7 +275,7 @@ if VERSION < v"0.5-" end else function docs(ex::Union{Symbol, Expr}, str::AbstractString) - isexpr(ex, :macrocall, 1) && !endswith(rstrip(str), "()") && (ex = quot(ex)) + isexpr(ex, :macrocall, 1 + Compat.macros_have_sourceinfo) && !endswith(rstrip(str), "()") && (ex = quot(ex)) :(Base.Docs.@doc $ex) end end