本文整理汇总了C#中ModuleCompilationState类的典型用法代码示例。如果您正苦于以下问题:C# ModuleCompilationState类的具体用法?C# ModuleCompilationState怎么用?C# ModuleCompilationState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModuleCompilationState类属于命名空间,在下文中一共展示了ModuleCompilationState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddSynthesizedAttributes
internal sealed override void AddSynthesizedAttributes(ModuleCompilationState compilationState, ref ArrayBuilder<SynthesizedAttributeData> attributes)
{
base.AddSynthesizedAttributes(compilationState, ref attributes);
var compilation = this.DeclaringCompilation;
if (this.IsParams)
{
AddSynthesizedAttribute(ref attributes, compilation.TrySynthesizeAttribute(WellKnownMember.System_ParamArrayAttribute__ctor));
}
// Synthesize DecimalConstantAttribute if we don't have an explicit custom attribute already:
var defaultValue = this.ExplicitDefaultConstantValue;
if (defaultValue != ConstantValue.NotAvailable &&
defaultValue.SpecialType == SpecialType.System_Decimal &&
DefaultValueFromAttributes == ConstantValue.NotAvailable)
{
AddSynthesizedAttribute(ref attributes, compilation.SynthesizeDecimalConstantAttribute(defaultValue.DecimalValue));
}
if (this.Type.ContainsDynamic())
{
AddSynthesizedAttribute(ref attributes, compilation.SynthesizeDynamicAttribute(this.Type, this.CustomModifiers.Length, this.RefKind));
}
if (Type.ContainsTupleNames())
{
AddSynthesizedAttribute(ref attributes,
compilation.SynthesizeTupleNamesAttribute(Type));
}
}
示例2: AddSynthesizedAttributes
internal override void AddSynthesizedAttributes(ModuleCompilationState compilationState, ref ArrayBuilder<SynthesizedAttributeData> attributes)
{
base.AddSynthesizedAttributes(compilationState, ref attributes);
var compilation = this.DeclaringCompilation;
AddSynthesizedAttribute(ref attributes, compilation.TrySynthesizeAttribute(WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor));
}
示例3: AddSynthesizedAttributes
internal override void AddSynthesizedAttributes(ModuleCompilationState compilationState, ref ArrayBuilder<SynthesizedAttributeData> attributes)
{
base.AddSynthesizedAttributes(compilationState, ref attributes);
CSharpCompilation compilation = this.DeclaringCompilation;
// do not emit CompilerGenerated attributes for fields inside compiler generated types:
if (!_containingType.IsImplicitlyDeclared)
{
AddSynthesizedAttribute(ref attributes, compilation.TrySynthesizeAttribute(WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor));
}
if (!this.SuppressDynamicAttribute &&
this.Type.ContainsDynamic() &&
compilation.HasDynamicEmitAttributes() &&
compilation.CanEmitBoolean())
{
AddSynthesizedAttribute(ref attributes, compilation.SynthesizeDynamicAttribute(this.Type, this.CustomModifiers.Length));
}
if (Type.ContainsTuple() &&
compilation.HasTupleNamesAttributes &&
compilation.CanEmitSpecialType(SpecialType.System_String))
{
AddSynthesizedAttribute(ref attributes,
compilation.SynthesizeTupleNamesAttributeOpt(Type));
}
}
示例4: AddSynthesizedAttributes
internal override void AddSynthesizedAttributes(ModuleCompilationState compilationState, ref ArrayBuilder<SynthesizedAttributeData> attributes)
{
base.AddSynthesizedAttributes(compilationState, ref attributes);
var compilation = this.DeclaringCompilation;
AddSynthesizedAttribute(ref attributes, compilation.TrySynthesizeAttribute(WellKnownMember.System_Diagnostics_DebuggerHiddenAttribute__ctor));
}
示例5: GetCustomAttributesToEmit
internal virtual IEnumerable<CSharpAttributeData> GetCustomAttributesToEmit(ModuleCompilationState compilationState)
{
CheckDefinitionInvariant();
Debug.Assert(this.Kind != SymbolKind.Assembly);
return GetCustomAttributesToEmit(compilationState, emittingAssemblyAttributesInNetModule: false);
}
示例6: AddSynthesizedAttributes
internal override void AddSynthesizedAttributes(ModuleCompilationState compilationState, ref ArrayBuilder<SynthesizedAttributeData> attributes)
{
base.AddSynthesizedAttributes(compilationState, ref attributes);
var compilation = this.DeclaringCompilation;
// Dev11 doesn't synthesize this attribute, the debugger has a knowledge
// of special name C# compiler uses for backing fields, which is not desirable.
AddSynthesizedAttribute(ref attributes, compilation.SynthesizeDebuggerBrowsableNeverAttribute());
}
示例7: AddSynthesizedAttributes
internal override void AddSynthesizedAttributes(ModuleCompilationState compilationState, ref ArrayBuilder<SynthesizedAttributeData> attributes)
{
base.AddSynthesizedAttributes(compilationState, ref attributes);
var compilation = this.DeclaringCompilation;
if (this.ReturnType.ContainsDynamic() && compilation.HasDynamicEmitAttributes() && compilation.CanEmitBoolean())
{
AddSynthesizedAttribute(ref attributes, compilation.SynthesizeDynamicAttribute(this.ReturnType, this.ReturnTypeCustomModifiers.Length));
}
}
示例8: AddSynthesizedAttributes
internal override void AddSynthesizedAttributes(ModuleCompilationState compilationState, ref ArrayBuilder<SynthesizedAttributeData> attributes)
{
base.AddSynthesizedAttributes(compilationState, ref attributes);
var compilation = this.DeclaringCompilation;
AddSynthesizedAttribute(ref attributes, compilation.TrySynthesizeAttribute(WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor));
// Dev11 doesn't synthesize this attribute, the debugger has a knowledge
// of special name C# compiler uses for backing fields, which is not desirable.
AddSynthesizedAttribute(ref attributes, compilation.SynthesizeDebuggerBrowsableNeverAttribute());
}
示例9: AddSynthesizedAttributes
internal override void AddSynthesizedAttributes(ModuleCompilationState compilationState, ref ArrayBuilder<SynthesizedAttributeData> attributes)
{
base.AddSynthesizedAttributes(compilationState, ref attributes);
var compilation = this.DeclaringCompilation;
var systemType = compilation.GetWellKnownType(WellKnownType.System_Type);
var intType = compilation.GetSpecialType(SpecialType.System_Int32);
var item1 = new TypedConstant(systemType, TypedConstantKind.Type, ((PointerTypeSymbol)this.Type).PointedAtType);
var item2 = new TypedConstant(intType, TypedConstantKind.Primitive, this.FixedSize);
AddSynthesizedAttribute(ref attributes, compilation.TrySynthesizeAttribute(
WellKnownMember.System_Runtime_CompilerServices_FixedBufferAttribute__ctor,
ImmutableArray.Create<TypedConstant>(item1, item2)));
}
示例10: AddSynthesizedAttributes
internal override void AddSynthesizedAttributes(ModuleCompilationState compilationState, ref ArrayBuilder<SynthesizedAttributeData> attributes)
{
base.AddSynthesizedAttributes(compilationState, ref attributes);
// do not generate attributes for members of compiler-generated types:
if (ContainingType.IsImplicitlyDeclared)
{
return;
}
var compilation = this.DeclaringCompilation;
AddSynthesizedAttribute(ref attributes,
compilation.TrySynthesizeAttribute(WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor));
}
示例11: AddSynthesizedAttributes
internal sealed override void AddSynthesizedAttributes(ModuleCompilationState compilationState, ref ArrayBuilder<SynthesizedAttributeData> attributes)
{
base.AddSynthesizedAttributes(compilationState, ref attributes);
if (debuggerHidden)
{
var compilation = this.DeclaringCompilation;
AddSynthesizedAttribute(ref attributes, compilation.SynthesizeAttribute(WellKnownMember.System_Diagnostics_DebuggerHiddenAttribute__ctor));
}
if (this.ReturnType.ContainsDynamic())
{
var compilation = this.DeclaringCompilation;
AddSynthesizedAttribute(ref attributes, compilation.SynthesizeDynamicAttribute(this.ReturnType, this.ReturnTypeCustomModifiers.Length));
}
}
示例12: AddSynthesizedAttributes
internal override void AddSynthesizedAttributes(ModuleCompilationState compilationState, ref ArrayBuilder<SynthesizedAttributeData> attributes)
{
base.AddSynthesizedAttributes(compilationState, ref attributes);
var compilation = this.DeclaringCompilation;
if (this.ReturnType.ContainsDynamic() && compilation.HasDynamicEmitAttributes() && compilation.CanEmitBoolean())
{
AddSynthesizedAttribute(ref attributes, compilation.SynthesizeDynamicAttribute(this.ReturnType, this.ReturnTypeCustomModifiers.Length + this.RefCustomModifiers.Length, this.RefKind));
}
if (ReturnType.ContainsTupleNames() &&
compilation.HasTupleNamesAttributes &&
compilation.CanEmitSpecialType(SpecialType.System_String))
{
AddSynthesizedAttribute(ref attributes,
compilation.SynthesizeTupleNamesAttribute(ReturnType));
}
}
示例13: AddSynthesizedAttributes
internal override void AddSynthesizedAttributes(ModuleCompilationState compilationState, ref ArrayBuilder<SynthesizedAttributeData> attributes)
{
base.AddSynthesizedAttributes(compilationState, ref attributes);
if (ContainingSymbol.Kind == SymbolKind.NamedType && ContainingSymbol.IsImplicitlyDeclared)
{
return;
}
var compilation = ContainingSymbol.DeclaringCompilation;
// this can only happen if frame is not nested in a source type/namespace (so far we do not do this)
// if this happens for whatever reason, we do not need "CompilerGenerated" anyways
Debug.Assert(compilation != null, "SynthesizedClass is not contained in a source module?");
AddSynthesizedAttribute(ref attributes, compilation.TrySynthesizeAttribute(
WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor));
}
示例14: AddSynthesizedAttributes
internal override void AddSynthesizedAttributes(ModuleCompilationState compilationState, ref ArrayBuilder<SynthesizedAttributeData> attributes)
{
base.AddSynthesizedAttributes(compilationState, ref attributes);
// do not emit Dynamic or CompilerGenerated attributes for fields inside compiler generated types:
if (containingType.IsImplicitlyDeclared)
{
return;
}
CSharpCompilation compilation = this.DeclaringCompilation;
// Assume that someone checked earlier that the attribute ctor is available and has no use-site errors.
AddSynthesizedAttribute(ref attributes, compilation.SynthesizeAttribute(WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor));
// TODO (tomat): do we need to emit dynamic attribute on any synthesized field?
if (this.Type.ContainsDynamic())
{
// Assume that someone checked earlier that the attribute ctor is available and has no use-site errors.
AddSynthesizedAttribute(ref attributes, compilation.SynthesizeDynamicAttribute(this.Type, customModifiersCount: 0));
}
}
示例15: GetCustomAttributesToEmit
protected override IEnumerable<CSharpAttributeData> GetCustomAttributesToEmit(ModuleCompilationState compilationState)
{
return UnderlyingProperty.GetCustomAttributesToEmit(compilationState);
}