From bf2ac6c93710f36882f91c7895a04bb8dce8ce3d Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Wed, 24 May 2017 17:40:51 +0200 Subject: [PATCH] elua: update for unit api usage --- src/scripts/elua/modules/lualian.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/scripts/elua/modules/lualian.lua b/src/scripts/elua/modules/lualian.lua index e8e6af5..cfcb148 100644 --- a/src/scripts/elua/modules/lualian.lua +++ b/src/scripts/elua/modules/lualian.lua @@ -15,6 +15,8 @@ local func_type = eolian.function_type local obj_scope = eolian.object_scope local param_dir = eolian.parameter_dir +local gen_unit + cutil.init_module(function() dom = log.Domain("lualian") if not dom:is_valid() then @@ -669,7 +671,7 @@ local gen_class = function(klass) local mixins = {} -- also includes ifaces, they're separated later for i = 1, #inherits do local v = inherits[i] - local tp = eolian.class_get_by_name(v):type_get() + local tp = eolian.class_get_by_name(gen_unit, v):type_get() if tp == class_type.REGULAR or tp == class_type.ABSTRACT then parents[#parents + 1] = v elseif tp == class_type.INTERFACE or tp == class_type.MIXIN then @@ -696,14 +698,16 @@ M.system_directory_scan = function() end M.generate = function(fname, fstream) - if eolian.file_parse(fname) == nil then + local unit = eolian.file_parse(fname) + if unit == nil then error("Failed parsing file: " .. fname) end + gen_unit = unit if not eolian.database_validate() then error("Failed validating database.") end local sfn = fname:match(".*[\\/](.+)$") or fname - local klass = eolian.class_get_by_file(sfn) + local klass = eolian.class_get_by_file(unit, sfn) File(fname, klass, { gen_class(klass) }):generate(fstream or io.stdout) end -- 2.7.4