Exemplo n.º 1
0
static SLVAL
sl_class_to_s(sl_vm_t* vm, SLVAL self)
{
    sl_class_t* klass = get_class(vm, self);
    sl_class_t* object = (sl_class_t*)sl_get_ptr(vm->lib.Object);
    if(klass == object || sl_get_ptr(klass->extra->in) == (sl_object_t*)object) {
        return sl_id_to_string(vm, klass->extra->name);
    } else {
        return sl_make_formatted_string(vm, "%V::%I", sl_class_to_s(vm, klass->extra->in), klass->extra->name);
    }
}
Exemplo n.º 2
0
static SLVAL
sl_class_to_s(sl_vm_t* vm, SLVAL self)
{
    sl_class_t* klass = get_class(vm, self);
    sl_class_t* object = (sl_class_t*)sl_get_ptr(vm->lib.Object);
    if(klass == object || sl_get_ptr(klass->in) == (sl_object_t*)object) {
        return get_class(vm, self)->name;
    } else {
        return sl_string_concat(vm,
            sl_class_to_s(vm, klass->in),
            sl_string_concat(vm,
                sl_make_cstring(vm, "::"),
                klass->name));
    }
}