本文整理汇总了C#中Internal.TypeSystem.FieldDesc类的典型用法代码示例。如果您正苦于以下问题:C# FieldDesc类的具体用法?C# FieldDesc怎么用?C# FieldDesc使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FieldDesc类属于Internal.TypeSystem命名空间,在下文中一共展示了FieldDesc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFieldRvaData
/// <summary>
/// Gets an object representing the static data for RVA mapped fields from the PE image.
/// </summary>
public ObjectNode GetFieldRvaData(FieldDesc field)
{
if (field.GetType() == typeof(Internal.IL.Stubs.PInvokeLazyFixupField))
{
var pInvokeFixup = (Internal.IL.Stubs.PInvokeLazyFixupField)field;
PInvokeMetadata metadata = pInvokeFixup.PInvokeMetadata;
return NodeFactory.PInvokeMethodFixup(metadata.Module, metadata.Name);
}
else
{
// Use the typical field definition in case this is an instantiated generic type
field = field.GetTypicalFieldDefinition();
return NodeFactory.ReadOnlyDataBlob(NameMangler.GetMangledFieldName(field),
((EcmaField)field).GetFieldRvaData(), NodeFactory.Target.PointerSize);
}
}
示例2: NewToken
public ILToken NewToken(FieldDesc value)
{
return NewToken(value, 0x0a000000);
}
示例3: GetFieldRvaData
/// <summary>
/// Gets an object representing the static data for RVA mapped fields from the PE image.
/// </summary>
public object GetFieldRvaData(FieldDesc field)
{
return _nodeFactory.ReadOnlyDataBlob(NameMangler.GetMangledFieldName(field),
((EcmaField)field).GetFieldRvaData(), _typeSystemContext.Target.PointerSize);
}
示例4: AppendFieldSignature
private void AppendFieldSignature(StringBuilder sb, FieldDesc field)
{
this.TypeNameFormatter.AppendNameWithValueClassPrefix(sb, field.FieldType);
sb.Append(' ');
AppendOwningType(sb, field.OwningType);
sb.Append("::");
sb.Append(field.Name);
}
示例5: ComputeHasGCStaticBase
protected override bool ComputeHasGCStaticBase(FieldDesc field)
{
Debug.Assert(field.IsStatic);
TypeDesc fieldType = field.FieldType;
if (fieldType.IsValueType)
return ((DefType)fieldType).ContainsGCPointers;
else
return fieldType.IsGCPointer;
}
示例6: GetMangledFieldName
public string GetMangledFieldName(FieldDesc field)
{
string mangledName;
if (_mangledFieldNames.TryGetValue(field, out mangledName))
return mangledName;
return ComputeMangledFieldName(field);
}
示例7: GetFieldTypeOrPlaceholder
private TypeDesc GetFieldTypeOrPlaceholder(FieldDesc field)
{
try
{
return field.FieldType;
}
catch
{
// TODO: For now, catch errors due to missing dependencies
return _compilation.TypeSystemContext.GetWellKnownType(WellKnownType.Boolean);
}
}
示例8: GetCppFieldName
public string GetCppFieldName(FieldDesc field)
{
return _compilation.NameMangler.GetMangledFieldName(field).ToString();
}
示例9: RvaFieldData
public RvaFieldData(Compilation compilation, FieldDesc field)
{
Debug.Assert(field.HasRva);
Field = field;
_compilation = compilation;
}
示例10: GeneratesMetadata
public bool GeneratesMetadata(FieldDesc fieldDef)
{
return GeneratesMetadata((MetadataType)fieldDef.OwningType);
}
示例11: AddField
public void AddField(FieldDesc field)
{
RegisteredField reg = GetRegisteredField(field);
if (reg.IncludedInCompilation)
return;
reg.IncludedInCompilation = true;
if (_options.IsCppCodeGen)
{
// Precreate name to ensure that all types referenced by signatures are present
GetRegisteredType(field.OwningType);
GetRegisteredType(field.FieldType);
}
}
示例12: GetRegisteredField
internal RegisteredField GetRegisteredField(FieldDesc field)
{
RegisteredField existingRegistration;
if (_registeredFields.TryGetValue(field, out existingRegistration))
return existingRegistration;
RegisteredField registration = new RegisteredField() { Field = field };
_registeredFields.Add(field, registration);
GetRegisteredType(field.OwningType);
return registration;
}
示例13: FieldForInstantiatedType
internal FieldForInstantiatedType(FieldDesc fieldDef, InstantiatedType instantiatedType)
{
_fieldDef = fieldDef;
_instantiatedType = instantiatedType;
}
示例14: AddFieldReference
private void AddFieldReference(FieldDesc field)
{
if (field.IsStatic)
{
var owningType = (MetadataType)field.OwningType;
Object node;
if (field.IsThreadStatic)
{
node = _nodeFactory.TypeThreadStaticsSymbol(owningType);
}
else
{
if (field.HasGCStaticBase)
node = _nodeFactory.TypeGCStaticsSymbol(owningType);
else
node = _nodeFactory.TypeNonGCStaticsSymbol(owningType);
}
// TODO: Remove once the depedencies for static fields are tracked properly
_writer.GetCppSignatureTypeName(owningType);
_dependencies.Add(node);
}
}
示例15: GeneratesMetadata
public bool GeneratesMetadata(FieldDesc fieldDef)
{
if (_fieldGeneratesMetadata != null)
return _fieldGeneratesMetadata(fieldDef);
return false;
}