feat: 配列/Mapリテラル糖衣構文の実装とネームスペース解決の改善計画
- ArrayLiteral/MapLiteralのAST定義追加
- パーサーで[...]と{...}構文をサポート
- MIR Builderでnew Box() + push/setへのdesugaring実装
- テストケースとスモークスクリプト追加
- CURRENT_TASK.mdにネームスペース解決Phase-1計画を追記
- 3段階解決順序(ローカル→エイリアス→プラグイン)の設計合意
This commit is contained in:
@ -487,6 +487,17 @@ impl MirBuilder {
|
||||
self.build_new_expression(class.clone(), arguments.clone())
|
||||
},
|
||||
|
||||
ASTNode::ArrayLiteral { elements, .. } => {
|
||||
// Lower: new ArrayBox(); for each elem: .push(elem)
|
||||
let arr_id = self.value_gen.next();
|
||||
self.emit_instruction(MirInstruction::NewBox { dst: arr_id, box_type: "ArrayBox".to_string(), args: vec![] })?;
|
||||
for e in elements {
|
||||
let v = self.build_expression(e)?;
|
||||
self.emit_instruction(MirInstruction::BoxCall { dst: None, box_val: arr_id, method: "push".to_string(), method_id: None, args: vec![v], effects: super::EffectMask::MUT })?;
|
||||
}
|
||||
Ok(arr_id)
|
||||
},
|
||||
|
||||
// Phase 7: Async operations
|
||||
ASTNode::Nowait { variable, expression, .. } => {
|
||||
self.build_nowait_statement(variable.clone(), *expression.clone())
|
||||
|
||||
Reference in New Issue
Block a user