Fix bug
This commit is contained in:
@@ -363,7 +363,9 @@ public partial class QBEGenerator
|
||||
|
||||
builder.Append(name);
|
||||
|
||||
builder.Append($"({string.Join(", ", parameters.Select(x => FuncQBETypeName(x.Type) + $" %{x.Name}"))})");
|
||||
var parameterStrings = parameters.Select(x => FuncQBETypeName(x.Type) + $" %{x.Name}");
|
||||
|
||||
builder.Append($"({string.Join(", ", parameterStrings)})");
|
||||
|
||||
_writer.StartFunction(builder.ToString());
|
||||
|
||||
@@ -374,6 +376,8 @@ public partial class QBEGenerator
|
||||
scope.Declare(parameter.Name, new Val("%" + parameter.Name, parameter.Type, ValKind.Direct));
|
||||
}
|
||||
|
||||
EmitBlock(body, scope);
|
||||
|
||||
if (body.Statements.LastOrDefault() is not BoundReturn)
|
||||
{
|
||||
if (returnType is NubVoidType)
|
||||
@@ -447,9 +451,12 @@ public partial class QBEGenerator
|
||||
{
|
||||
_scopes.Push(scope ?? Scope.SubScope());
|
||||
|
||||
foreach (var statement in block.Statements.Where(_ => _codeIsReachable))
|
||||
foreach (var statement in block.Statements)
|
||||
{
|
||||
EmitStatement(statement);
|
||||
if (_codeIsReachable)
|
||||
{
|
||||
EmitStatement(statement);
|
||||
}
|
||||
}
|
||||
|
||||
_scopes.Pop();
|
||||
|
||||
Reference in New Issue
Block a user