...
This commit is contained in:
@@ -372,12 +372,12 @@ public class QBEGenerator
|
||||
|
||||
foreach (var field in structDef.Fields)
|
||||
{
|
||||
if (field.Value.TryGetValue(out var value))
|
||||
if (field.Value != null)
|
||||
{
|
||||
var offset = OffsetOf(TypeOfStruct(structDef), field.Name);
|
||||
var destination = TmpName();
|
||||
_writer.Indented($"{destination} =l add %struct, {offset}");
|
||||
EmitCopyInto(value, destination);
|
||||
EmitCopyInto(field.Value, destination);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -566,9 +566,9 @@ public class QBEGenerator
|
||||
|
||||
private void EmitReturn(ReturnNode @return)
|
||||
{
|
||||
if (@return.Value.HasValue)
|
||||
if (@return.Value != null)
|
||||
{
|
||||
var result = EmitExpression(@return.Value.Value);
|
||||
var result = EmitExpression(@return.Value);
|
||||
EmitScopeCleanup();
|
||||
_writer.Indented($"ret {result}");
|
||||
}
|
||||
@@ -584,9 +584,9 @@ public class QBEGenerator
|
||||
var name = $"%{variableDeclaration.Name}";
|
||||
_writer.Indented($"{name} =l alloc8 {SizeOf(variableDeclaration.Type)}");
|
||||
|
||||
if (variableDeclaration.Assignment.HasValue)
|
||||
if (variableDeclaration.Assignment != null)
|
||||
{
|
||||
EmitCopyInto(variableDeclaration.Assignment.Value, name);
|
||||
EmitCopyInto(variableDeclaration.Assignment, name);
|
||||
}
|
||||
|
||||
Scope.Variables.Push(new Variable(variableDeclaration.Name, variableDeclaration.Type));
|
||||
@@ -1234,7 +1234,7 @@ public class QBEGenerator
|
||||
private NubStructType TypeOfStruct(StructNode definition)
|
||||
{
|
||||
var fieldTypes = definition.Fields
|
||||
.Select(x => new NubStructFieldType(x.Name, x.Type, x.Value.HasValue))
|
||||
.Select(x => new NubStructFieldType(x.Name, x.Type, x.Value != null))
|
||||
.ToList();
|
||||
|
||||
var functionTypes = new List<NubStructFuncType>();
|
||||
|
||||
Reference in New Issue
Block a user