Phase 25.1b: Step2完了(FuncBodyBasicLowerBox導入)
Step2実装内容: - FuncBodyBasicLowerBox導入(defs専用下請けモジュール) - _try_lower_local_if_return実装(Local+単純if) - _inline_local_ints実装(軽い正規化) - minimal lowers統合(Return/BinOp/IfCompare/MethodArray系) Fail-Fast体制確立: - MirBuilderBox: defs_onlyでも必ずタグ出力 - [builder/selfhost-first:unsupported:defs_only] - [builder/selfhost-first:unsupported:no_match] Phase構造整備: - Phase 25.1b README新設(Step0-3計画) - Phase 25.2b README新設(次期計画) - UsingResolverBox追加(using system対応準備) スモークテスト: - stage1_launcher_program_to_mir_canary_vm.sh追加 Next: Step3 LoopForm対応 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -65,6 +65,21 @@ impl<'a> VarScope for MapVars<'a> {
|
||||
self.vars.insert(name.to_string(), dst);
|
||||
return Ok(Some(dst));
|
||||
}
|
||||
// Phase 25.1a: Treat `hostbridge` as a well-known global for bridge lowering.
|
||||
// The actual extern dispatch is handled at runtime; here we only need a stable
|
||||
// placeholder value so that Program(JSON) containing hostbridge.extern_invoke(...)
|
||||
// can be lowered without "undefined variable" errors.
|
||||
if name == "hostbridge" {
|
||||
let dst = f.next_value_id();
|
||||
if let Some(bb) = f.get_block_mut(cur_bb) {
|
||||
bb.add_instruction(MirInstruction::Const {
|
||||
dst,
|
||||
value: ConstValue::String("hostbridge".into()),
|
||||
});
|
||||
}
|
||||
self.vars.insert(name.to_string(), dst);
|
||||
return Ok(Some(dst));
|
||||
}
|
||||
if name == "me" {
|
||||
if env.allow_me_dummy {
|
||||
let dst = f.next_value_id();
|
||||
@ -163,6 +178,16 @@ pub(super) fn lower_expr_with_scope<S: VarScope>(
|
||||
}
|
||||
Ok((dst, cur_bb))
|
||||
}
|
||||
ExprV0::Null => {
|
||||
let dst = f.next_value_id();
|
||||
if let Some(bb) = f.get_block_mut(cur_bb) {
|
||||
bb.add_instruction(MirInstruction::Const {
|
||||
dst,
|
||||
value: ConstValue::Null,
|
||||
});
|
||||
}
|
||||
Ok((dst, cur_bb))
|
||||
}
|
||||
ExprV0::Binary { op, lhs, rhs } => {
|
||||
let (l, cur_after_l) = lower_expr_with_scope(env, f, cur_bb, lhs, vars)?;
|
||||
let (r, cur_after_r) = lower_expr_with_scope(env, f, cur_after_l, rhs, vars)?;
|
||||
|
||||
Reference in New Issue
Block a user