Fix Any.toString().
This commit is contained in:
@@ -22,11 +22,6 @@ KInt Kotlin_Any_hashCode(KConstRef thiz) {
|
|||||||
return reinterpret_cast<uintptr_t>(thiz);
|
return reinterpret_cast<uintptr_t>(thiz);
|
||||||
}
|
}
|
||||||
|
|
||||||
OBJ_GETTER(Kotlin_Any_toString, KConstRef thiz) {
|
|
||||||
// TODO: make it more sensible, such as address and type info.
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// io/Console.kt
|
// io/Console.kt
|
||||||
void Kotlin_io_Console_print(KString message) {
|
void Kotlin_io_Console_print(KString message) {
|
||||||
RuntimeAssert(message->type_info() == theStringTypeInfo, "Must use a string");
|
RuntimeAssert(message->type_info() == theStringTypeInfo, "Must use a string");
|
||||||
|
|||||||
@@ -24,6 +24,14 @@ OBJ_GETTER(makeString, const char* cstring) {
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
|
OBJ_GETTER(Kotlin_Any_toString, KConstRef thiz) {
|
||||||
|
char cstring[80];
|
||||||
|
snprintf(cstring, sizeof(cstring), "%s %p type %p",
|
||||||
|
IsArray(thiz) ? "array" : "object",
|
||||||
|
thiz, thiz->type_info_);
|
||||||
|
RETURN_RESULT_OF(makeString, cstring);
|
||||||
|
}
|
||||||
|
|
||||||
OBJ_GETTER(Kotlin_Byte_toString, KByte value) {
|
OBJ_GETTER(Kotlin_Byte_toString, KByte value) {
|
||||||
char cstring[8];
|
char cstring[8];
|
||||||
snprintf(cstring, sizeof(cstring), "%d", value);
|
snprintf(cstring, sizeof(cstring), "%d", value);
|
||||||
|
|||||||
Reference in New Issue
Block a user