Skip to content

Commit 8d470cf

Browse files
committed
1 parent b66db8e commit 8d470cf

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
name = "JuliaVariables"
22
uuid = "b14d175d-62b4-44ba-8fb7-3064adc8c3ec"
33
authors = ["thautwarm"]
4-
version = "0.2.0"
4+
version = "0.2.1"
55

66
[deps]
77
MLStyle = "d8e11817-5142-5d16-987a-aa16d5891078"
88
NameResolution = "71a1bf82-56d0-4bbc-8a3c-48b961074391"
99

1010
[compat]
11-
julia = "1"
12-
MLStyle = "^0.3.1"
11+
MLStyle = "^0.3.1, ^0.4.1"
1312
NameResolution = "^0.1.3"
13+
julia = "1"
1414

1515
[extras]
1616
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

src/SimplifyEx.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
using MLStyle
22

3+
_wrap_block(ex::Expr) = ex
4+
_wrap_block(o) = Expr(:block, o)
5+
_simplify_block(ex) = _wrap_block(simplify_ex(ex))
6+
7+
38
function simplify_ex(ex::Expr)
49
@match ex begin
510
Expr(:for, Expr(:block, assigns...), body) =>
6-
foldr(assigns, init=simplify_ex(body)) do ass, last
11+
foldr(assigns, init=_simplify_block(body)) do ass, last
712
Expr(:for, simplify_ex(ass), last)
813
end
914
Expr(:let, Expr(:block, assigns...), body) =>
10-
foldr(assigns, init=simplify_ex(body)) do ass, last
15+
foldr(assigns, init=_simplify_block(body)) do ass, last
1116
Expr(:let, simplify_ex(ass), last)
1217
end
1318
Expr(:(=), lhs && Expr(:call, _...), rhs) =>

0 commit comments

Comments
 (0)