mirror of
https://github.com/leafo/moonscript.git
synced 2024-11-22 02:44:23 +00:00
set posmap for declare on assign for functions
This commit is contained in:
parent
01555dc4f4
commit
5964d06eee
@ -415,8 +415,14 @@ do
|
||||
})
|
||||
return name
|
||||
end,
|
||||
add = function(self, item)
|
||||
self._lines:add(item)
|
||||
add = function(self, item, pos)
|
||||
do
|
||||
local _with_0 = self._lines
|
||||
_with_0:add(item)
|
||||
if pos then
|
||||
_with_0:mark_pos(pos)
|
||||
end
|
||||
end
|
||||
return item
|
||||
end,
|
||||
render = function(self, buffer)
|
||||
|
@ -288,9 +288,11 @@ class Block
|
||||
@stm {"assign", {name}, {value}}
|
||||
name
|
||||
|
||||
-- add a line object
|
||||
add: (item) =>
|
||||
@_lines\add item
|
||||
-- add something to the line buffer
|
||||
add: (item, pos) =>
|
||||
with @_lines
|
||||
\add item
|
||||
\mark_pos pos if pos
|
||||
item
|
||||
|
||||
-- todo: pass in buffer as argument
|
||||
|
@ -78,7 +78,7 @@ return {
|
||||
_with_0:append(declare)
|
||||
else
|
||||
if #undeclared > 0 then
|
||||
self:add(declare)
|
||||
self:add(declare, node[-1])
|
||||
end
|
||||
_with_0:append_list((function()
|
||||
local _accum_0 = { }
|
||||
|
@ -43,7 +43,7 @@ import concat, insert from table
|
||||
if #undeclared == #names and not has_fndef
|
||||
\append declare
|
||||
else
|
||||
@add declare if #undeclared > 0
|
||||
@add declare, node[-1] if #undeclared > 0
|
||||
\append_list [@value name for name in *names], ", "
|
||||
|
||||
\append " = "
|
||||
|
Loading…
Reference in New Issue
Block a user