Files
hakorune/lang/src/compiler/pipeline_v2/map_helpers_box.hako
nyash-codex 5e3d9e7ae4 restore(lang/compiler): bring back lang/src/compiler from e917d400; add Hako index canaries and docs; implement Rust-side index operator (Array/Map get/set) with Fail‑Fast diagnostics
- restore: lang/src/compiler/** (parser/emit/builder/pipeline_v2) from e917d400
- docs: docs/development/selfhosting/index-operator-hako.md
- smokes(hako): tools/smokes/v2/profiles/quick/core/index_operator_hako.sh (opt-in)
- smokes(vm): adjust index_operator_vm.sh for semicolon gate + stable error text
- rust/parser: allow IndexExpr and assignment LHS=Index; postfix parse LBRACK chain
- rust/builder: lower arr/map index to BoxCall get/set; annotate array/map literals; Fail‑Fast for unsupported types
- CURRENT_TASK: mark Rust side done; add Hako tasks checklist

Note: files disappeared likely due to branch FF to a lineage without lang/src/compiler; no explicit delete commit found. Added anchor checks and suggested CI guard in follow-up.
2025-10-31 20:18:39 +09:00

44 lines
1.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// map_helpers_box.hako — Pipeline用の軽量ヘルパMapBoxの型付き取得
using "lang/src/shared/common/string_helpers.hako" as StringHelpers
using "lang/src/shared/common/box_helpers.hako" as BoxHelpers
static box MapHelpersBox {
_raw_get(m, key) {
return BoxHelpers.map_get(m, key)
}
_to_i64(v) { return StringHelpers.to_i64(v) }
get_str(m, key) {
local v = me._raw_get(m, key)
if v == null { return "" }
if BoxHelpers.is_map(v) == 1 {
local inner = BoxHelpers.map_get(v, "value")
if inner != null { return "" + inner }
}
return "" + v
}
get_i64(m, key) {
local v = me._raw_get(m, key)
return BoxHelpers.value_i64(v)
}
expect_str(m, key) { return me.get_str(m, key) }
expect_i64(m, key) { return me.get_i64(m, key) }
opt_str(m, key, def) {
local s = me.get_str(m, key)
if s == null || s == "" { return def }
return s
}
opt_i64(m, key, def) {
local n = me.get_i64(m, key)
if n == null { return def }
return n
}
}
static box MapHelpersStub { main(args) { return 0 } }