Commit f1374374

f13743747916Merged

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

Description

Add Kernel Integer() / Float() conversions

Integer(s) -> sp_str_to_i_strict; Float(s) -> atof. (rand omitted: its sequence can't match CRuby's.)

make test: 34.

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

Details

Commit
f13743747916
Parent
0a5696d5fa62

src/analyze.cmodifiedView file

@@ -107,6 +107,9 @@
107107 if (recv < 0) {
108108 int mi = comp_method_index(c, name);
109109 if (mi >= 0) return c->scopes[mi].ret;
110+ /* Kernel conversions */
111+ if (!strcmp(name, "Integer") && argc == 1) return TY_INT;
112+ if (!strcmp(name, "Float") && argc == 1) return TY_FLOAT;
110113 }
111114
112115 /* array receiver methods */