mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Add missing calls for Object; Add scoped_autoreleasepool
This commit is contained in:
@@ -13,3 +13,8 @@ AutoreleasePool_showPools :: proc(self: ^AutoreleasePool, obj: ^Object) {
|
|||||||
msgSend(nil, self, "showPools")
|
msgSend(nil, self, "showPools")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@(deferred_out=AutoreleasePool_drain)
|
||||||
|
scoped_autoreleasepool :: proc() -> ^AutoreleasePool {
|
||||||
|
return init(alloc(AutoreleasePool))
|
||||||
|
}
|
||||||
@@ -33,14 +33,19 @@ retain :: proc(self: ^$T) -> ^T where intrinsics.type_is_subtype_of(T, Object) {
|
|||||||
release :: proc(self: ^$T) where intrinsics.type_is_subtype_of(T, Object) {
|
release :: proc(self: ^$T) where intrinsics.type_is_subtype_of(T, Object) {
|
||||||
msgSend(nil, self, "release")
|
msgSend(nil, self, "release")
|
||||||
}
|
}
|
||||||
|
autorelease :: proc(self: ^$T) where intrinsics.type_is_subtype_of(T, Object) {
|
||||||
|
msgSend(nil, self, "autorelease")
|
||||||
|
}
|
||||||
retainCount :: proc(self: ^$T) -> UInteger where intrinsics.type_is_subtype_of(T, Object) {
|
retainCount :: proc(self: ^$T) -> UInteger where intrinsics.type_is_subtype_of(T, Object) {
|
||||||
return msgSend(UInteger, self, "retainCount")
|
return msgSend(UInteger, self, "retainCount")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
copy :: proc(self: ^Copying($T)) -> ^T where intrinsics.type_is_subtype_of(T, Object) {
|
copy :: proc(self: ^Copying($T)) -> ^T where intrinsics.type_is_subtype_of(T, Object) {
|
||||||
return msgSend(^T, self, "copy")
|
return msgSend(^T, self, "copy")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
hash :: proc(self: ^Object) -> UInteger {
|
hash :: proc(self: ^Object) -> UInteger {
|
||||||
return msgSend(UInteger, self, "hash")
|
return msgSend(UInteger, self, "hash")
|
||||||
}
|
}
|
||||||
@@ -60,6 +65,10 @@ debugDescription :: proc(self: ^Object) -> ^String {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bridgingCast :: proc($T: typeid, obj: ^Object) where intrinsics.type_is_pointer(T), intrinsics.type_is_subtype_of(T, ^Object) {
|
||||||
|
return (T)(obj)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@(objc_class="NSCoder")
|
@(objc_class="NSCoder")
|
||||||
Coder :: struct {using _: Object}
|
Coder :: struct {using _: Object}
|
||||||
|
|||||||
Reference in New Issue
Block a user