Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Julia-PR33764 #16

Merged
merged 1 commit into from
Apr 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/CEnum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ macro cenum(T, syms...)
end
basetype = Int32
typename = T
if isa(T, Expr) && T.head == :(::) && length(T.args) == 2 && isa(T.args[1], Symbol)
if isa(T, Expr) && T.head === :(::) && length(T.args) == 2 && isa(T.args[1], Symbol)
typename = T.args[1]
basetype = Core.eval(__module__, T.args[2])
if !isa(basetype, DataType) || !(basetype <: Integer) || !isbitstype(basetype)
Expand All @@ -83,7 +83,7 @@ macro cenum(T, syms...)
lo = hi = 0
i = zero(basetype)

if length(syms) == 1 && syms[1] isa Expr && syms[1].head == :block
if length(syms) == 1 && syms[1] isa Expr && syms[1].head === :block
syms = syms[1].args
end
for s in syms
Expand All @@ -93,7 +93,7 @@ macro cenum(T, syms...)
throw(ArgumentError("overflow in value \"$s\" of Cenum $typename"))
end
elseif isa(s, Expr) &&
(s.head == :(=) || s.head == :kw) &&
(s.head === :(=) || s.head === :kw) &&
length(s.args) == 2 && isa(s.args[1], Symbol)
i = Core.eval(__module__, s.args[2]) # allow exprs, e.g. uint128"1"
if !isa(i, Integer)
Expand Down