Add variable debug declarations to all variables

This commit is contained in:
Sofia 2025-07-19 13:56:41 +03:00
parent 59ce454f91
commit f2c38d42b9

View File

@ -428,7 +428,7 @@ impl mir::Statement {
.unwrap() .unwrap()
.maybe_location(&mut scope.block, location); .maybe_location(&mut scope.block, location);
scope let store = scope
.block .block
.build(Instr::Store(alloca, value)) .build(Instr::Store(alloca, value))
.unwrap() .unwrap()
@ -447,7 +447,7 @@ impl mir::Statement {
StackValueKind::Immutable(_) => {} StackValueKind::Immutable(_) => {}
StackValueKind::Mutable(_) => { StackValueKind::Mutable(_) => {
let location = self.1.into_debug(scope.tokens).unwrap(); let location = self.1.into_debug(scope.tokens).unwrap();
debug.info.metadata( let var = debug.info.metadata(
&debug.scope, &debug.scope,
DebugMetadata::LocalVar(DebugLocalVariable { DebugMetadata::LocalVar(DebugLocalVariable {
name: name.clone(), name: name.clone(),
@ -458,16 +458,15 @@ impl mir::Statement {
flags: DwarfFlags, flags: DwarfFlags,
}), }),
); );
// dbg!(&store); store.add_record(
// store.add_record( &mut scope.block,
// &mut scope.block, InstructionDebugRecordData {
// InstructionDebugRecordData { variable: var,
// variable: var, location,
// location, kind: DebugRecordKind::Declare(value),
// kind: DebugRecordKind::Declare(value), scope: debug.scope,
// scope: debug.scope, },
// }, );
// );
} }
StackValueKind::Any(_) => {} StackValueKind::Any(_) => {}
} }