feat(lang): 0.S - components take states in their header; migrate writes them, never inside a name, never outside the programs given, never into a package's state

- component Name (a: mut A, b: B) { ... }: every getter, default, function and event takes the
  header's states before the instance; a member's call to another passes them on; the glue is
  supplied them; the template never sees them; a read-only one is read-only in every member
- ludic migrate state: a component's members' needs go into its header (added to an existing one,
  mut added where now changed); a field read or a member call inside a component is the compiler's,
  so nothing is written inside a name and no ', )' is left; an entry point that declares states
  already gets the rest after them
- a program's module named like a package gets <Name>AppState; a program's own file its own state;
  a friend module's files go by directory; a package's settable var stays state
- it writes only under the programs and directories given (and runtime/ with --runtime), and
  refuses the whole run naming any other file that would have to change
- a name a package already moved into its state is rewritten through it; a read of the runtime's
  var through the runtime function that answers it (gl_w: gl_width())
- a state's instance supplied by the runtime is not a uses reference
- tests: state/component, rejected/state_component_ro, rendering/ui_render3d, migrate component
  and foreign cases

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-25 17:11:15 +03:00
parent c167ecc714
commit ce80e64b24
23 changed files with 67967 additions and 61444 deletions

View file

@ -45,7 +45,8 @@ function ck_let_from(e: Node, ty: pointer) -> void {
return
}
if li >= 0 { return }
let g = ck_global(r.s)
var g = ck_global(r.s)
if g == null { g = mg_field_var(r.s) }
if g != null and g.kind == N_VAR { ck_alias[k] = g }
}
function ck_is_ro(li: int) -> bool {
@ -90,7 +91,8 @@ function ck_write_check(t: Node, what: pointer) -> void {
}
return
}
let g = ck_global(r.s)
var g = ck_global(r.s)
if g == null { g = mg_field_var(r.s) }
mg_write(t, g)
if ck_module_let(g) {
var name = r.s