Files
hakorune/lang/src/compiler/pipeline_v2/name_resolve_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

30 lines
1.3 KiB
Plaintext

// name_resolve_box.hako — PipelineNameResolveBox
// Responsibility: normalize raw global call names with using-context
// - primary: NamespaceBox.normalize_global_name(raw, resolver)
// - fallback: unique tail match via UsingResolverBox.guess_namespace_from_tail
using "lang/src/compiler/pipeline_v2/using_resolver_box.hako" as UsingResolverBox
using "lang/src/compiler/pipeline_v2/namespace_box.hako" as NamespaceBox
using "lang/src/compiler/pipeline_v2/regex_flow.hako" as RegexFlow
static box PipelineNameResolveBox {
// Returns fully-qualified name or null
normalize_call_name(raw_name, r_state) {
if raw_name == null { return null }
// Try normalizer first
local fq = NamespaceBox.normalize_global_name(raw_name, r_state)
if fq != null { return fq }
// Try head.tail composition with modules-based guess (unique only)
local dot2 = RegexFlow.find_from(raw_name, ".", 0)
if dot2 < 0 { return null }
local head2 = raw_name.substring(0, dot2)
local tail2 = raw_name.substring(dot2 + 1, raw_name.size())
local ns2 = UsingResolverBox.resolve_namespace_alias(r_state, head2)
if ns2 == null { ns2 = UsingResolverBox.guess_namespace_from_tail(r_state, head2) }
if ns2 == null { return null }
return ns2 + "." + tail2
}
}
static box PipelineNameResolveMain { main(args) { return 0 } }