Ejemplo n.º 1
0
 internal PENetModuleBuilder(
     SourceModuleSymbol sourceModule,
     EmitOptions emitOptions,
     Cci.ModulePropertiesForSerialization serializationProperties,
     IEnumerable<ResourceDescription> manifestResources)
     : base(sourceModule, emitOptions, OutputKind.NetModule, serializationProperties, manifestResources)
 {
 }
Ejemplo n.º 2
0
 internal PENetModuleBuilder(
     SourceModuleSymbol sourceModule, 
     string outputName, 
     ModulePropertiesForSerialization serializationProperties, 
     IEnumerable<ResourceDescription> manifestResources,
     bool metadataOnly = false)
     : base(sourceModule, outputName, OutputKind.NetModule, serializationProperties, manifestResources, assemblySymbolMapper: null, metadataOnly: metadataOnly)
 {
 }
Ejemplo n.º 3
0
        internal SynthesizedThrowIfNullMethod(SourceModuleSymbol containingModule, PrivateImplementationDetails privateImplType, MethodSymbol throwMethod, TypeSymbol returnType, TypeSymbol argumentParamType, TypeSymbol paramNameParamType)
            : base(containingModule, privateImplType, returnType, PrivateImplementationDetails.SynthesizedThrowIfNullFunctionName)
        {
            ThrowMethod = throwMethod;

            this.SetParameters(ImmutableArray.Create <ParameterSymbol>(
                                   SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(argumentParamType), ordinal: 0, RefKind.None, "argument"),
                                   SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(paramNameParamType), ordinal: 1, RefKind.None, "paramName")));
        }
Ejemplo n.º 4
0
        internal SourceNamespaceSymbol(
            SourceModuleSymbol module, Symbol container,
            MergedNamespaceDeclaration mergedDeclaration,
            DiagnosticBag diagnostics)
        {
            _module            = module;
            _container         = container;
            _mergedDeclaration = mergedDeclaration;

            foreach (var singleDeclaration in mergedDeclaration.Declarations)
            {
                diagnostics.AddRange(singleDeclaration.Diagnostics);
            }
        }
Ejemplo n.º 5
0
 internal SynthesizedPrivateImplementationDetailsStaticConstructor(
     SourceModuleSymbol containingModule,
     PrivateImplementationDetails privateImplementationType,
     NamedTypeSymbol voidType
     )
     : base(
         containingModule,
         privateImplementationType,
         voidType,
         WellKnownMemberNames.StaticConstructorName
         )
 {
     this.SetParameters(ImmutableArray <ParameterSymbol> .Empty);
 }
        internal static void VerifyParamArrayAttribute(ParameterSymbol parameter, SourceModuleSymbol module, bool expected = true, OutputKind outputKind = OutputKind.ConsoleApplication)
        {
            Assert.Equal(expected, parameter.IsParams);

            var emitModule = new PEAssemblyBuilder(module.ContainingSourceAssembly, null, outputKind, GetDefaultModulePropertiesForSerialization(), SpecializedCollections.EmptyEnumerable<ResourceDescription>());
            var paramArrayAttributeCtor = (MethodSymbol)emitModule.Compilation.GetWellKnownTypeMember(WellKnownMember.System_ParamArrayAttribute__ctor);
            bool found = false;

            var context = new EmitContext(emitModule, null, new DiagnosticBag());

            foreach (Microsoft.Cci.ICustomAttribute attr in parameter.GetSynthesizedAttributes())
            {
                if (paramArrayAttributeCtor == (MethodSymbol)attr.Constructor(context))
                {
                    Assert.False(found, "Multiple ParamArrayAttribute");
                    found = true;
                }
            }

            Assert.Equal(expected, found);
            context.Diagnostics.Verify();
        }
Ejemplo n.º 7
0
        internal SourceNamespaceSymbol(
            SourceModuleSymbol module, Symbol container,
            MergedNamespaceDeclaration mergedDeclaration,
            BindingDiagnosticBag diagnostics)
        {
            Debug.Assert(mergedDeclaration != null);
            _module            = module;
            _container         = container;
            _mergedDeclaration = mergedDeclaration;

            var builder = ImmutableSegmentedDictionary.CreateBuilder <SingleNamespaceDeclaration, AliasesAndUsings>(ReferenceEqualityComparer.Instance);

#if DEBUG
            var builderForAsserts = ImmutableSegmentedDictionary.CreateBuilder <SingleNamespaceDeclaration, AliasesAndUsings>(ReferenceEqualityComparer.Instance);
#endif
            foreach (var singleDeclaration in mergedDeclaration.Declarations)
            {
                if (singleDeclaration.HasExternAliases || singleDeclaration.HasGlobalUsings || singleDeclaration.HasUsings)
                {
                    builder.Add(singleDeclaration, new AliasesAndUsings());
                }
#if DEBUG
                else
                {
                    builderForAsserts.Add(singleDeclaration, new AliasesAndUsings());
                }
#endif

                diagnostics.AddRange(singleDeclaration.Diagnostics);
            }

            _aliasesAndUsings = builder.ToImmutable();
#if DEBUG
            _aliasesAndUsingsForAsserts = builderForAsserts.ToImmutable();
#endif
        }
 internal SynthesizedThrowSwitchExpressionExceptionMethod(SourceModuleSymbol containingModule, PrivateImplementationDetails privateImplType, TypeSymbol returnType, TypeSymbol paramType)
     : base(containingModule, privateImplType, returnType, PrivateImplementationDetails.SynthesizedThrowSwitchExpressionExceptionFunctionName)
 {
     this.SetParameters(ImmutableArray.Create(SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(paramType), 0, RefKind.None, "unmatchedValue")));
 }
Ejemplo n.º 9
0
 internal SourceNamespaceSymbol(SourceModuleSymbol module, Symbol container, MergedNamespaceDeclaration mergedDeclaration)
 {
     _module = module;
     _container = container;
     _mergedDeclaration = mergedDeclaration;
 }
Ejemplo n.º 10
0
 internal SynthesizedThrowMethod(SourceModuleSymbol containingModule, PrivateImplementationDetails privateImplType, TypeSymbol returnType, TypeSymbol paramType)
     : base(containingModule, privateImplType, returnType, PrivateImplementationDetails.SynthesizedThrowFunctionName)
 {
     this.SetParameters(ImmutableArray.Create <ParameterSymbol>(SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(paramType), 0, RefKind.None, "paramName")));
 }
Ejemplo n.º 11
0
 internal SourceNamespaceSymbol(SourceModuleSymbol module, Symbol container, MergedNamespaceDeclaration mergedDeclaration)
 {
     _module            = module;
     _container         = container;
     _mergedDeclaration = mergedDeclaration;
 }
 internal SynthesizedStringSwitchHashMethod(SourceModuleSymbol containingModule, PrivateImplementationDetails privateImplType, TypeSymbol returnType, TypeSymbol paramType)
     : base(containingModule, privateImplType, returnType, PrivateImplementationDetails.SynthesizedStringHashFunctionName)
 {
     this.SetParameters(ImmutableArray.Create <ParameterSymbol>(new SynthesizedParameterSymbol(this, paramType, 0, RefKind.None, "s")));
 }
 internal SynthesizedPrivateImplementationDetailsStaticConstructor(SourceModuleSymbol containingModule, PrivateImplementationDetails privateImplementationType, NamedTypeSymbol voidType)
     : base(containingModule, privateImplementationType, voidType, WellKnownMemberNames.StaticConstructorName)
 {
     this.SetParameters(ImmutableArray<ParameterSymbol>.Empty);
 }
 internal SynthesizedParameterlessThrowMethod(SourceModuleSymbol containingModule, PrivateImplementationDetails privateImplType, TypeSymbol returnType, string synthesizedMethodName, MethodSymbol exceptionConstructor)
     : base(containingModule, privateImplType, returnType, synthesizedMethodName)
 {
     _exceptionConstructor = exceptionConstructor;
     this.SetParameters(ImmutableArray <ParameterSymbol> .Empty);
 }
Ejemplo n.º 15
0
 internal SynthesizedSpanSwitchHashMethod(SourceModuleSymbol containingModule, PrivateImplementationDetails privateImplType, TypeSymbol returnType, TypeSymbol paramType, bool isReadOnlySpan)
     : base(containingModule, privateImplType, returnType, isReadOnlySpan ? PrivateImplementationDetails.SynthesizedReadOnlySpanHashFunctionName : PrivateImplementationDetails.SynthesizedSpanHashFunctionName)
 {
     _isReadOnlySpan = isReadOnlySpan;
     this.SetParameters(ImmutableArray.Create <ParameterSymbol>(SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(paramType), 0, RefKind.None, "s")));
 }
 internal SynthesizedStringSwitchHashMethod(SourceModuleSymbol containingModule, PrivateImplementationDetails privateImplType, TypeSymbol returnType, TypeSymbol paramType)
     : base(containingModule, privateImplType, returnType, PrivateImplementationDetails.SynthesizedStringHashFunctionName)
 {
     this.SetParameters(ImmutableArray.Create<ParameterSymbol>(new SynthesizedParameterSymbol(this, paramType, 0, RefKind.None, "s")));
 }