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/ambiguous.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/ambiguous.lua')
-rw-r--r-- | spec/outputs/ambiguous.lua | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/spec/outputs/ambiguous.lua b/spec/outputs/ambiguous.lua index 3da6f14..3c82a03 100644 --- a/spec/outputs/ambiguous.lua +++ b/spec/outputs/ambiguous.lua | |||
@@ -13,11 +13,17 @@ a, b = c, d; | |||
13 | (d(a))(c) | 13 | (d(a))(c) |
14 | for i = 1, 10 do | 14 | for i = 1, 10 do |
15 | a = function() end | 15 | a = function() end |
16 | (print)(1) | 16 | do |
17 | a = f; | 17 | (print)(1) |
18 | (print)(2) | 18 | end |
19 | a = f | ||
20 | do | ||
21 | (print)(2) | ||
22 | end | ||
19 | if cond then | 23 | if cond then |
20 | (print)(3) | 24 | do |
25 | (print)(3) | ||
26 | end | ||
21 | end | 27 | end |
22 | ::abc::; | 28 | ::abc::; |
23 | (print)(4) | 29 | (print)(4) |
@@ -40,7 +46,9 @@ do | |||
40 | end) | 46 | end) |
41 | end | 47 | end |
42 | do | 48 | do |
43 | print(123) | 49 | do |
50 | print(123) | ||
51 | end | ||
44 | end | 52 | end |
45 | do | 53 | do |
46 | f({ | 54 | f({ |
@@ -97,18 +105,16 @@ do | |||
97 | nums = _accum_0 | 105 | nums = _accum_0 |
98 | end | 106 | end |
99 | local objects | 107 | local objects |
100 | do | 108 | local _accum_0 = { } |
101 | local _accum_0 = { } | 109 | local _len_0 = 1 |
102 | local _len_0 = 1 | 110 | local _list_0 = items |
103 | local _list_0 = items | 111 | for _index_0 = 1, #_list_0 do |
104 | for _index_0 = 1, #_list_0 do | 112 | local item = _list_0[_index_0] |
105 | local item = _list_0[_index_0] | 113 | _accum_0[_len_0] = { |
106 | _accum_0[_len_0] = { | 114 | name = item |
107 | name = item | 115 | } |
108 | } | 116 | _len_0 = _len_0 + 1 |
109 | _len_0 = _len_0 + 1 | ||
110 | end | ||
111 | objects = _accum_0 | ||
112 | end | 117 | end |
118 | objects = _accum_0 | ||
113 | end | 119 | end |
114 | return nil | 120 | return nil |