summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2015-02-05 11:10:29 +0000
committerDaniel Kolesa <d.kolesa@samsung.com>2015-02-05 11:10:29 +0000
commit8abe1a06f8947e95320437dbae75f7f466233f9e (patch)
tree1cea4fe593cf5efa7f11b97e7625ce28a608aee4
parentcd0cca6f80f9a12904a8f176122fc3298c33b8df (diff)
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.lua25
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)
638end 638end
639 639
640local gen_class = function(klass) 640local gen_class = function(klass)
641 local inherits = klass:inherits_get() 641 local inherits = klass:inherits_get():to_array()
642 local parent 642 local parent
643 local mixins = {} 643 local mixins = {}
644 local ct = eolian.class_type 644 local ct = eolian.class_type
645 for v in inherits do 645 local n = 1
646 local tp = eolian.class_get_by_name(v):type_get() 646 if inherits[n] then
647 local tp = eolian.class_get_by_name(inherits[n]):type_get()
647 if tp == ct.REGULAR or tp == ct.ABSTRACT then 648 if tp == ct.REGULAR or tp == ct.ABSTRACT then
648 if parent then 649 parent = inherits[n]
649 error(klass:full_name_get() .. ": more than 1 parent!") 650 n = n + 1
650 end 651 end
651 parent = v 652 end
652 elseif tp == ct.MIXIN or tp == ct.INTERFACE then 653 for i = n, #inherits do
653 mixins[#mixins + 1] = v 654 local v = inherits[i]
654 else 655 local tp = eolian.class_get_by_name(v):type_get()
656 if tp == ct.UNKNOWN then
655 error(klass:full_name_get() .. ": unknown inherit " .. v) 657 error(klass:full_name_get() .. ": unknown inherit " .. v)
656 end 658 end
659 mixins[#mixins + 1] = v
657 end 660 end
658 return Class(klass, parent, mixins, gen_contents(klass)) 661 return Class(klass, parent, mixins, gen_contents(klass))
659end 662end