mirror of
https://github.com/leafo/moonscript.git
synced 2024-12-08 01:54:24 +00:00
fix moon.mixin, fixes #99
This commit is contained in:
parent
2f4066d9bb
commit
fcf36aeb8c
@ -117,8 +117,7 @@ copy = function(self)
|
||||
end)()
|
||||
end
|
||||
mixin = function(self, cls, ...)
|
||||
local meta = getmetatable(cls)
|
||||
for key, val in pairs(meta.__index) do
|
||||
for key, val in pairs(cls.__base) do
|
||||
if not key:match("^__") then
|
||||
self[key] = val
|
||||
end
|
||||
|
@ -100,8 +100,7 @@ copy = =>
|
||||
|
||||
-- mixin class properties into self, call new
|
||||
mixin = (cls, ...) =>
|
||||
meta = getmetatable cls
|
||||
for key, val in pairs meta.__index
|
||||
for key, val in pairs cls.__base
|
||||
self[key] = val if not key\match"^__"
|
||||
cls.__init self, ...
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user