@@ -39,65 +39,47 @@ line_compile = {
3939 local _ , names , values = unpack (node )
4040 local undeclared = self :declare (names )
4141 local declare = " local " .. concat (undeclared , " , " )
42- if # values == 1 and self :is_stm (values [1 ]) and cascading [ntype (values [1 ])] then
43- local stm = values [1 ]
44- if # undeclared > 0 then
45- self :add (declare )
42+ local has_fndef = false
43+ local i = 1
44+ while i <= # values do
45+ if ntype (values [i ]) == " fndef" then
46+ has_fndef = true
4647 end
47- local decorate
48- decorate = function (value )
49- return {
50- " assign" ,
51- names ,
52- {
53- value
54- }
55- }
56- end
57- return self :stm (stm , decorate )
58- else
59- local has_fndef = false
60- local i = 1
61- while i <= # values do
62- if ntype (values [i ]) == " fndef" then
63- has_fndef = true
64- end
65- i = i + 1
66- end
67- do
68- local _with_0 = self :line ()
69- if # undeclared == # names and not has_fndef then
70- _with_0 :append (declare )
71- else
72- if # undeclared > 0 then
73- self :add (declare )
74- end
75- _with_0 :append_list ((function ()
76- local _accum_0 = { }
77- local _len_0 = 0
78- local _list_0 = names
79- for _index_0 = 1 , # _list_0 do
80- local name = _list_0 [_index_0 ]
81- _len_0 = _len_0 + 1
82- _accum_0 [_len_0 ] = self :value (name )
83- end
84- return _accum_0
85- end )(), " , " )
48+ i = i + 1
49+ end
50+ do
51+ local _with_0 = self :line ()
52+ if # undeclared == # names and not has_fndef then
53+ _with_0 :append (declare )
54+ else
55+ if # undeclared > 0 then
56+ self :add (declare )
8657 end
87- _with_0 :append (" = " )
8858 _with_0 :append_list ((function ()
8959 local _accum_0 = { }
9060 local _len_0 = 0
91- local _list_0 = values
61+ local _list_0 = names
9262 for _index_0 = 1 , # _list_0 do
93- local v = _list_0 [_index_0 ]
63+ local name = _list_0 [_index_0 ]
9464 _len_0 = _len_0 + 1
95- _accum_0 [_len_0 ] = self :value (v )
65+ _accum_0 [_len_0 ] = self :value (name )
9666 end
9767 return _accum_0
9868 end )(), " , " )
99- return _with_0
10069 end
70+ _with_0 :append (" = " )
71+ _with_0 :append_list ((function ()
72+ local _accum_0 = { }
73+ local _len_0 = 0
74+ local _list_0 = values
75+ for _index_0 = 1 , # _list_0 do
76+ local v = _list_0 [_index_0 ]
77+ _len_0 = _len_0 + 1
78+ _accum_0 [_len_0 ] = self :value (v )
79+ end
80+ return _accum_0
81+ end )(), " , " )
82+ return _with_0
10183 end
10284 end ,
10385 update = function (self , node )
@@ -196,12 +178,12 @@ line_compile = {
196178 return _with_0
197179 end
198180 end ,
199- [" if" ] = function (self , node , ret )
181+ [" if" ] = function (self , node )
200182 local cond , block = node [2 ], node [3 ]
201183 local root
202184 do
203185 local _with_0 = self :block (self :line (" if " , self :value (cond ), " then" ))
204- _with_0 :stms (block , ret )
186+ _with_0 :stms (block )
205187 root = _with_0
206188 end
207189 local current = root
@@ -216,7 +198,7 @@ line_compile = {
216198 i = i + 1
217199 next = self :block (self :line (" elseif " , self :value (clause [2 ]), " then" ))
218200 end
219- next :stms (clause [i ], ret )
201+ next :stms (clause [i ])
220202 current .next = next
221203 current = next
222204 end
0 commit comments