Kuba Ober d6d83d54a2 Fix annotations and constants: Factor out type definitions, and add definitions of annotations and constants.
The TypeDefinition is no longer overloaded for Annotation and Constant nodes, and the generator is happy again.
2019-08-29 13:36:58 -04:00

19 lines
537 B
C#

using System.Collections.Generic;
using System.Linq;
namespace CapnpC.Model
{
interface IHasNestedDefinitions
{
IEnumerable<TypeDefinition> NestedTypes { get; }
ICollection<IDefinition> NestedDefinitions { get; }
ICollection<Constant> Constants { get; }
}
static partial class Extensions
{
public static IEnumerable<TypeDefinition> GetNestedTypes(this IHasNestedDefinitions def)
=> def.NestedDefinitions.Select(d => d as TypeDefinition).Where(d => d != null);
}
}