Commit 6a66b358

6a66b35800e7Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 2 files · ~2 modified

Description

Add String#oct/ord/casecmp/casecmp?/byteslice/force_encoding

oct/ord -> int (ord raises ArgumentError on empty), casecmp -> int, casecmp? -> bool, byteslice(start[,len]) -> string, force_encoding/b/ encode -> identity (Spinel is single-encoding). scrub/unicode_normalize left unsupported (not identity-safe).

Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]

Details

Commit
6a66b35800e7
Parent
172dec9b00ef

src/analyze.cmodifiedView file

@@ -399,8 +399,11 @@
399399 !strcmp(name, "chop") || !strcmp(name, "chr") || !strcmp(name, "clamp") ||
400400 !strcmp(name, "squeeze") || !strcmp(name, "tr") || !strcmp(name, "tr_s") ||
401401 !strcmp(name, "delete")) return TY_STRING;
402- if (!strcmp(name, "[]") || !strcmp(name, "slice")) return TY_STRING;
403- if (!strcmp(name, "index") || !strcmp(name, "to_i") || !strcmp(name, "count")) return TY_INT;
402+ if (!strcmp(name, "[]") || !strcmp(name, "slice") || !strcmp(name, "byteslice") ||
403+ !strcmp(name, "force_encoding") || !strcmp(name, "b") || !strcmp(name, "encode")) return TY_STRING;
404+ if (!strcmp(name, "index") || !strcmp(name, "to_i") || !strcmp(name, "count") ||
405+ !strcmp(name, "oct") || !strcmp(name, "ord") || !strcmp(name, "casecmp")) return TY_INT;
406+ if (!strcmp(name, "casecmp?")) return TY_BOOL;
404407 if (!strcmp(name, "to_f")) return TY_FLOAT;
405408 if (!strcmp(name, "split") || !strcmp(name, "lines")) return TY_STR_ARRAY;
406409 if (!strcmp(name, "bytes")) return TY_INT_ARRAY;