P0-1: Map bad-key tags for get/set/delete + smokes; String substring clamp smoke; P0-2: Bridge no‑op(Method) + Gate‑C invalid header smokes; P1: v1 bridge Closure captures appended to argv

This commit is contained in:
nyash-codex
2025-11-02 13:29:27 +09:00
parent ff62eb0d97
commit 110b4f3321
14 changed files with 275 additions and 59 deletions

View File

@ -0,0 +1,18 @@
// CommonImportsBox - Unified import utilities for string operations
// Consolidates frequently used StringHelpers and StringOps imports
using "lang/src/shared/common/string_helpers.hako" as StringHelpers
using selfhost.shared.common.string_ops as StringOps
static box CommonImportsBox {
// Provides access to common string utilities
// Boxes can import this instead of individual modules
static helpers() { return StringHelpers }
static ops() { return StringOps }
// Commonly used string operations
static read_digits(text, pos) { return StringHelpers.read_digits(text, pos) }
static to_i64(digits) { return StringHelpers.to_i64(digits) }
static index_of_from(text, pattern, start) { return StringOps.index_of_from(text, pattern, start) }
static substring(text, start, end) { return StringOps.substring(text, start, end) }
}

View File

@ -0,0 +1,18 @@
// EntryPointBaseBox - Common entry point for standalone boxes
// Eliminates repetitive main(args){ return 0 } boilerplate
static box EntryPointBaseBox {
// Standard entry point implementation
// Can be overridden by specific boxes if needed
static main(args) {
return 0
}
// Entry point with validation
static safe_main(args) {
if args == null {
return 1
}
return EntryPointBaseBox.main(args)
}
}

View File

@ -16,7 +16,7 @@ using "lang/src/vm/hakorune-vm/blocks_locator.hako" as BlocksLocatorBox
using "lang/src/vm/hakorune-vm/instrs_locator.hako" as InstrsLocatorBox
using "lang/src/vm/hakorune-vm/backward_object_scanner.hako" as BackwardObjectScannerBox
using "lang/src/vm/hakorune-vm/block_iterator.hako" as BlockIteratorBox
using selfhost.shared.common.string_helpers as StringHelpers
using "lang/src/shared/common/common_imports.hako" as CommonImports
using selfhost.shared.common.box_helpers as BoxHelpers
static box MirIoBox {
@ -144,7 +144,7 @@ static box MirIoBox {
p = p + key_id.length()
// skip ws
loop(p < obj.length()) { local ch = obj.substring(p,p+1) if ch == " " || ch == "\n" || ch == "\r" || ch == "\t" { p = p + 1 continue } break }
local digs = StringHelpers.read_digits(obj, p)
local digs = CommonImports.read_digits(obj, p)
if digs == "" { return Result.Err("invalid block id") }
ids.set(StringHelpers.int_to_str(StringHelpers.to_i64(digs)), 1)
// require terminator