fix(selfhost): StringBox.get() エラー修正でセルフホスト復活!
StageBDriverBox.compile() と main() 内の2箇所に防御チェック追加: - methods.get(mi) が null の場合スキップ - methods.get(mi) が StringBox の場合スキップ (MapBox のみ処理) これにより "Unknown method 'get' on StringBox" エラーが解消され、 .hako セルフホストコンパイラが再び動作するようになった。 テスト確認: NYASH_USE_NY_COMPILER=1 ./target/release/hakorune test.hako → "Hello from selfhost!" RC: 0 ✅ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -1183,6 +1183,19 @@ static box StageBDriverBox {
|
||||
local mn = methods.length()
|
||||
loop(mi < mn) {
|
||||
local def = methods.get(mi)
|
||||
|
||||
// Defensive check: skip if def is null or StringBox
|
||||
if def == null {
|
||||
mi = mi + 1
|
||||
continue
|
||||
}
|
||||
// Check if def is a StringBox by converting to string and comparing
|
||||
local def_str = "" + def
|
||||
if def_str == def {
|
||||
mi = mi + 1
|
||||
continue
|
||||
}
|
||||
|
||||
local mname = "" + def.get("name")
|
||||
local mparams = def.get("params")
|
||||
local mbody = "" + def.get("body_json")
|
||||
@ -1397,6 +1410,19 @@ static box StageBDriverBox {
|
||||
local mn = methods.length()
|
||||
loop(mi < mn) {
|
||||
local def = methods.get(mi)
|
||||
|
||||
// Defensive check: skip if def is null or StringBox
|
||||
if def == null {
|
||||
mi = mi + 1
|
||||
continue
|
||||
}
|
||||
// Check if def is a StringBox by converting to string and comparing
|
||||
local def_str = "" + def
|
||||
if def_str == def {
|
||||
mi = mi + 1
|
||||
continue
|
||||
}
|
||||
|
||||
local mname = "" + def.get("name")
|
||||
local mparams = def.get("params")
|
||||
local mbody = "" + def.get("body_json")
|
||||
|
||||
Reference in New Issue
Block a user