feat(phase285w): Implement weak x unary operator syntax
Phase 285W-Syntax-0: Migrate weak reference syntax from function call to unary operator for consistency and clarity. **Changes**: - Parser: Add UnaryOperator::Weak variant and parse_unary() handling - MIR: Lower UnaryOp::Weak to emit_weak_new() (reuses existing path) - AST: Add Weak to UnaryOperator enum + Display/JSON support - Tests: Migrate 8 files from `weak(x)` to `weak x` syntax - 7 .hako test files updated - 1 smoke test shell script updated - Cleanup: Remove obsolete weak(x) parser/MIR special cases - Docs: Update Phase 285 README **Syntax Change**: - Old: `local w = weak(x)` (function call) - New: `local w = weak x` (unary operator) **Validation**: All migrated phase285* smoke tests pass (4/4 relevant) **SSOT**: docs/reference/language/lifecycle.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -159,6 +159,7 @@ impl NormalizedExprLowererBox {
|
||||
}
|
||||
}
|
||||
UnaryOperator::BitNot => Some(OutOfScopeReason::UnsupportedOperator),
|
||||
UnaryOperator::Weak => Some(OutOfScopeReason::UnsupportedOperator), // Phase 285W-Syntax-0
|
||||
},
|
||||
|
||||
ASTNode::BinaryOp { operator, left, right, .. } => {
|
||||
@ -232,6 +233,7 @@ impl NormalizedExprLowererBox {
|
||||
}
|
||||
}
|
||||
UnaryOperator::BitNot => Some(OutOfScopeReason::UnsupportedOperator),
|
||||
UnaryOperator::Weak => Some(OutOfScopeReason::UnsupportedOperator), // Phase 285W-Syntax-0
|
||||
},
|
||||
|
||||
ASTNode::BinaryOp { operator, left, right, .. } => {
|
||||
@ -387,6 +389,7 @@ impl NormalizedExprLowererBox {
|
||||
Ok(Some(dst))
|
||||
}
|
||||
UnaryOperator::BitNot => Ok(None),
|
||||
UnaryOperator::Weak => Ok(None), // Phase 285W-Syntax-0: Not supported in normalized lowering
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user