diff --git a/src/builtins.c b/src/builtins.c index 3948258..aa3c685 100644 --- a/src/builtins.c +++ b/src/builtins.c @@ -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(); } diff --git a/src/obj_function.c b/src/obj_function.c index 3928c7a..0b2f8ea 100644 --- a/src/obj_function.c +++ b/src/obj_function.c @@ -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) { diff --git a/src/obj_list.c b/src/obj_list.c index 9525f02..5fdedcd 100644 --- a/src/obj_list.c +++ b/src/obj_list.c @@ -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(); diff --git a/src/table.c b/src/table.c index c1fbc2b..a75aa63 100644 --- a/src/table.c +++ b/src/table.c @@ -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: diff --git a/src/vm.c b/src/vm.c index 21e6c9b..f161990 100644 --- a/src/vm.c +++ b/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)))) {