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
|
return name
|
||||||
end,
|
end,
|
||||||
add = function(self, item)
|
add = function(self, item, pos)
|
||||||
self._lines:add(item)
|
do
|
||||||
|
local _with_0 = self._lines
|
||||||
|
_with_0:add(item)
|
||||||
|
if pos then
|
||||||
|
_with_0:mark_pos(pos)
|
||||||
|
end
|
||||||
|
end
|
||||||
return item
|
return item
|
||||||
end,
|
end,
|
||||||
render = function(self, buffer)
|
render = function(self, buffer)
|
||||||
|
@ -288,9 +288,11 @@ class Block
|
|||||||
@stm {"assign", {name}, {value}}
|
@stm {"assign", {name}, {value}}
|
||||||
name
|
name
|
||||||
|
|
||||||
-- add a line object
|
-- add something to the line buffer
|
||||||
add: (item) =>
|
add: (item, pos) =>
|
||||||
@_lines\add item
|
with @_lines
|
||||||
|
\add item
|
||||||
|
\mark_pos pos if pos
|
||||||
item
|
item
|
||||||
|
|
||||||
-- todo: pass in buffer as argument
|
-- todo: pass in buffer as argument
|
||||||
|
@ -78,7 +78,7 @@ return {
|
|||||||
_with_0:append(declare)
|
_with_0:append(declare)
|
||||||
else
|
else
|
||||||
if #undeclared > 0 then
|
if #undeclared > 0 then
|
||||||
self:add(declare)
|
self:add(declare, node[-1])
|
||||||
end
|
end
|
||||||
_with_0:append_list((function()
|
_with_0:append_list((function()
|
||||||
local _accum_0 = { }
|
local _accum_0 = { }
|
||||||
|
@ -43,7 +43,7 @@ import concat, insert from table
|
|||||||
if #undeclared == #names and not has_fndef
|
if #undeclared == #names and not has_fndef
|
||||||
\append declare
|
\append declare
|
||||||
else
|
else
|
||||||
@add declare if #undeclared > 0
|
@add declare, node[-1] if #undeclared > 0
|
||||||
\append_list [@value name for name in *names], ", "
|
\append_list [@value name for name in *names], ", "
|
||||||
|
|
||||||
\append " = "
|
\append " = "
|
||||||
|
Loading…
Reference in New Issue
Block a user