Skip to content

Commit

Permalink
fix dim macro scope
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaqz committed Jan 30, 2024
1 parent de11399 commit 74022ae
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Dimensions/dimension.jl
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ using DimensionalData: @dim, YDim, XDim
"""
macro dim end
macro dim(typ::Symbol, args...)
dimmacro(typ::Symbol, :(DimensionalData.Dimension), args...)
dimmacro(typ::Symbol, :($DimensionalData.Dimension), args...)
end
macro dim(typ::Symbol, supertyp::Symbol, args...)
dimmacro(typ, supertyp, args...)
Expand All @@ -417,21 +417,21 @@ function dimmacro(typ, supertype, name::String=string(typ))
val::T
function $typ(val; kw...)
if length(kw) > 0
val = AutoVal(val, values(kw))
val = $DimensionalData.AutoVal(val, values(kw))
end
new{typeof(val)}(val)
end
$typ{T}(val::T; kw...) where T = new(val::T)
end
function $typ(val::AbstractArray; kw...)
if length(kw) > 0
val = AutoLookup(val, values(kw))
val = $DimensionalData.AutoLookup(val, values(kw))
end
$typ{typeof(val)}(val)
end
$typ() = $typ(:)
Dimensions.name(::Type{<:$typ}) = $(QuoteNode(Symbol(name)))
Dimensions.key2dim(::Val{$(QuoteNode(typ))}) = $typ()
$DimensionalData.name(::Type{<:$typ}) = $(QuoteNode(Symbol(name)))
$DimensionalData.key2dim(::Val{$(QuoteNode(typ))}) = $typ()
end |> esc
end

Expand Down

0 comments on commit 74022ae

Please sign in to comment.