Skip to content

Commit 041c7cb

Browse files
Convert :if blocks to ifelse calls
1 parent ca0692e commit 041c7cb

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/utils.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ using MacroTools
22

33

44
function Base.convert(::Type{Expression}, ex::Expr)
5+
ex.head === :if && (ex = Expr(:call, ifelse, ex.args...))
56
ex.head === :call || throw(ArgumentError("internal representation does not support non-call Expr"))
67

78
op = eval(ex.args[1]) # HACK

test/variable_parsing.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@ D1 = Differential(t)
3232

3333
@test @macroexpand(@parameters x, y, z(t)) == @macroexpand(@parameters x y z(t))
3434
@test @macroexpand(@variables x, y, z(t)) == @macroexpand(@variables x y z(t))
35+
36+
convert(Expression, :($x == 0 ? $y : $x))

0 commit comments

Comments
 (0)