Fix bad value boxings
This commit is contained in:
parent
bc3024881f
commit
4008133a0b
@ -107,7 +107,7 @@ KRK_Method(object,__hash__) {
|
||||
}
|
||||
KrkObj * obj = AS_OBJECT(self);
|
||||
if (!(obj->flags & KRK_OBJ_FLAGS_VALID_HASH)) {
|
||||
obj->hash = INTEGER_VAL((int)((intptr_t)self >> 3));
|
||||
obj->hash = (uint32_t)((intptr_t)(obj) >> 3);
|
||||
obj->flags |= KRK_OBJ_FLAGS_VALID_HASH;
|
||||
}
|
||||
return INTEGER_VAL(obj->hash);
|
||||
@ -115,7 +115,7 @@ KRK_Method(object,__hash__) {
|
||||
|
||||
KRK_Method(object,__eq__) {
|
||||
METHOD_TAKES_EXACTLY(1);
|
||||
if (argv[0] == argv[1]) return BOOLEAN_VAL(1);
|
||||
if (krk_valuesSame(argv[0],argv[1])) return BOOLEAN_VAL(1);
|
||||
return NOTIMPL_VAL();
|
||||
}
|
||||
|
||||
|
@ -383,7 +383,7 @@ KRK_Method(method,__func__) {
|
||||
|
||||
KRK_Method(method,__self__) {
|
||||
ATTRIBUTE_NOT_ASSIGNABLE();
|
||||
return OBJECT_VAL(self->receiver);
|
||||
return self->receiver;
|
||||
}
|
||||
|
||||
KRK_Function(staticmethod) {
|
||||
|
@ -306,7 +306,7 @@ KRK_Method(list,__delitem__) {
|
||||
METHOD_TAKES_EXACTLY(1);
|
||||
|
||||
if (IS_INTEGER(argv[1])) {
|
||||
FUNC_NAME(list,pop)(2,(KrkValue[]){argv[0],INTEGER_VAL(argv[1])},0);
|
||||
FUNC_NAME(list,pop)(2,(KrkValue[]){argv[0],argv[1]},0);
|
||||
} else if (IS_slice(argv[1])) {
|
||||
KRK_SLICER(argv[1],self->values.count) {
|
||||
return NONE_VAL();
|
||||
|
@ -54,7 +54,7 @@ inline int krk_hashValue(KrkValue value, uint32_t *hashOut) {
|
||||
return 0;
|
||||
}
|
||||
if (IS_CLASS(value)) {
|
||||
*hashOut = INTEGER_VAL((int)(intptr_t)AS_OBJECT(value));
|
||||
*hashOut = (uint32_t)((int)(intptr_t)AS_OBJECT(value));
|
||||
return 0;
|
||||
}
|
||||
_unhashable:
|
||||
|
4
src/vm.c
4
src/vm.c
@ -259,7 +259,7 @@ void krk_finalizeClass(KrkClass * _class) {
|
||||
_class->_hash = NULL;
|
||||
KrkValue v;
|
||||
if (!krk_tableGet_fast(&_class->methods, AS_STRING(vm.specialMethodNames[METHOD_HASH]), &v)) {
|
||||
krk_tableSet(&_class->methods, OBJECT_VAL(vm.specialMethodNames[METHOD_HASH]), NONE_VAL());
|
||||
krk_tableSet(&_class->methods, vm.specialMethodNames[METHOD_HASH], NONE_VAL());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1516,7 +1516,7 @@ int krk_importModule(KrkString * name, KrkString * runAs) {
|
||||
pushStringBuilderStr(&sb, &name->chars[dots], name->length - dots);
|
||||
}
|
||||
|
||||
krk_push(OBJECT_VAL(finishStringBuilder(&sb)));
|
||||
krk_push(finishStringBuilder(&sb));
|
||||
|
||||
/* Now to try to import the fully qualified module path */
|
||||
if (krk_importModule(AS_STRING(krk_peek(0)), AS_STRING(krk_peek(0)))) {
|
||||
|
Loading…
Reference in New Issue
Block a user