File tree Expand file tree Collapse file tree 6 files changed +23
-4
lines changed
Expand file tree Collapse file tree 6 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -292,5 +292,12 @@ line_compile = {
292292 end ,
293293 group = function (self , node )
294294 return self :stms (node [2 ])
295+ end ,
296+ [" do" ] = function (self , node )
297+ do
298+ local _with_0 = self :block ()
299+ _with_0 :stms (node [2 ])
300+ return _with_0
301+ end
295302 end
296303}
Original file line number Diff line number Diff line change @@ -163,3 +163,7 @@ line_compile =
163163 group : ( node) =>
164164 @stms node[ 2 ]
165165
166+ do : ( node) =>
167+ with @block !
168+ \ stms node[ 2 ]
169+
Original file line number Diff line number Diff line change @@ -266,7 +266,7 @@ Statement = Transformer({
266266 with = function (node , ret )
267267 local _ , exp , block = unpack (node )
268268 local scope_name = NameProxy (" with" )
269- return build . group ({
269+ return build [ " do " ] ({
270270 build .assign_one (scope_name , exp ),
271271 Run (function (self )
272272 return self :set (" scope_var" , scope_name )
@@ -692,7 +692,7 @@ Value = Transformer({
692692 table.remove (node , # node )
693693 local base_name = NameProxy (" base" )
694694 local fn_name = NameProxy (" fn" )
695- return value (build .block_exp ({
695+ return Value (build .block_exp ({
696696 build .assign ({
697697 names = {
698698 base_name
Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ Statement = Transformer {
159159 with : ( node, ret) ->
160160 _, exp, block = unpack node
161161 scope_name = NameProxy " with"
162- build. group {
162+ build[ " do " ] {
163163 build. assign_one scope_name, exp
164164 Run => @set " scope_var" , scope_name
165165 build. group block
@@ -406,7 +406,7 @@ Value = Transformer {
406406 base_name = NameProxy " base"
407407 fn_name = NameProxy " fn"
408408
409- value build. block_exp {
409+ Value build. block_exp {
410410 build. assign {
411411 names : { base_name}
412412 values : { node}
Original file line number Diff line number Diff line change @@ -146,6 +146,12 @@ build = setmetatable({
146146 body
147147 }
148148 end ,
149+ [" do" ] = function (body )
150+ return {
151+ " do" ,
152+ body
153+ }
154+ end ,
149155 assign_one = function (name , value )
150156 return build .assign ({
151157 names = {
Original file line number Diff line number Diff line change @@ -83,6 +83,8 @@ build = nil
8383build = setmetatable {
8484 group : ( body) ->
8585 { " group" , body}
86+ do : ( body) ->
87+ { " do" , body}
8688 assign_one : ( name, value) ->
8789 build. assign {
8890 names : { name}
You can’t perform that action at this time.
0 commit comments