diff options
Diffstat (limited to 'script/core')
-rw-r--r-- | script/core/generic.lua | 24 | ||||
-rw-r--r-- | script/core/linker.lua | 11 |
2 files changed, 27 insertions, 8 deletions
diff --git a/script/core/generic.lua b/script/core/generic.lua index 8c05d0df..fe24bcfc 100644 --- a/script/core/generic.lua +++ b/script/core/generic.lua @@ -61,7 +61,7 @@ local function createValue(closure, obj, callback, road) local key = obj[1] local value = instantValue(closure, obj) if callback then - callback(road, key) + callback(road, key, obj) end linker.compileLink(value) return value @@ -79,8 +79,21 @@ local function buildValues(closure) if doc.type == 'doc.param' then local extends = doc.extends local index = extends.paramIndex - closure.params[index] = createValue(closure, extends, function (road, key) - local paramID = linker.getID(params[index]) + closure.params[index] = createValue(closure, extends, function (road, key, proto) + local param = params[index] + if not param then + return + end + local paramID + if proto.literal then + local str = param.type == 'string' and param[1] + if not str then + return + end + paramID = 'dn:' .. str + else + paramID = linker.getID(param) + end if not paramID then return end @@ -90,7 +103,10 @@ local function buildValues(closure) -- TODO upvalues[key][#upvalues[key]+1] = paramID end) - elseif doc.type == 'doc.return' then + end + end + for _, doc in ipairs(protoFunction.bindDocs) do + if doc.type == 'doc.return' then for _, rtn in ipairs(doc.returns) do closure.returns[rtn.returnIndex] = createValue(closure, rtn) end diff --git a/script/core/linker.lua b/script/core/linker.lua index fd7f886e..cecdc9de 100644 --- a/script/core/linker.lua +++ b/script/core/linker.lua @@ -576,8 +576,9 @@ function m.compileLink(source) end if source.type == 'generic.closure' then for i, rtn in ipairs(source.returns) do - local closureID = ('%s%s%s'):format( + local closureID = ('%s%s%s%s'):format( id, + SPLIT_CHAR, RETURN_INDEX_CHAR, i ) @@ -592,9 +593,11 @@ function m.compileLink(source) local upvalues = closure.upvalues if proto.type == 'doc.type.name' then local key = proto[1] - for _, paramID in ipairs(upvalues[key]) do - pushForward(id, paramID) - pushBackward(paramID, id) + if upvalues[key] then + for _, paramID in ipairs(upvalues[key]) do + pushForward(id, paramID) + pushBackward(paramID, id) + end end end if proto.type == 'doc.type' then |