This commit is contained in:
nub31
2025-07-07 18:56:47 +02:00
parent aa8bf71c23
commit 5672d181fe
15 changed files with 155 additions and 150 deletions

View File

@@ -47,31 +47,6 @@ public partial class QBEGenerator
EmitCopyIntoOrInitialize(assignment.Value, destination.Name);
}
private void EmitBlock(BoundBlock block, List<Variable>? variables = null)
{
_variableScopes.Push(_variables.Count);
if (variables != null)
{
foreach (var variable in variables)
{
_variables.Push(variable);
}
}
foreach (var statement in block.Statements.Where(_ => _codeIsReachable))
{
EmitStatement(statement);
}
var count = _variableScopes.Pop();
while (_variableScopes.Count > count)
{
_variableScopes.Pop();
}
_codeIsReachable = true;
}
private void EmitBreak()
{
_writer.Indented($"jmp {_breakLabels.Peek()}");
@@ -132,7 +107,7 @@ public partial class QBEGenerator
EmitStore(variableDeclaration.Assignment.Value.Type, value, name);
}
_variables.Push(new Variable(variableDeclaration.Name, new Val(name, variableDeclaration.Type, ValKind.Pointer)));
Scope.Declare(variableDeclaration.Name, new Val(name, variableDeclaration.Type, ValKind.Pointer));
}
private void EmitWhile(BoundWhile whileStatement)