set posmap for declare on assign for functions

This commit is contained in:
leaf corcoran 2014-06-14 18:49:22 -07:00
parent 01555dc4f4
commit 5964d06eee
4 changed files with 15 additions and 7 deletions

View File

@ -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)

View File

@ -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

View File

@ -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 = { }

View File

@ -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 " = "