support len() for bytes

This commit is contained in:
pikastech 2022-06-10 10:55:48 +08:00
parent e8ffa73d2a
commit f0b5be9c92
2 changed files with 6 additions and 0 deletions

View File

@ -269,6 +269,9 @@ int PikaStdLib_SysObj_len(PikaObj* self, Arg* arg) {
if (ARG_TYPE_STRING == arg_getType(arg)) {
return strGetSize(arg_getStr(arg));
}
if (ARG_TYPE_BYTES == arg_getType(arg)) {
return arg_getBytesSize(arg);
}
obj_setErrorCode(self, 1);
__platform_printf("[Error] len: arg type not support\r\n");
return -1;

View File

@ -269,6 +269,9 @@ int PikaStdLib_SysObj_len(PikaObj* self, Arg* arg) {
if (ARG_TYPE_STRING == arg_getType(arg)) {
return strGetSize(arg_getStr(arg));
}
if (ARG_TYPE_BYTES == arg_getType(arg)) {
return arg_getBytesSize(arg);
}
obj_setErrorCode(self, 1);
__platform_printf("[Error] len: arg type not support\r\n");
return -1;