@@ -975,20 +975,23 @@ Statement = Transformer({
975975 constructor .arrow = " fat"
976976 end
977977 local real_name
978- if ntype (name ) == " chain" then
978+ local _exp_0 = ntype (name )
979+ if " chain" == _exp_0 then
979980 local last = name [# name ]
980- local _exp_0 = ntype (last )
981- if " dot" == _exp_0 then
981+ local _exp_1 = ntype (last )
982+ if " dot" == _exp_1 then
982983 real_name = {
983984 " string" ,
984985 ' "' ,
985986 last [2 ]
986987 }
987- elseif " index" == _exp_0 then
988+ elseif " index" == _exp_1 then
988989 real_name = last [2 ]
989990 else
990991 real_name = " nil"
991992 end
993+ elseif " nil" == _exp_0 then
994+ real_name = " nil"
992995 else
993996 real_name = {
994997 " string" ,
@@ -1112,7 +1115,9 @@ Statement = Transformer({
11121115 local _with_0 = build
11131116 local out_body = {
11141117 Run (function (self )
1115- self :put_name (name )
1118+ if name then
1119+ self :put_name (name )
1120+ end
11161121 return self :set (" super" , function (block , chain )
11171122 if chain then
11181123 local slice = (function ()
@@ -1134,8 +1139,8 @@ Statement = Transformer({
11341139 if head == nil then
11351140 return parent_cls_name
11361141 end
1137- local _exp_0 = head [1 ]
1138- if " call" == _exp_0 then
1142+ local _exp_1 = head [1 ]
1143+ if " call" == _exp_1 then
11391144 local calling_name = block :get (" current_block" )
11401145 slice [1 ] = {
11411146 " call" ,
@@ -1155,7 +1160,7 @@ Statement = Transformer({
11551160 calling_name
11561161 })
11571162 end
1158- elseif " colon" == _exp_0 then
1163+ elseif " colon" == _exp_1 then
11591164 local call = head [3 ]
11601165 insert (new_chain , {
11611166 " dot" ,
@@ -1186,7 +1191,7 @@ Statement = Transformer({
11861191 properties
11871192 }),
11881193 _with_0 .assign_one (base_name :chain (" __index" ), base_name ),
1189- build [" if" ]({
1194+ _with_0 [" if" ]({
11901195 cond = parent_cls_name ,
11911196 [" then" ] = {
11921197 _with_0 .chain ({
@@ -1215,11 +1220,9 @@ Statement = Transformer({
12151220 _with_0 .assign_one (LocalName (" self" ), cls_name ),
12161221 _with_0 .group (statements )
12171222 }
1218- else
1219- return { }
12201223 end
12211224 end )()),
1222- build [" if" ]({
1225+ _with_0 [" if" ]({
12231226 cond = {
12241227 " exp" ,
12251228 parent_cls_name ,
@@ -1236,7 +1239,13 @@ Statement = Transformer({
12361239 })
12371240 }
12381241 }),
1239- _with_0 .assign_one (name , cls_name ),
1242+ _with_0 .group ((function ()
1243+ if name then
1244+ return {
1245+ _with_0 .assign_one (name , cls_name )
1246+ }
1247+ end
1248+ end )()),
12401249 (function ()
12411250 if ret then
12421251 return ret (cls_name )
@@ -1245,15 +1254,17 @@ Statement = Transformer({
12451254 }
12461255 hoist_declarations (out_body )
12471256 value = _with_0 .group ({
1248- (function ()
1257+ _with_0 . group ( (function ()
12491258 if ntype (name ) == " value" then
1250- return _with_0 .declare ({
1251- names = {
1252- name
1253- }
1254- })
1259+ return {
1260+ _with_0 .declare ({
1261+ names = {
1262+ name
1263+ }
1264+ })
1265+ }
12551266 end
1256- end )(),
1267+ end )()) ,
12571268 _with_0 [" do" ](out_body )
12581269 })
12591270 end
@@ -1415,6 +1426,11 @@ Value = Transformer({
14151426 decorated = function (self , node )
14161427 return self .transform .statement (node )
14171428 end ,
1429+ class = function (self , node )
1430+ return build .block_exp ({
1431+ node
1432+ })
1433+ end ,
14181434 string = function (self , node )
14191435 local delim = node [2 ]
14201436 local convert_part
0 commit comments