diff --git a/DEV_CHANGELOG.txt b/DEV_CHANGELOG.txt index 030981f..6682ab6 100644 --- a/DEV_CHANGELOG.txt +++ b/DEV_CHANGELOG.txt @@ -5,3 +5,6 @@ types 모듈이 삭제되며 init.lua 에 통합됨 이제 extend 에 대해서 Init(self) self 안에 props 기능이 내장되어있음 TODO: slot 기능 구현 +spring 구현 + +TODO: !ChildRemoved 구현 \ No newline at end of file diff --git a/mock/Slot.txt b/mock/Slot.txt new file mode 100644 index 0000000..dfc28d7 --- /dev/null +++ b/mock/Slot.txt @@ -0,0 +1,22 @@ + +Window { + Class.Slot "Content" { + Text { + Text = "wow"; + }; + Text { + Text = "wow"; + }; + Text { + Text = "wow"; + }; + Text { + Text = "wow"; + }; + } + TopbarButton { + [Class.Slot] = "Topbar"; + }; +} +다수가 있을경우 +이런식으로 묶을 수 있다고 하자 diff --git a/src/class.lua b/src/class.lua index a3ff83b..f8a74a9 100644 --- a/src/class.lua +++ b/src/class.lua @@ -110,8 +110,13 @@ function module.init(shared) new.SetProperty = SetProperty local function Link(linker,item,index,indexType) - local target = linker.target - local name = linker.name + -- error("Not implemented") + + local target = linker.lvalue + local name = linker.key + + -- local target = linker.target + -- local name = linker.name if indexType == "number" then -- set -- if rawget(target,name) ~= nil then @@ -140,7 +145,7 @@ function module.init(shared) local indexType = typeof(index) local quadType = valueType == "table" and PcallGetProperty(value,"__type") - if quadType == "quad_linker" then + if indexType == "number" and quadType == "quad_register" then -- linking Link(value,item,index,indexType) elseif indexType == "string" and quadType == "quad_register" then @@ -349,13 +354,13 @@ function module.init(shared) end }) - local function Linker(target,name) - return { - __type = "quad_linker"; - target = target; - name = name; - } - end + -- local function Linker(target,name) + -- return { + -- __type = "quad_linker"; + -- target = target; + -- name = name; + -- } + -- end -- make class function new.Extend() @@ -400,8 +405,12 @@ function module.init(shared) return self end - function this:Default(...) - return this.__prop:Default(...) + -- default function from props + function this:Default(key,value) + if self == this then + error("prop handler not found (this method cannot be used on class)") + end + self.__prop:Default(key,value) end function this:GetPropertyChangedSignal(propertyName) @@ -504,7 +513,6 @@ function module.init(shared) end end end - self = nil end --- link to new @@ -517,7 +525,10 @@ function module.init(shared) if type(name) ~= "string" then error(("Name must be string, but got %s"):format(type(name))) end - return Linker(self,name) + -- return Linker(self,name) + local register = self.__props(name) + register:Link(self) + return register end -- indexer (getter) diff --git a/src/store.lua b/src/store.lua index bf7101c..be9d58f 100644 --- a/src/store.lua +++ b/src/store.lua @@ -283,6 +283,9 @@ function module.init(shared) -- return s return setmetatable({avalue = avalue},{__index = s}) end; + Link = function(s,lvalue) + return setmetatable({avalue = lvalue},{__index = s}) + end; -- return init data CalcWithDefault = function (s,withItem) local with = s.wfunc