Skip to content

Commit a05c7cc

Browse files
committed
Fix compatibility issues with julia v0.4
1 parent 753597e commit a05c7cc

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/Options.jl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,19 @@ function Options{T<:OptionsChecking}(::Type{T},args...)
4242
else
4343
((), (), Array(Any, 0))
4444
end
45-
ht = Dict{Symbol,Int}(keys,index)
45+
if VERSION < v"0.3-"
46+
ht = Dict{Symbol,Int}(keys,index)
47+
else
48+
ht = Dict{Symbol,Int}(zip(keys,index))
49+
end
4650
used = falses(n)
4751
check_lock = falses(n)
4852
Options{T}(ht,vals,used,check_lock)
4953
end
5054
# Constructor: supply type followed by list of assignment expressions, e.g.,
5155
# o = Options(CheckNone,:(a=5),:(b=rand(3)),...)
5256
function Options{T<:OptionsChecking}(::Type{T},ex::Expr...)
53-
ht = (Symbol=>Int)[]
57+
ht = Dict{Symbol,Int}()
5458
vals = Array(Any,0)
5559
n = length(ex)
5660
for i = 1:n
@@ -184,7 +188,7 @@ macro defaults(opts,ex...)
184188
exret = :($(esc(symbol(varname))) = ischeck($(esc(opts))))
185189
# Transform the tuple into a vector, so that
186190
# we can manipulate it
187-
ex = {ex...}
191+
ex = Any[ex...]
188192
# Check each argument in the assignment list
189193
i = 1
190194
while i <= length(ex)
@@ -236,7 +240,7 @@ macro options(ex...)
236240
callargs = Any[:Options]
237241
# Transform the tuple into a vector, so that
238242
# we can manipulate it
239-
ex = {ex...}
243+
ex = Any[ex...]
240244
i = 1
241245
if length(ex) >= 1 && isa(ex[1], Symbol)
242246
push!(callargs, esc(ex[1]))
@@ -270,7 +274,7 @@ macro set_options(opts,ex...)
270274
end
271275
# Transform the tuple into a vector, so that
272276
# we can manipulate it
273-
ex = {ex...}
277+
ex = Any[ex...]
274278
# Check each argument in the assignment list
275279
i = 1
276280
while i <= length(ex)

0 commit comments

Comments
 (0)