aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2014-11-19 11:40:49 +0000
committerDaniel Kolesa <d.kolesa@samsung.com>2014-11-19 11:40:49 +0000
commitb1009770ef8e71e2787d59b2fad9be4b105f82cf (patch)
tree5d1b9b6b0353ae2f06f1f8b1032e4bedd7d46212
parentEvas: Check load_error before loading again (GL) (diff)
downloadefl-b1009770ef8e71e2787d59b2fad9be4b105f82cf.tar.gz
elua: simplify lualian typeconv
-rw-r--r--src/bin/elua/modules/lualian.lua34
1 files changed, 5 insertions, 29 deletions
diff --git a/src/bin/elua/modules/lualian.lua b/src/bin/elua/modules/lualian.lua
index c28f3496cd..ccf30dff34 100644
--- a/src/bin/elua/modules/lualian.lua
+++ b/src/bin/elua/modules/lualian.lua
@@ -80,50 +80,26 @@ local build_calln = function(tps, expr, isin)
return expr
end
-local typeconv_in = function(tps, expr)
- if tps:type_get() == eolian.type_type.POINTER then
- local base = tps:base_type_get()
- local f = known_ptr_in[base:c_type_get()]
- if f then return f(expr) end
- return build_calln(tps, expr, true)
- end
-
- local tp = tps:name_get()
-
- if is_num(tp) then return expr end
-
- local f = known_in[tp]
- if f then
- return f(expr)
- end
-
- return build_calln(tps, expr, true)
-end
-
local typeconv = function(tps, expr, isin)
- if isin then
- return typeconv_in(tps, expr)
- end
-
if tps:type_get() == eolian.type_type.POINTER then
local base = tps:base_type_get()
- local f = known_ptr_out[base:c_type_get()]
+ local f = (isin and known_ptr_in or known_ptr_out)[base:c_type_get()]
if f then return f(expr) end
- return build_calln(tps, expr, false)
+ return build_calln(tps, expr, isin)
end
local tp = tps:name_get()
if is_num(tp) then
- return ("tonumber(%s)"):format(expr)
+ return isin and expr or ("tonumber(%s)"):format(expr)
end
- local f = known_out[tp]
+ local f = (isin and known_in or known_out)[tp]
if f then
return f(expr)
end
- return build_calln(tps, expr, false)
+ return build_calln(tps, expr, isin)
end
local Node = util.Object:clone {