本文整理汇总了C#中ModuleSymbol类的典型用法代码示例。如果您正苦于以下问题:C# ModuleSymbol类的具体用法?C# ModuleSymbol怎么用?C# ModuleSymbol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModuleSymbol类属于命名空间,在下文中一共展示了ModuleSymbol类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ModuleReference
internal ModuleReference(PEModuleBuilder moduleBeingBuilt, ModuleSymbol underlyingModule)
{
Debug.Assert(moduleBeingBuilt != null);
Debug.Assert((object)underlyingModule != null);
this.moduleBeingBuilt = moduleBeingBuilt;
this.underlyingModule = underlyingModule;
}
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:8,代码来源:ModuleReference.cs
示例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;
}
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:12,代码来源:SynthesizedGlobalMethodSymbol.cs
示例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");
}
}
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:14,代码来源:WellKnownAttributesTestBase.cs
示例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;
}
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:17,代码来源:PEAssemblySymbol.cs
示例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);
}
开发者ID:rgani,项目名称:roslyn,代码行数:18,代码来源:EEAssemblyBuilder.cs
示例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;
}
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:28,代码来源:RetargetingAssemblySymbol.cs
示例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");
}
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:8,代码来源:AnonymousTypesSemanticsTests.cs
示例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;
}
开发者ID:XieShuquan,项目名称:roslyn,代码行数:6,代码来源:MissingMetadataTypeSymbol.cs
示例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());
}
开发者ID:nemec,项目名称:roslyn,代码行数:31,代码来源:AttributeTests.cs
示例10: VisitModule
public virtual void VisitModule(ModuleSymbol symbol)
{
DefaultVisit(symbol);
}
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:4,代码来源:SymbolVisitor.cs
示例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);
}
开发者ID:jerriclynsjohn,项目名称:roslyn,代码行数:22,代码来源:DestructorTests.cs
示例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);
}
开发者ID:Rickinio,项目名称:roslyn,代码行数:46,代码来源:LoadingNamespacesAndTypes.cs
示例13: TopLevelWithCustomErrorInfo
public TopLevelWithCustomErrorInfo(ModuleSymbol module, ref MetadataTypeName emittedName, DiagnosticInfo errorInfo, WellKnownType typeId)
: base(module, ref emittedName, typeId)
{
Debug.Assert(errorInfo != null);
_errorInfo = errorInfo;
}
开发者ID:XieShuquan,项目名称:roslyn,代码行数:6,代码来源:MissingMetadataTypeSymbol.cs
示例14: DumpTypeInfo
internal static XElement DumpTypeInfo(ModuleSymbol moduleSymbol)
{
return LoadChildNamespace(moduleSymbol.GlobalNamespace);
}
开发者ID:EkardNT,项目名称:Roslyn,代码行数:4,代码来源:EmitMetadataTestBase.cs
示例15: Get_System_Security_NamespaceSymbol
internal NamespaceSymbol Get_System_Security_NamespaceSymbol(ModuleSymbol m)
{
NamespaceSymbol sysNS = Get_System_NamespaceSymbol(m);
return sysNS.GetMember<NamespaceSymbol>("Security");
}
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:5,代码来源:WellKnownAttributesTestBase.cs
示例16: Get_System_Diagnostics_NamespaceSymbol
internal NamespaceSymbol Get_System_Diagnostics_NamespaceSymbol(ModuleSymbol m)
{
NamespaceSymbol sysNS = Get_System_NamespaceSymbol(m);
return sysNS.GetMember<NamespaceSymbol>("Diagnostics");
}
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:5,代码来源:WellKnownAttributesTestBase.cs
示例17: Get_System_Runtime_CompilerServices_NamespaceSymbol
internal NamespaceSymbol Get_System_Runtime_CompilerServices_NamespaceSymbol(ModuleSymbol m)
{
NamespaceSymbol sysNS = Get_System_NamespaceSymbol(m);
return Get_System_Runtime_CompilerServices_NamespaceSymbol(sysNS);
}
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:5,代码来源:WellKnownAttributesTestBase.cs
示例18: Get_System_Runtime_InteropServices_WindowsRuntime_NamespaceSymbol
internal NamespaceSymbol Get_System_Runtime_InteropServices_WindowsRuntime_NamespaceSymbol(ModuleSymbol m)
{
NamespaceSymbol interopNS = Get_System_Runtime_InteropServices_NamespaceSymbol(m);
return interopNS.GetMember<NamespaceSymbol>("WindowsRuntime");
}
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:5,代码来源:WellKnownAttributesTestBase.cs
示例19: ValidateEvent
// NOTE: assumes there's an event E in a type C.
private static void ValidateEvent(ModuleSymbol module, bool isFromSource, bool isStatic, bool isFieldLike)
{
var @class = module.GlobalNamespace.GetMember<NamedTypeSymbol>("C");
var @event = @class.GetMember<EventSymbol>("E");
Assert.Equal(SymbolKind.Event, @event.Kind);
Assert.Equal(Accessibility.Public, @event.DeclaredAccessibility);
Assert.Equal(isStatic, @event.IsStatic);
Assert.False(@event.MustCallMethodsDirectly);
var addMethod = @event.AddMethod;
Assert.Equal(MethodKind.EventAdd, addMethod.MethodKind);
Assert.Equal("void C.E.add", addMethod.ToTestDisplayString());
addMethod.CheckAccessorShape(@event);
var removeMethod = @event.RemoveMethod;
Assert.Equal(MethodKind.EventRemove, removeMethod.MethodKind);
Assert.Equal("void C.E.remove", removeMethod.ToTestDisplayString());
removeMethod.CheckAccessorShape(@event);
// Whether or not the event was field-like in source, it will look custom when loaded from metadata.
if (isFieldLike && isFromSource)
{
Assert.True(@event.HasAssociatedField);
var associatedField = @event.AssociatedField;
Assert.Equal(SymbolKind.Field, associatedField.Kind);
Assert.Equal(Accessibility.Private, associatedField.DeclaredAccessibility);
Assert.Equal(isStatic, associatedField.IsStatic);
Assert.Equal(@event.Type, associatedField.Type);
}
else
{
Assert.False(@event.HasAssociatedField);
Assert.Null(@event.AssociatedField);
}
}
开发者ID:riversky,项目名称:roslyn,代码行数:37,代码来源:EventTests.cs
示例20: NoPiaIllegalGenericInstantiationSymbol
public NoPiaIllegalGenericInstantiationSymbol(ModuleSymbol exposingModule, NamedTypeSymbol underlyingSymbol)
{
_exposingModule = exposingModule;
_underlyingSymbol = underlyingSymbol;
}
开发者ID:RoryVL,项目名称:roslyn,代码行数:5,代码来源:NoPiaIllegalGenericInstantiationSymbol.cs
注:本文中的ModuleSymbol类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论