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