feat(phase285): Complete weak reference implementation (VM + LLVM harness)
Phase 285LLVM-1.1 to 1.4 + weak reference infrastructure: **LLVM Harness** (Phase 285LLVM-1.x): - 285LLVM-1.1: User Box registration & debug output - 285LLVM-1.2: WeakRef basic operations (identity deferred) - 285LLVM-1.3: InstanceBox field access (getField/setField) - 285LLVM-1.4: print Handle resolution (type tag propagation) **VM Runtime** (nyash_kernel): - FFI functions: nyrt_weak_new, nyrt_weak_to_strong, nyrt_weak_drop (crates/nyash_kernel/src/lib.rs: +209 lines) - WeakRef plugin invoke support (crates/nyash_kernel/src/plugin/invoke.rs: +250 lines) - weak_handles.rs: WeakRef handle registry (NEW) **LLVM Python Backend**: - WeakRef instruction lowering (weak.py: NEW) - Entry point integration (entry.py: +93 lines) - Instruction lowering (instruction_lower.py: +13 lines) - LLVM harness runner script (tools/run_llvm_harness.sh: NEW) **MIR & Runtime**: - WeakRef emission & validation - MIR JSON export for weak instructions - Environment variable support (NYASH_WEAK_*, HAKO_WEAK_*) **Documentation**: - CLAUDE.md: Phase 285 completion notes - LANGUAGE_REFERENCE_2025.md: Weak reference syntax - 10-Now.md & 30-Backlog.md: Phase 285 status updates Total: +864 lines, 24 files changed SSOT: docs/reference/language/lifecycle.md Related: Phase 285W-Syntax-0, Phase 285W-Syntax-0.1
This commit is contained in:
@ -49,7 +49,7 @@ Rust製インタープリターによる高性能実行と、直感的な構文
|
||||
| `pack` | 旧コンストラクタ(互換性) | `pack(param) { }` |
|
||||
| `outbox` | 所有権移転変数 | `outbox result = compute()` |
|
||||
| `global` | グローバル変数 | `global CONFIG = "dev"` |
|
||||
| `weak` | 弱参照(生成) | `weak(x)` |
|
||||
| `weak` | 弱参照(強→弱の変換) | `weak x` |
|
||||
| `using` | 名前空間インポート | `using namespace` |
|
||||
|
||||
### **演算子・論理**
|
||||
@ -83,14 +83,15 @@ box ClassName {
|
||||
me.field3 = defaultValue()
|
||||
}
|
||||
|
||||
# メソッド
|
||||
methodName(arg1, arg2) {
|
||||
return me.field1 + arg1
|
||||
}
|
||||
|
||||
# デストラクタ(fini)
|
||||
fini() {
|
||||
print("Cleanup: " + me.field1)
|
||||
# メソッド
|
||||
methodName(arg1, arg2) {
|
||||
return me.field1 + arg1
|
||||
}
|
||||
# 注: 引数の型注釈 `arg: Type` は未対応(Phase 285A1.5: 明示エラー。ハングしない)
|
||||
|
||||
# デストラクタ(fini)
|
||||
fini() {
|
||||
print("Cleanup: " + me.field1)
|
||||
}
|
||||
}
|
||||
```
|
||||
@ -798,6 +799,7 @@ static box Main {
|
||||
x = 42 # 変数未宣言 → ランタイムエラー
|
||||
while condition { } # 非対応構文 → パーサーエラー
|
||||
this.field # thisは使用不可 → me.fieldを使用
|
||||
methodName(arg: Type) { } # 未対応(Phase 285A1.5)。引数は名前だけ:`methodName(arg) { }`
|
||||
|
||||
# ✅ 正しい書き方(Phase 12.7後)
|
||||
field1: TypeBox # フィールド宣言(型は省略可)
|
||||
|
||||
Reference in New Issue
Block a user