Skip to content

Commit

Permalink
Definition層
Browse files Browse the repository at this point in the history
  • Loading branch information
KurisuJuha committed Nov 28, 2024
1 parent fea200c commit 7976661
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion mooresmaster.Generator/Definitions/Definition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ public record InterfaceDefinition(string FileName, TypeName TypeName, Dictionary
public TypeName TypeName = TypeName;
}

public record TypeDefinition(string FileName, TypeName TypeName, TypeName[] InheritList, Dictionary<string, PropertyDefinition> PropertyTable)
public record TypeDefinition(string FileName, TypeName TypeName, TypeName[] InheritList, Dictionary<string, PropertyDefinition> PropertyTable, List<TypeName> ImplementationList)
{
public string FileName = FileName;
public List<TypeName> ImplementationList = ImplementationList;

public TypeName[] InheritList = InheritList;
public Dictionary<string, PropertyDefinition> PropertyTable = PropertyTable;
Expand Down
11 changes: 10 additions & 1 deletion mooresmaster.Generator/Definitions/DefinitionGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,16 @@ public static Definition Generate(Semantics semantics, NameTable nameTable, Sche
fileName = $"mooresmaster.{firstInterface.Name}.g.cs";
}

definition.TypeDefinitions.Add(new TypeDefinition(fileName, typeName, inheritList, propertyTable));
// implementation
var implementations = new List<TypeName>();
if (semantics.ClassInterfaceImplementationTable.TryGetValue(kvp.Key, out var interfaceIds))
foreach (var interfaceId in interfaceIds)
{
var interfaceName = nameTable.TypeNames[interfaceId];
implementations.Add(interfaceName);
}

definition.TypeDefinitions.Add(new TypeDefinition(fileName, typeName, inheritList, propertyTable, implementations));
}

return definition;
Expand Down

0 comments on commit 7976661

Please sign in to comment.