From 90d06f757abc439104d3121268629bb45cc49e49 Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Tue, 9 May 2017 22:40:32 -0400 Subject: [PATCH] Compat flag for adding source location argument to macros JuliaLang/julia#21746 --- README.md | 2 ++ src/Compat.jl | 3 +++ 2 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 1909c15ac..0001d528a 100644 --- a/README.md +++ b/README.md @@ -262,6 +262,8 @@ for `HermOrSym` such that using the new methods are backward compatible. * Single-argument `min`, `max` and `minmax` are defined on 0.4. +* The `Expr(:macrocall)` has an extra initial argument `__source__`, which can be tested for with `Compat.macros_have_sourceloc`. + ## New types Currently, no new exported types are introduced by Compat. diff --git a/src/Compat.jl b/src/Compat.jl index 8679e7e08..e488371e9 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -1494,4 +1494,7 @@ end include("to-be-deprecated.jl") +# https://github.com/JuliaLang/julia/pull/21746 +const macros_have_sourceloc = VERSION >= v"0.7-" && length(:(@test).args) == 2 + end # module Compat