mirror of
https://github.com/leafo/moonscript.git
synced 2024-11-22 02:44:23 +00:00
cleanup
This commit is contained in:
parent
bd93b322d0
commit
ef4157fb5f
@ -17,7 +17,7 @@ do
|
|||||||
ntype = _table_0.ntype
|
ntype = _table_0.ntype
|
||||||
end
|
end
|
||||||
local concat, insert = table.concat, table.insert
|
local concat, insert = table.concat, table.insert
|
||||||
local pos_to_line, get_line, get_closest_line, trim = util.pos_to_line, util.get_line, util.get_closest_line, util.trim
|
local pos_to_line, get_closest_line, trim = util.pos_to_line, util.get_closest_line, util.trim
|
||||||
local mtype = util.moon.type
|
local mtype = util.moon.type
|
||||||
local Line, Lines
|
local Line, Lines
|
||||||
Lines = (function()
|
Lines = (function()
|
||||||
@ -254,7 +254,6 @@ Line = (function()
|
|||||||
return _class_0
|
return _class_0
|
||||||
end)()
|
end)()
|
||||||
Block = (function()
|
Block = (function()
|
||||||
local block_iterator
|
|
||||||
local _parent_0 = nil
|
local _parent_0 = nil
|
||||||
local _base_0 = {
|
local _base_0 = {
|
||||||
header = "do",
|
header = "do",
|
||||||
@ -477,7 +476,6 @@ Block = (function()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
node = self.transform.statement(node)
|
node = self.transform.statement(node)
|
||||||
local before = #self._lines
|
|
||||||
local result
|
local result
|
||||||
do
|
do
|
||||||
local fn = line_compile[ntype(node)]
|
local fn = line_compile[ntype(node)]
|
||||||
@ -577,18 +575,6 @@ Block = (function()
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
_base_0.__class = _class_0
|
_base_0.__class = _class_0
|
||||||
local self = _class_0
|
|
||||||
block_iterator = function(list)
|
|
||||||
return coroutine.wrap(function()
|
|
||||||
local _list_0 = list
|
|
||||||
for _index_0 = 1, #_list_0 do
|
|
||||||
local item = _list_0[_index_0]
|
|
||||||
if Block == mtype(item) then
|
|
||||||
coroutine.yield(item)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
if _parent_0 and _parent_0.__inherited then
|
if _parent_0 and _parent_0.__inherited then
|
||||||
_parent_0.__inherited(_parent_0, _class_0)
|
_parent_0.__inherited(_parent_0, _class_0)
|
||||||
end
|
end
|
||||||
|
@ -14,7 +14,7 @@ import Set from require "moonscript.data"
|
|||||||
import ntype from require "moonscript.types"
|
import ntype from require "moonscript.types"
|
||||||
|
|
||||||
import concat, insert from table
|
import concat, insert from table
|
||||||
import pos_to_line, get_line, get_closest_line, trim from util
|
import pos_to_line, get_closest_line, trim from util
|
||||||
|
|
||||||
mtype = util.moon.type
|
mtype = util.moon.type
|
||||||
|
|
||||||
@ -82,7 +82,6 @@ class Lines
|
|||||||
else
|
else
|
||||||
t
|
t
|
||||||
|
|
||||||
-- copy with only array elements
|
|
||||||
"Lines<#{util.dump(strip @)\sub 1, -2}>"
|
"Lines<#{util.dump(strip @)\sub 1, -2}>"
|
||||||
|
|
||||||
-- Buffer for building up a line
|
-- Buffer for building up a line
|
||||||
@ -255,8 +254,6 @@ class Block
|
|||||||
buffer\add @header
|
buffer\add @header
|
||||||
buffer\mark_pos @pos
|
buffer\mark_pos @pos
|
||||||
|
|
||||||
-- print "Header:", util.dump(@header), mtype(@header).__name
|
|
||||||
|
|
||||||
if @next
|
if @next
|
||||||
buffer\add @_lines
|
buffer\add @_lines
|
||||||
@next\render buffer
|
@next\render buffer
|
||||||
@ -312,19 +309,10 @@ class Block
|
|||||||
with Line!
|
with Line!
|
||||||
\append_list [@value v for v in *values], delim
|
\append_list [@value v for v in *values], delim
|
||||||
|
|
||||||
|
|
||||||
block_iterator = (list) ->
|
|
||||||
coroutine.wrap ->
|
|
||||||
for item in *list
|
|
||||||
if Block == mtype item
|
|
||||||
coroutine.yield item
|
|
||||||
|
|
||||||
stm: (node, ...) =>
|
stm: (node, ...) =>
|
||||||
return if not node -- skip blank statements
|
return if not node -- skip blank statements
|
||||||
node = @transform.statement node
|
node = @transform.statement node
|
||||||
|
|
||||||
before = #@_lines
|
|
||||||
|
|
||||||
result = if fn = line_compile[ntype(node)]
|
result = if fn = line_compile[ntype(node)]
|
||||||
fn self, node, ...
|
fn self, node, ...
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user