diff options
| author | Li Jin <dragon-fly@qq.com> | 2024-03-21 09:14:34 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2024-03-21 09:14:34 +0800 |
| commit | 4a3cc26c6dfd74e61c8b6480038d6a292ea86e47 (patch) | |
| tree | 9554b94cfc15e4acee0c2e60b63af16f1b828207 /spec/outputs/cond.lua | |
| parent | 80b65520da432843f0c63431a1867bd2620bc4ac (diff) | |
| download | yuescript-4a3cc26c6dfd74e61c8b6480038d6a292ea86e47.tar.gz yuescript-4a3cc26c6dfd74e61c8b6480038d6a292ea86e47.tar.bz2 yuescript-4a3cc26c6dfd74e61c8b6480038d6a292ea86e47.zip | |
remove redundant 'do' blocks in code generation.
Diffstat (limited to 'spec/outputs/cond.lua')
| -rw-r--r-- | spec/outputs/cond.lua | 64 |
1 files changed, 27 insertions, 37 deletions
diff --git a/spec/outputs/cond.lua b/spec/outputs/cond.lua index acbf644..5a5aae5 100644 --- a/spec/outputs/cond.lua +++ b/spec/outputs/cond.lua | |||
| @@ -113,17 +113,15 @@ local z = false | |||
| 113 | if false then | 113 | if false then |
| 114 | _ = one | 114 | _ = one |
| 115 | else | 115 | else |
| 116 | do | 116 | local x = true |
| 117 | local x = true | 117 | if x then |
| 118 | if x then | 118 | _ = two |
| 119 | _ = two | 119 | else |
| 120 | z = true | ||
| 121 | if z then | ||
| 122 | _ = three | ||
| 120 | else | 123 | else |
| 121 | z = true | 124 | _ = four |
| 122 | if z then | ||
| 123 | _ = three | ||
| 124 | else | ||
| 125 | _ = four | ||
| 126 | end | ||
| 127 | end | 125 | end |
| 128 | end | 126 | end |
| 129 | end | 127 | end |
| @@ -131,33 +129,27 @@ local out | |||
| 131 | if false then | 129 | if false then |
| 132 | out = one | 130 | out = one |
| 133 | else | 131 | else |
| 134 | do | 132 | local x = true |
| 135 | local x = true | 133 | if x then |
| 136 | if x then | 134 | out = two |
| 137 | out = two | 135 | else |
| 136 | z = true | ||
| 137 | if z then | ||
| 138 | out = three | ||
| 138 | else | 139 | else |
| 139 | z = true | 140 | out = four |
| 140 | if z then | ||
| 141 | out = three | ||
| 142 | else | ||
| 143 | out = four | ||
| 144 | end | ||
| 145 | end | 141 | end |
| 146 | end | 142 | end |
| 147 | end | 143 | end |
| 148 | local kzy | 144 | local kzy |
| 149 | kzy = function() | 145 | kzy = function() |
| 150 | do | 146 | local something = true |
| 151 | local something = true | 147 | if something then |
| 152 | if something then | 148 | return 1 |
| 153 | return 1 | 149 | else |
| 154 | else | 150 | local another = false |
| 155 | do | 151 | if another then |
| 156 | local another = false | 152 | return 2 |
| 157 | if another then | ||
| 158 | return 2 | ||
| 159 | end | ||
| 160 | end | ||
| 161 | end | 153 | end |
| 162 | end | 154 | end |
| 163 | end | 155 | end |
| @@ -314,12 +306,10 @@ do | |||
| 314 | end | 306 | end |
| 315 | end | 307 | end |
| 316 | do | 308 | do |
| 317 | do | 309 | local _M = { } |
| 318 | local _M = { } | 310 | if _M then |
| 319 | if _M then | 311 | local Thing = _M.Thing |
| 320 | local Thing = _M.Thing | 312 | a, b = _M.a, _M.b |
| 321 | a, b = _M.a, _M.b | ||
| 322 | end | ||
| 323 | end | 313 | end |
| 324 | end | 314 | end |
| 325 | do | 315 | do |
