diff options
author | Daniel Kolesa <d.kolesa@samsung.com> | 2015-02-05 11:10:29 +0000 |
---|---|---|
committer | Daniel Kolesa <d.kolesa@samsung.com> | 2015-02-05 11:10:29 +0000 |
commit | 8abe1a06f8947e95320437dbae75f7f466233f9e (patch) | |
tree | 1cea4fe593cf5efa7f11b97e7625ce28a608aee4 | |
parent | cd0cca6f80f9a12904a8f176122fc3298c33b8df (diff) | |
download | efl-8abe1a06f8947e95320437dbae75f7f466233f9e.tar.gz |
elua: correct eo inheritance behavior
Now we try to treat first inherit as a parent and everything else as a mixin.
If the first inherit is not a class (interface or mixin), every inherit is
treated as a mixin.
@fix
-rw-r--r-- | src/scripts/elua/modules/lualian.lua | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/scripts/elua/modules/lualian.lua b/src/scripts/elua/modules/lualian.lua index 85208e17db..03a1d325e6 100644 --- a/src/scripts/elua/modules/lualian.lua +++ b/src/scripts/elua/modules/lualian.lua @@ -638,22 +638,25 @@ local gen_mixin = function(klass) end local gen_class = function(klass) - local inherits = klass:inherits_get() + local inherits = klass:inherits_get():to_array() local parent - local mixins = {} + local mixins = {} local ct = eolian.class_type - for v in inherits do - local tp = eolian.class_get_by_name(v):type_get() + local n = 1 + if inherits[n] then + local tp = eolian.class_get_by_name(inherits[n]):type_get() if tp == ct.REGULAR or tp == ct.ABSTRACT then - if parent then - error(klass:full_name_get() .. ": more than 1 parent!") - end - parent = v - elseif tp == ct.MIXIN or tp == ct.INTERFACE then - mixins[#mixins + 1] = v - else + parent = inherits[n] + n = n + 1 + end + end + for i = n, #inherits do + local v = inherits[i] + local tp = eolian.class_get_by_name(v):type_get() + if tp == ct.UNKNOWN then error(klass:full_name_get() .. ": unknown inherit " .. v) end + mixins[#mixins + 1] = v end return Class(klass, parent, mixins, gen_contents(klass)) end |