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.
This commit is contained in:
28
lang/src/compiler/pipeline_v2/alias_preflight_box.hako
Normal file
28
lang/src/compiler/pipeline_v2/alias_preflight_box.hako
Normal file
@ -0,0 +1,28 @@
|
||||
// alias_preflight_box.hako — AliasPreflightBox
|
||||
// Responsibility: Early check for using-alias heads in Stage‑1 names.
|
||||
// Input: raw dotted label (e.g., "alias.something.method"), UsingResolverBox instance.
|
||||
// Behavior: If dotted, verify alias head is known; otherwise print a stable one-line error and return 0.
|
||||
// Non‑Responsibility: Namespace normalization or emit.
|
||||
|
||||
using "lang/src/compiler/pipeline_v2/using_resolver_box.hako" as UsingResolverBox
|
||||
using "lang/src/compiler/pipeline_v2/regex_flow.hako" as RegexFlow
|
||||
|
||||
static box AliasPreflightBox {
|
||||
// Returns 1 if OK, 0 if alias head is unresolved (prints error).
|
||||
check_head(raw_label, r_state) {
|
||||
if raw_label == null { return 1 }
|
||||
if r_state == null { return 1 }
|
||||
local s = "" + raw_label
|
||||
local dot = RegexFlow.find_from(s, ".", 0)
|
||||
if dot < 0 { return 1 }
|
||||
local head = s.substring(0, dot)
|
||||
if head == null || head == "" { return 1 }
|
||||
if UsingResolverBox.resolve_namespace_alias(r_state, head) == null {
|
||||
print("[ERROR] Unresolved using alias: " + head)
|
||||
return 0
|
||||
}
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
static box AliasPreflightMain { main(args) { return 0 } }
|
||||
Reference in New Issue
Block a user