feat(parser): Phase 285A1.4 & A1.5 - Weak field sugar + Parser hang fix

A1.4: Add sugar syntax `public weak parent` ≡ `public { weak parent }`
A1.5: Fix parser hang on unsupported `param: Type` syntax

Key changes:
- A1.4: Extend visibility parser to handle weak modifier (fields.rs)
- A1.5: Shared helper `parse_param_name_list()` with progress-zero detection
- A1.5: Fix 6 vulnerable parameter parsing loops (methods, constructors, functions)
- Tests: Sugar syntax (OK/NG), parser hang (timeout-based)
- Docs: lifecycle.md, EBNF.md, phase-285a1-boxification.md

Additional changes:
- weak() builtin implementation (handlers/weak.rs)
- Leak tracking improvements (leak_tracker.rs)
- Documentation updates (lifecycle, types, memory-finalization, etc.)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-24 07:44:50 +09:00
parent a47f850d02
commit ab76e39036
60 changed files with 2099 additions and 454 deletions

View File

@ -238,6 +238,18 @@ box Node {
}
```
**Legacy syntax** (still supported, Phase 285A1.2):
- `init { weak parent }` — old syntax; superseded by direct `weak parent` declaration
- Both syntaxes behave identically and populate the same weak_fields set
- New code should use `weak field_name` directly for clarity
**Visibility blocks** (Phase 285A1.3):
- `weak` is allowed inside visibility blocks: `public { weak parent }`
**Sugar syntax** (Phase 285A1.4):
- `public weak parent` is equivalent to `public { weak parent }`
- `private weak parent` is equivalent to `private { weak parent }`
## 5) Cycles and GC (language-level policy)
### Cycles