Skip to content

Commit

Permalink
Ensure QuoteNodes contain requested data type
Browse files Browse the repository at this point in the history
  • Loading branch information
jmert committed Oct 13, 2020
1 parent 22ec2fe commit 9c98300
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/api_types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ end
# Dataspace constants
@defconstants H5S begin
# atomic data types
ALL::hid_t = 0
UNLIMITED::hid_t = typemax(hsize_t)
ALL::hsize_t = 0
UNLIMITED::hsize_t = typemax(hsize_t)

# Types of dataspaces (C enum H5S_class_t)
SCALAR::hid_t = hid_t(0)
Expand Down
8 changes: 6 additions & 2 deletions src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,12 @@ macro defconstants(prefix::Symbol, expr::Expr)
# Save type for later use
push!(imports, type)

value = isruntime ? esc(:(Ref{$type}())) :
QuoteNode(Core.eval(__module__, line.args[2]))
if isruntime
value = esc(:(Ref{$type}()))
else
valexpr = :(convert($type, $(line.args[2])))
value = QuoteNode(Core.eval(__module__, valexpr))
end
fullname = esc(:($innermod.$name))
getexpr = isruntime ? :($(fullname)[]) : fullname

Expand Down

0 comments on commit 9c98300

Please sign in to comment.