예제 #1
0
        private GeneratedData CreateTypesToGenerate(IReadOnlyList <ImmutableRootSyntaxNode> rootNodes, CodeGenerationStore store)
        {
            var toGenerate = new GeneratedData();

            foreach (var rootNode in rootNodes)
            {
                foreach (var node in rootNode.Delegates)
                {
                    var type = moduleBuilder.DefineType(node.Name, TypeAttributes.Public | TypeAttributes.Class | TypeAttributes.Sealed | TypeAttributes.AutoLayout, typeof(MulticastDelegate));

                    toGenerate.Delegates.Add(type, node);

                    store.Types.Add(node.Name, type);
                }

                foreach (var node in rootNode.Classes)
                {
                    var type = moduleBuilder.DefineType(node.Name, TypeAttributes.Public | TypeAttributes.Class | TypeAttributes.Sealed | TypeAttributes.AutoLayout);

                    store.Types.Add(node.Name, type);

                    toGenerate.Classes.Add(type, node);
                }
            }

            return(toGenerate);
        }