Skip to content

Commit

Permalink
Revert "insert_returns"
Browse files Browse the repository at this point in the history
This reverts commit 38a4970.
  • Loading branch information
Shashi Gowda committed Feb 27, 2018
1 parent 658a991 commit c658b81
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/JSExpr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,14 @@ function func_expr(args, body)
end

function insert_return(ex)
isexpr(ex, :block) ? :($(ex.args[1:end-1]...);$(insert_return(ex.args[end]))) :
isexpr(ex, :if) ? Expr(:if, ex.args[1], map(x -> insert_return(x), ex.args[2:end])...) :
isexpr(ex, :return) ? ex :
:(return $ex)
if isa(ex, Symbol) || !isexpr(ex, :block)
Expr(:return, ex)
else
isexpr(ex.args[end], :return) && return ex
ex1 = copy(ex)
ex1.args[end] = insert_return(ex.args[end])
ex1
end
end


Expand Down

0 comments on commit c658b81

Please sign in to comment.