....
This commit is contained in:
@@ -198,7 +198,7 @@ public class ModuleGraph
|
||||
|
||||
foreach (var structDef in ast.Definitions.OfType<NodeDefinitionStruct>())
|
||||
{
|
||||
var type = new NubTypeStruct(module.Name, structDef.Name.Ident, structDef.Packed);
|
||||
var type = NubTypeStruct.CreateWithoutFields(structDef.Packed);
|
||||
var info = new Module.CustomTypeInfo(type, structDef.Exported, Module.Source.Ast);
|
||||
module.AddCustomType(structDef.Name.Ident, info);
|
||||
}
|
||||
@@ -214,8 +214,11 @@ public class ModuleGraph
|
||||
if (!module.TryResolveCustomType(structDef.Name.Ident, true, out var customType))
|
||||
throw new UnreachableException($"{nameof(customType)} should always be registered");
|
||||
|
||||
var fields = structDef.Fields.Select(f => new NubTypeStruct.Field(f.Name.Ident, ResolveType(f.Type, module.Name))).ToList();
|
||||
((NubTypeStruct)customType).ResolveFields(fields);
|
||||
if (customType is NubTypeStruct structType)
|
||||
{
|
||||
var fields = structDef.Fields.Select(f => new NubTypeStruct.Field(f.Name.Ident, ResolveType(f.Type, module.Name))).ToList();
|
||||
structType.SetFields(fields);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user