builder/vm: stabilize json_lint_vm under unified calls
- Fix condition_fn resolution: Value call path + dev safety + stub injection - VM bridge: handle Method::birth via BoxCall; ArrayBox push/get/length/set direct bridge - Receiver safety: pin receiver in method_call_handlers to avoid undefined use across blocks - Local vars: materialize on declaration (use init ValueId; void for uninit) - Prefer legacy BoxCall for Array/Map/String/user boxes in emit_box_or_plugin_call (stability-first) - Test runner: update LLVM hint to llvmlite harness (remove LLVM_SYS_180_PREFIX guidance) - Docs/roadmap: update CURRENT_TASK with unified default-ON + guards Note: NYASH_DEV_BIRTH_INJECT_BUILTINS=1 can re-enable builtin birth() injection during migration.
This commit is contained in:
@ -62,18 +62,20 @@ fn reroute_to_correct_method(
|
||||
}
|
||||
|
||||
/// Try mapping special methods to canonical targets (table-driven).
|
||||
/// Example: toString/0 → stringify/0 (prefer instance class, then base class without "Instance" suffix).
|
||||
/// Example: toString/0 → str/0(互換: stringify/0)(prefer instance class, then base class without "Instance" suffix).
|
||||
fn try_special_reroute(
|
||||
interp: &mut MirInterpreter,
|
||||
recv_cls: &str,
|
||||
parsed: &ParsedSig<'_>,
|
||||
arg_vals: Option<&[VMValue]>,
|
||||
) -> Option<Result<VMValue, VMError>> {
|
||||
// toString → stringify
|
||||
// toString → str(互換: stringify)
|
||||
if parsed.method == "toString" && parsed.arity_str == "0" {
|
||||
// Prefer instance class stringify first, then base (strip trailing "Instance")
|
||||
// Prefer instance class 'str' first, then base(strip trailing "Instance")。なければ 'stringify' を互換で探す
|
||||
let base = recv_cls.strip_suffix("Instance").unwrap_or(recv_cls);
|
||||
let candidates = [
|
||||
format!("{}.str/0", recv_cls),
|
||||
format!("{}.str/0", base),
|
||||
format!("{}.stringify/0", recv_cls),
|
||||
format!("{}.stringify/0", base),
|
||||
];
|
||||
@ -91,7 +93,7 @@ fn try_special_reroute(
|
||||
"method": parsed.method,
|
||||
"arity": parsed.arity_str,
|
||||
"target": name,
|
||||
"reason": "toString->stringify",
|
||||
"reason": if name.ends_with(".str/0") { "toString->str" } else { "toString->stringify" },
|
||||
}),
|
||||
);
|
||||
return Some(interp.exec_function_inner(&f, arg_vals));
|
||||
|
||||
Reference in New Issue
Block a user