Skip to content

Commit

Permalink
Updates for Julia 0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan committed Jul 19, 2018
1 parent d0fc759 commit 38b8fee
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ os:
- linux
- osx
julia:
- 0.6
- 0.7
- nightly
notifications:
email: false
# uncomment the following lines to override the default test script
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
environment:
matrix:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.4/julia-0.4-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.4/julia-0.4-latest-win64.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.7/julia-0.7-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.7/julia-0.7-latest-win64.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"

Expand Down
6 changes: 3 additions & 3 deletions src/Retry.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module Retry

__precompile__(true)

module Retry

export @repeat, @protected, efield, ecode

efield(x, f, default=nothing) = f in fieldnames(x) ? getfield(x, f) : default
efield(x, f, default=nothing) = f in fieldnames(typeof(x)) ? getfield(x, f) : default
ecode(x) = efield(x, :code)

include("repeat_try.jl")
Expand Down
2 changes: 1 addition & 1 deletion src/protected_try.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ macro protected(try_expr::Expr)
end

# Check for nothing exception at start of catch block...
unshift!(catch_block.args, :($exception == nothing && rethrow($exception)))
pushfirst!(catch_block.args, :($exception == nothing && rethrow($exception)))

# Check rethrow flag at end of catch block...
push!(catch_block.args, :($exception == nothing || rethrow($exception)))
Expand Down
6 changes: 3 additions & 3 deletions src/repeat_try.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ end

function esc_args!(expr::Expr)
for (i, arg) in enumerate(expr.args)
if isa(arg, Symbol) || arg.head != :line
if isa(arg, Symbol) || !isa(arg, LineNumberNode)
expr.args[i] = esc(arg)
end
end
Expand Down Expand Up @@ -171,14 +171,14 @@ macro repeat(max, try_expr::Expr)

# Replace @ignore/@retry macro call with modified if expression...
catch_block.args[i] = if_expr
elseif expr.head != :line
elseif !isa(expr, LineNumberNode)
catch_block.args[i] = esc(expr)
end
end

# Check for nothing exception at start of catch block...
insert!(catch_block.args, 2, :($exception == nothing && rethrow()))
unshift!(catch_block.args, :(ignore = false))
pushfirst!(catch_block.args, :(ignore = false))

# Rethrow at end of catch block...
push!(catch_block.args, :(ignore || rethrow($exception)))
Expand Down

0 comments on commit 38b8fee

Please sign in to comment.