本文整理汇总了C#中ModuleSymbol类的典型用法代码示例。如果您正苦于以下问题:C# ModuleSymbol类的具体用法?C# ModuleSymbol怎么用?C# ModuleSymbol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModuleSymbol类属于命名空间,在下文中一共展示了ModuleSymbol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ModuleReference
internal ModuleReference(PEModuleBuilder moduleBeingBuilt, ModuleSymbol underlyingModule)
{
Debug.Assert(moduleBeingBuilt != null);
Debug.Assert((object)underlyingModule != null);
this.moduleBeingBuilt = moduleBeingBuilt;
this.underlyingModule = underlyingModule;
}
示例2: SynthesizedGlobalMethodSymbol
internal SynthesizedGlobalMethodSymbol(ModuleSymbol containingModule, PrivateImplementationDetails privateImplType, TypeSymbol returnType, string name)
{
Debug.Assert((object)containingModule != null);
Debug.Assert(privateImplType != null);
Debug.Assert((object)returnType != null);
Debug.Assert(name != null);
_containingModule = containingModule;
_privateImplType = privateImplType;
_returnType = returnType;
_name = name;
}
示例3: Get_System_NamespaceSymbol
internal NamespaceSymbol Get_System_NamespaceSymbol(ModuleSymbol m)
{
var assembly = m.ContainingSymbol;
SourceAssemblySymbol sourceAssembly = assembly as SourceAssemblySymbol;
if (sourceAssembly != null)
{
return sourceAssembly.DeclaringCompilation.GlobalNamespace.GetMember<NamespaceSymbol>("System");
}
else
{
var peAssembly = (PEAssemblySymbol)assembly;
return peAssembly.CorLibrary.GlobalNamespace.GetMember<NamespaceSymbol>("System");
}
}
示例4: PEAssemblySymbol
internal PEAssemblySymbol(PEAssembly assembly, DocumentationProvider documentationProvider, bool isLinked, MetadataImportOptions importOptions)
{
Debug.Assert(assembly != null);
Debug.Assert(documentationProvider != null);
_assembly = assembly;
_documentationProvider = documentationProvider;
var modules = new ModuleSymbol[assembly.Modules.Length];
for (int i = 0; i < assembly.Modules.Length; i++)
{
modules[i] = new PEModuleSymbol(this, assembly.Modules[i], importOptions, i);
}
_modules = modules.AsImmutableOrNull();
_isLinked = isLinked;
}
示例5: TranslateModule
protected override IModuleReference TranslateModule(ModuleSymbol symbol, DiagnosticBag diagnostics)
{
var moduleSymbol = symbol as PEModuleSymbol;
if ((object)moduleSymbol != null)
{
var module = moduleSymbol.Module;
// Expose the individual runtime Windows.*.winmd modules as assemblies.
// (The modules were wrapped in a placeholder Windows.winmd assembly
// in MetadataUtilities.MakeAssemblyReferences.)
if (MetadataUtilities.IsWindowsComponent(module.MetadataReader, module.Name) &&
MetadataUtilities.IsWindowsAssemblyName(moduleSymbol.ContainingAssembly.Name))
{
var identity = module.ReadAssemblyIdentityOrThrow();
return new Microsoft.CodeAnalysis.ExpressionEvaluator.AssemblyReference(identity);
}
}
return base.TranslateModule(symbol, diagnostics);
}
示例6: RetargetingAssemblySymbol
/// <summary>
/// Constructor.
/// </summary>
/// <param name="underlyingAssembly">
/// The underlying AssemblySymbol, cannot be an instance of RetargetingAssemblySymbol.
/// </param>
/// <param name="isLinked">
/// Assembly is /l-ed by compilation that is using it as a reference.
/// </param>
public RetargetingAssemblySymbol(SourceAssemblySymbol underlyingAssembly, bool isLinked)
{
Debug.Assert((object)underlyingAssembly != null);
_underlyingAssembly = underlyingAssembly;
ModuleSymbol[] modules = new ModuleSymbol[underlyingAssembly.Modules.Length];
modules[0] = new RetargetingModuleSymbol(this, (SourceModuleSymbol)underlyingAssembly.Modules[0]);
for (int i = 1; i < underlyingAssembly.Modules.Length; i++)
{
PEModuleSymbol under = (PEModuleSymbol)underlyingAssembly.Modules[i];
modules[i] = new PEModuleSymbol(this, under.Module, under.ImportOptions, i);
}
_modules = modules.AsImmutableOrNull();
_isLinked = isLinked;
}
示例7: CheckAnonymousTypes
private void CheckAnonymousTypes(ModuleSymbol module)
{
var ns = module.GlobalNamespace;
Assert.NotNull(ns);
CheckAnonymousType(ns.GetMember<NamedTypeSymbol>("<>f__AnonymousType0"), "<>f__AnonymousType0", "<>f__AnonymousType0`2");
CheckAnonymousType(ns.GetMember<NamedTypeSymbol>("<>f__AnonymousType1"), "<>f__AnonymousType1", "<>f__AnonymousType1");
}
示例8: TopLevel
private TopLevel(ModuleSymbol module, ref MetadataTypeName fullName, int typeId)
: this(module, ref fullName, fullName.ForcedArity == -1 || fullName.ForcedArity == fullName.InferredArity)
{
Debug.Assert(typeId == -1 || typeId == (int)SpecialType.None || Arity == 0 || MangleName);
_lazyTypeId = typeId;
}
示例9: TestAttributeOnPartialMethodHelper
private void TestAttributeOnPartialMethodHelper(ModuleSymbol m, MethodSymbol fooMethod)
{
var a1Class = m.GlobalNamespace.GetTypeMember("A1");
var a2Class = m.GlobalNamespace.GetTypeMember("A2");
var b1Class = m.GlobalNamespace.GetTypeMember("B1");
var b2Class = m.GlobalNamespace.GetTypeMember("B2");
var c1Class = m.GlobalNamespace.GetTypeMember("C1");
var c2Class = m.GlobalNamespace.GetTypeMember("C2");
var d1Class = m.GlobalNamespace.GetTypeMember("D1");
var d2Class = m.GlobalNamespace.GetTypeMember("D2");
var e1Class = m.GlobalNamespace.GetTypeMember("E1");
var e2Class = m.GlobalNamespace.GetTypeMember("E2");
Assert.Equal(1, fooMethod.GetAttributes(a1Class).Count());
Assert.Equal(1, fooMethod.GetAttributes(a2Class).Count());
Assert.Equal(1, fooMethod.GetReturnTypeAttributes().Where(a => a.AttributeClass == b1Class).Count());
Assert.Equal(1, fooMethod.GetReturnTypeAttributes().Where(a => a.AttributeClass == b2Class).Count());
var typeParam1 = fooMethod.TypeParameters[0];
Assert.Equal(1, typeParam1.GetAttributes(c1Class).Count());
Assert.Equal(1, typeParam1.GetAttributes(c2Class).Count());
var typeParam2 = fooMethod.TypeParameters[1];
Assert.Equal(1, typeParam2.GetAttributes(d1Class).Count());
Assert.Equal(1, typeParam2.GetAttributes(d2Class).Count());
var param = fooMethod.Parameters[0];
Assert.Equal(1, param.GetAttributes(e1Class).Count());
Assert.Equal(1, param.GetAttributes(e2Class).Count());
}
示例10: VisitModule
public virtual void VisitModule(ModuleSymbol symbol)
{
DefaultVisit(symbol);
}
示例11: ValidateDestructor
// NOTE: assumes there's a destructor.
private static void ValidateDestructor(ModuleSymbol module, string typeName)
{
var @class = module.GlobalNamespace.GetMember<NamedTypeSymbol>(typeName);
var destructor = @class.GetMember<MethodSymbol>(WellKnownMemberNames.DestructorName);
Assert.Equal(MethodKind.Destructor, destructor.MethodKind);
Assert.True(destructor.IsMetadataVirtual());
Assert.False(destructor.IsVirtual);
Assert.False(destructor.IsOverride);
Assert.False(destructor.IsSealed);
Assert.False(destructor.IsStatic);
Assert.False(destructor.IsAbstract);
Assert.Null(destructor.OverriddenMethod);
Assert.Equal(SpecialType.System_Void, destructor.ReturnType.SpecialType);
Assert.Equal(0, destructor.Parameters.Length);
Assert.Equal(0, destructor.TypeParameters.Length);
Assert.Equal(Accessibility.Protected, destructor.DeclaredAccessibility);
}
示例12: TypeAndNamespaceDifferByCase
private void TypeAndNamespaceDifferByCase(ModuleSymbol module0)
{
var someName = module0.GlobalNamespace.GetMembers("SomenamE");
Assert.Equal(someName.Length, 0);
someName = module0.GlobalNamespace.GetMembers("somEnamE");
Assert.Equal(someName.Length, 1);
Assert.NotNull((someName[0] as NamedTypeSymbol));
someName = module0.GlobalNamespace.GetMembers("SomeName");
Assert.Equal(someName.Length, 1);
Assert.NotNull((someName[0] as NamespaceSymbol));
var someName1_1 = module0.GlobalNamespace.GetTypeMembers("somEnamE1").OrderBy((t) => t.Name).ToArray();
var someName1_2 = module0.GlobalNamespace.GetTypeMembers("SomeName1").OrderBy((t) => t.Name).ToArray();
Assert.Equal(1, someName1_1.Length);
Assert.Equal("somEnamE1", someName1_1[0].Name);
Assert.Equal(1, someName1_2.Length);
Assert.Equal("SomeName1", someName1_2[0].Name);
Assert.NotEqual(someName1_1[0], someName1_2[0]);
var someName2_1 = module0.GlobalNamespace.GetMembers("somEnamE2").OfType<NamespaceSymbol>().OrderBy((t) => t.Name).ToArray();
var someName2_2 = module0.GlobalNamespace.GetMembers("SomeName2").OfType<NamespaceSymbol>().OrderBy((t) => t.Name).ToArray();
Assert.Equal(1, someName2_1.Length);
Assert.Equal("somEnamE2", someName2_1[0].Name);
Assert.Equal(1, someName2_2.Length);
Assert.Equal("SomeName2", someName2_2[0].Name);
Assert.NotEqual(someName2_1[0], someName2_2[0]);
var otherName_1 = someName2_1[0].GetTypeMembers("OtherName");
var otherName_2 = someName2_2[0].GetTypeMembers("OtherName");
Assert.Equal(1, otherName_1.Length);
Assert.Equal(1, otherName_2.Length);
Assert.NotEqual(otherName_1[0], otherName_2[0]);
var nestingClass = module0.GlobalNamespace.GetTypeMembers("NestingClass").Single();
var someName3_1 = nestingClass.GetTypeMembers("SomeName3").OrderBy((t) => t.Name).ToArray();
var someName3_2 = nestingClass.GetTypeMembers("somEnamE3").OrderBy((t) => t.Name).ToArray();
Assert.Equal(1, someName3_1.Length);
Assert.Equal(1, someName3_2.Length);
Assert.Equal("somEnamE3", someName3_2[0].Name);
Assert.Equal("SomeName3", someName3_1[0].Name);
}
示例13: TopLevelWithCustomErrorInfo
public TopLevelWithCustomErrorInfo(ModuleSymbol module, ref MetadataTypeName emittedName, DiagnosticInfo errorInfo, WellKnownType typeId)
: base(module, ref emittedName, typeId)
{
Debug.Assert(errorInfo != null);
_errorInfo = errorInfo;
}
示例14: DumpTypeInfo
internal static XElement DumpTypeInfo(ModuleSymbol moduleSymbol)
{
return LoadChildNamespace(moduleSymbol.GlobalNamespace);
}
示例15: Get_System_Security_NamespaceSymbol
internal NamespaceSymbol Get_System_Security_NamespaceSymbol(ModuleSymbol m)
{
NamespaceSymbol sysNS = Get_System_NamespaceSymbol(m);
return sysNS.GetMember<NamespaceSymbol>("Security");
}