Successfully split 1457-line expressions.rs into 7 focused modules: - operators.rs (334 lines) - Binary/unary operations - method_dispatch.rs (456 lines) - Method call dispatch - field_access.rs (126 lines) - Field access handling - delegation.rs (325 lines) - from calls and delegation - async_ops.rs (16 lines) - await expressions - utils.rs (34 lines) - Utility functions - expressions.rs (179 lines) - Main dispatcher ✅ All functionality preserved - tested with using nyashstd 🎯 Code organization dramatically improved with single responsibility principle 🚀 Maintenance and development efficiency significantly enhanced 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
25 lines
862 B
Rust
25 lines
862 B
Rust
/*!
|
|
* Async Operations Module
|
|
*
|
|
* Extracted from expressions.rs lines 1020-1031 (~11 lines)
|
|
* Handles await expression processing for asynchronous operations
|
|
* Core philosophy: "Everything is Box" with async support
|
|
*/
|
|
|
|
use super::*;
|
|
|
|
impl NyashInterpreter {
|
|
/// await式を実行 - 非同期操作の結果を待機
|
|
pub(super) fn execute_await(&mut self, expression: &ASTNode) -> Result<Box<dyn NyashBox>, RuntimeError> {
|
|
let value = self.execute_expression(expression)?;
|
|
|
|
// FutureBoxなら待機して結果を取得
|
|
if let Some(future) = value.as_any().downcast_ref::<FutureBox>() {
|
|
future.wait_and_get()
|
|
.map_err(|msg| RuntimeError::InvalidOperation { message: msg })
|
|
} else {
|
|
// FutureBoxでなければそのまま返す
|
|
Ok(value)
|
|
}
|
|
}
|
|
} |