fun instance=(value: Instance) `{ self->value_Pointer = value; `}
# The `NativeString` held by this cell
- fun native_string: NativeString `{ return (unsigned char*)self->value_Pointer; `}
+ fun native_string: NativeString `{ return (char*)self->value_Pointer; `}
# Set the content of this cell according to `static_type`
#
assert value isa PrimitiveInstance[Float]
self.float = value.val
else if static_type.name == "NativeString" then
- assert value isa PrimitiveInstance[Buffer]
- self.pointer = value.val.to_cstring
+ assert value isa PrimitiveInstance[NativeString]
+ self.pointer = value.val
else if static_type isa MClassType and static_type.mclass.kind == extern_kind then
assert value isa PrimitiveInstance[Pointer] else print value.class_name
self.pointer = value.val
else if name == "Float" then
return v.float_instance(self.float)
else if name == "NativeString" then
- return v.native_string_instance(self.native_string.to_s)
+ var instance = new PrimitiveInstance[NativeString](static_type, self.native_string)
+ v.init_instance_primitive instance
+ return instance
else if static_type isa MClassType and static_type.mclass.kind == extern_kind then
# We tag it with the most precise known type
- return new PrimitiveInstance[Pointer](static_type, self.pointer)
+ var instance = new PrimitiveInstance[Pointer](static_type, self.pointer)
+ v.init_instance_primitive instance
+ return instance
else
return self.instance
end