feat(selfhost): add &T (shared ref) and &mut T (mutable ref) type syntax

- Add tekRef and tekMutRef to TypeExpr enum (ast.bux)
- Parse &T and &mut T in parserParseType, before *T handling (parser.bux)
- Map tekRef/tekMutRef to tyPointer in HIR lowering (hir_lower.bux)
- Both emit as T* in C backend (same as raw pointer)
- Borrow checker rejects write-through-pointer in @[Checked] functions
  for all pointer types (safe default)
This commit is contained in:
2026-06-09 17:30:19 +03:00
parent 81281cbb11
commit f809827bea
3 changed files with 30 additions and 1 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ func Lcx_ResolveTypeKindFromName(name: String) -> int {
func Lcx_ResolveTypeKind(te: *TypeExpr) -> int {
if te == null as *TypeExpr { return tyUnknown; }
if te.kind == tekPointer { return tyPointer; }
if te.kind == tekPointer || te.kind == tekRef || te.kind == tekMutRef { return tyPointer; }
if te.kind == tekSlice { return tySlice; }
if te.kind == tekTuple { return tyTuple; }
if te.kind == tekFunc { return tyFunc; }