Ejemplo n.º 1
0
        private static NamedTypeSymbol CreateCallSiteContainer(SyntheticBoundNodeFactory factory, int methodOrdinal)
        {
            // We don't reuse call-sites during EnC. Each edit creates a new container and sites.
            int generation    = factory.CompilationState.ModuleBuilderOpt.CurrentGenerationOrdinal;
            var containerName = GeneratedNames.MakeDynamicCallSiteContainerName(methodOrdinal, generation);

            var synthesizedContainer = new DynamicSiteContainer(containerName, factory.TopLevelMethod);

            factory.AddNestedType(synthesizedContainer);

            if (factory.TopLevelMethod.IsGenericMethod)
            {
                return(synthesizedContainer.Construct(factory.TopLevelMethod.TypeParameters.Cast <TypeParameterSymbol, TypeSymbol>()));
            }

            return(synthesizedContainer);
        }
Ejemplo n.º 2
0
        private static NamedTypeSymbol CreateCallSiteContainer(SyntheticBoundNodeFactory factory)
        {
            // TODO (tomat): consider - why do we need to include a method name at all? We could save some metadata bytes by not including it.
            // Dev11 uses an empty string for explicit interface method implementation:
            var containerName = GeneratedNames.MakeDynamicCallSiteContainerName(
                factory.TopLevelMethod.IsExplicitInterfaceImplementation ? "" : factory.TopLevelMethod.Name, factory.CompilationState.GenerateTempNumber());

            var synthesizedContainer = new DynamicSiteContainer(containerName, factory.TopLevelMethod);

            factory.AddNestedType(synthesizedContainer);

            if (factory.TopLevelMethod.IsGenericMethod)
            {
                return(synthesizedContainer.Construct(factory.TopLevelMethod.TypeParameters.Cast <TypeParameterSymbol, TypeSymbol>()));
            }

            return(synthesizedContainer);
        }
        private static NamedTypeSymbol CreateCallSiteContainer(SyntheticBoundNodeFactory factory, int methodOrdinal)
        {
            // We don't reuse call-sites during EnC. Each edit creates a new container and sites.
            int generation = factory.CompilationState.ModuleBuilderOpt.CurrentGenerationOrdinal;
            var containerName = GeneratedNames.MakeDynamicCallSiteContainerName(methodOrdinal, generation);

            var synthesizedContainer = new DynamicSiteContainer(containerName, factory.TopLevelMethod);
            factory.AddNestedType(synthesizedContainer);

            if (factory.TopLevelMethod.IsGenericMethod)
            {
                return synthesizedContainer.Construct(factory.TopLevelMethod.TypeParameters.Cast<TypeParameterSymbol, TypeSymbol>());
            }

            return synthesizedContainer;
        }
        private static NamedTypeSymbol CreateCallSiteContainer(SyntheticBoundNodeFactory factory)
        {
            // TODO (tomat): consider - why do we need to include a method name at all? We could save some metadata bytes by not including it.
            // Dev11 uses an empty string for explicit interface method implementation:
            var containerName = GeneratedNames.MakeDynamicCallSiteContainerName(
                factory.TopLevelMethod.IsExplicitInterfaceImplementation ? "" : factory.TopLevelMethod.Name, factory.CompilationState.GenerateTempNumber());

            var synthesizedContainer = new DynamicSiteContainer(containerName, factory.TopLevelMethod);
            factory.AddNestedType(synthesizedContainer);

            if (factory.TopLevelMethod.IsGenericMethod)
            {
                return synthesizedContainer.Construct(factory.TopLevelMethod.TypeParameters.Cast<TypeParameterSymbol, TypeSymbol>());
            }

            return synthesizedContainer;
        }