public FieldInfoMirror (TypeMirror parent, long id, string name, TypeMirror type, FieldAttributes attrs) : base (parent.VirtualMachine, id) { this.parent = parent; this.name = name; this.type = type; this.attrs = attrs; inited = true; }
public FieldDefinition(string name, TypeReference fieldType, FieldAttributes attrs) : base(name, fieldType) { m_hasInfo = false; m_attributes = attrs; }
public FieldWeaver(TypeBuilder typeBuilder, Type type, string fieldName = null, FieldAttributes? fieldAttributes = null) { FieldType = type; this.fieldName = fieldName; this.typeBuilder = typeBuilder; this.fieldAttributes = fieldAttributes ?? FieldAttributes.Private; }
public FieldKey(TypeKey typeKey, string type, string name, FieldAttributes fieldAttributes) { this.typeKey = typeKey; this.type = type; this.name = name; this.fieldAttributes = fieldAttributes; }
protected override JSVariableField CreateField(String name, FieldAttributes attributeFlags, Object value){ if (!(this.parent is ActivationObject)) return base.CreateField(name, attributeFlags, value); JSVariableField field = ((ActivationObject)this.parent).AddNewField(name+":"+this.scopeId, value, attributeFlags); field.debuggerName = name; return field; }
internal virtual JSVariableField AddNewField(string name, object value, FieldAttributes attributeFlags) { JSVariableField field = this.CreateField(name, attributeFlags, value); this.name_table[name] = field; this.field_table.Add(field); return field; }
public virtual void DefineGlobalVariable (String name, FieldAttributes attributes, byte[] signature, SymAddressKind addrKind, int addr1, int addr2, int addr3) { throw new NotSupportedException(); }
void RenderFieldAttributes (FieldAttributes source, FieldAttributes target, ApiChange change) { // the visibility values are the same for MethodAttributes and FieldAttributes, so just use the same method. RenderVisibility ((MethodAttributes) source, (MethodAttributes) target, change); // same for the static flag RenderStatic ((MethodAttributes) source, (MethodAttributes) target, change); var srcLiteral = (source & FieldAttributes.Literal) != 0; var tgtLiteral = (target & FieldAttributes.Literal) != 0; if (srcLiteral) { if (tgtLiteral) { change.Append ("const "); } else { change.AppendRemoved ("const", true).Append (" "); } } else if (tgtLiteral) { change.AppendAdded ("const", true).Append (" "); } var srcInitOnly = (source & FieldAttributes.InitOnly) != 0; var tgtInitOnly = (target & FieldAttributes.InitOnly) != 0; if (srcInitOnly) { if (tgtInitOnly) { change.Append ("readonly "); } else { change.AppendRemoved ("readonly", false).Append (" "); } } else if (tgtInitOnly) { change.AppendAdded ("readonly", true).Append (" "); } }
public void DefineUninitalizedData_CreateGlobalFunctionsAlreadyCalled_ThrowsInvalidOperationException(FieldAttributes attributes) { ModuleBuilder module = Helpers.DynamicModule(); module.CreateGlobalFunctions(); Assert.Throws<InvalidOperationException>(() => module.DefineUninitializedData("TestField", 1, attributes)); }
internal FieldBuilder(TypeBuilder typeBuilder, string fieldName, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes) { int num; if (fieldName == null) { throw new ArgumentNullException("fieldName"); } if (fieldName.Length == 0) { throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "fieldName"); } if (fieldName[0] == '\0') { throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), "fieldName"); } if (type == null) { throw new ArgumentNullException("type"); } if (type == typeof(void)) { throw new ArgumentException(Environment.GetResourceString("Argument_BadFieldType")); } this.m_fieldName = fieldName; this.m_typeBuilder = typeBuilder; this.m_fieldType = type; this.m_Attributes = attributes & ~FieldAttributes.ReservedMask; SignatureHelper fieldSigHelper = SignatureHelper.GetFieldSigHelper(this.m_typeBuilder.Module); fieldSigHelper.AddArgument(type, requiredCustomModifiers, optionalCustomModifiers); byte[] signature = fieldSigHelper.InternalGetSignature(out num); this.m_fieldTok = TypeBuilder.DefineField(this.m_typeBuilder.GetModuleBuilder().GetNativeHandle(), typeBuilder.TypeToken.Token, fieldName, signature, num, this.m_Attributes); this.m_tkField = new FieldToken(this.m_fieldTok, type); }
internal FieldBuilder(TypeBuilder typeBuilder, String fieldName, Type type, FieldAttributes attributes) { if (fieldName==null) throw new ArgumentNullException("fieldName"); if (fieldName.Length == 0) throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "fieldName"); if (fieldName[0] == '\0') throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), "fieldName"); if (type==null) throw new ArgumentNullException("type"); if (type == SystemVoid) throw new ArgumentException(Environment.GetResourceString("Argument_BadFieldType")); m_fieldName = fieldName; m_typeBuilder = typeBuilder; m_fieldType = type; m_Attributes = attributes; SignatureHelper sigHelp = SignatureHelper.GetFieldSigHelper(m_typeBuilder.Module); sigHelp.AddArgument(type); int sigLength; byte[] signature = sigHelp.InternalGetSignature(out sigLength); m_tkField = new FieldToken(TypeBuilder.InternalDefineField( typeBuilder.TypeToken.Token, fieldName, signature, sigLength, attributes, m_typeBuilder.Module), type); }
internal EnumDeclaration(Context context, IdentifierLiteral id, TypeExpression baseType, Block body, FieldAttributes attributes, CustomAttributeList customAttributes) : base(context, id, new TypeExpression(new ConstantWrapper(Typeob.Enum, null)), new TypeExpression[0], body, attributes, false, false, true, false, customAttributes) { this.baseType = (baseType != null) ? baseType : new TypeExpression(new ConstantWrapper(Typeob.Int32, null)); base.needsEngine = false; base.attributes &= TypeAttributes.NestedFamORAssem; TypeExpression expression = new TypeExpression(new ConstantWrapper(base.classob, base.context)); AST ast = new ConstantWrapper(-1, null); AST ast2 = new ConstantWrapper(1, null); JSMemberField[] fields = base.fields; for (int i = 0; i < fields.Length; i++) { FieldInfo info = fields[i]; JSVariableField field = (JSVariableField) info; field.attributeFlags = FieldAttributes.Literal | FieldAttributes.Static | FieldAttributes.Public; field.type = expression; if (field.value == null) { field.value = ast = new Plus(ast.context, ast, ast2); } else { ast = (AST) field.value; } field.value = new DeclaredEnumValue(field.value, field.Name, base.classob); } }
[System.Security.SecurityCritical] // auto-generated internal FieldBuilder(TypeBuilder typeBuilder, String fieldName, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes) { if (fieldName == null) throw new ArgumentNullException("fieldName"); if (fieldName.Length == 0) throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "fieldName"); if (fieldName[0] == '\0') throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), "fieldName"); if (type == null) throw new ArgumentNullException("type"); if (type == typeof(void)) throw new ArgumentException(Environment.GetResourceString("Argument_BadFieldType")); Contract.EndContractBlock(); m_fieldName = fieldName; m_typeBuilder = typeBuilder; m_fieldType = type; m_Attributes = attributes & ~FieldAttributes.ReservedMask; SignatureHelper sigHelp = SignatureHelper.GetFieldSigHelper(m_typeBuilder.Module); sigHelp.AddArgument(type, requiredCustomModifiers, optionalCustomModifiers); int sigLength; byte[] signature = sigHelp.InternalGetSignature(out sigLength); m_fieldTok = TypeBuilder.DefineField(m_typeBuilder.GetModuleBuilder().GetNativeHandle(), typeBuilder.TypeToken.Token, fieldName, signature, sigLength, m_Attributes); m_tkField = new FieldToken(m_fieldTok, type); }
internal JSMemberField AddOverload(FunctionObject func, FieldAttributes attributeFlags){ JSMemberField last = this; while (last.nextOverload != null) last = last.nextOverload; JSMemberField f = last.nextOverload = new JSMemberField((ClassScope)this.obj, this.Name, func, attributeFlags); f.type = this.type; return f; }
internal JSWithField(string name, FieldAttributes attributes) : base(name, null, attributes) { // with-fields cannot be crunced because they might // need to reference a property on the with object CanCrunch = false; }
public virtual void DefineLocalVariable (String name, FieldAttributes attributes, byte[] signature, SymAddressKind addrKind, int addr1, int addr2, int addr3, int startOffset, int endOffset) { // Nothing to do here. }
public void DefineUnitializedData_InvalidSize_ThrowsArgumentException(FieldAttributes attributes) { ModuleBuilder module = Helpers.DynamicModule(); foreach (int size in new int[] { -1, 0, 0x003f0000, 0x003f0000 + 1 }) { Assert.Throws<ArgumentException>(null, () => module.DefineUninitializedData("TestField", size, attributes)); } }
/// <summary> /// Initializes a new instance of the <see cref="CilRuntimeField"/> class. /// </summary> /// <param name="module">The module.</param> /// <param name="name">The name.</param> /// <param name="signature">The signature.</param> /// <param name="token">The token.</param> /// <param name="offset">The offset.</param> /// <param name="rva">The rva.</param> /// <param name="declaringType">Type of the declaring.</param> /// <param name="attributes">The attributes.</param> public CilRuntimeField(ITypeModule module, string name, FieldSignature signature, Token token, uint offset, uint rva, RuntimeType declaringType, FieldAttributes attributes) : base(module, token, declaringType) { this.Name = name; this.Signature = signature; base.Attributes = attributes; base.RVA = rva; }
public void __SetDataAndRVA(byte[] data) { attribs |= FieldAttributes.HasFieldRVA; FieldRVATable.Record rec = new FieldRVATable.Record(); rec.RVA = typeBuilder.ModuleBuilder.initializedData.Position; rec.Field = pseudoToken; typeBuilder.ModuleBuilder.FieldRVA.AddRecord(rec); typeBuilder.ModuleBuilder.initializedData.Write(data); }
public FieldMetadata( string name, Type fieldType, FieldAttributes fieldAttributes) : base(name) { _fieldType = fieldType; _fieldAttributes = fieldAttributes; }
public virtual void DefineField (SymbolToken parent, String name, FieldAttributes attributes, byte[] signature, SymAddressKind addrKind, int addr1, int addr2, int addr3) { throw new NotSupportedException(); }
public void TestWithStaticAndPublic(FieldAttributes attributes) { ModuleBuilder module = Helpers.DynamicModule(); FieldBuilder field = module.DefineInitializedData("MyField", new byte[] { 01, 00, 01 }, attributes); Assert.True(field.IsStatic); Assert.Equal((attributes & FieldAttributes.Public) != 0 , field.IsPublic); Assert.Equal((attributes & FieldAttributes.Private) != 0, field.IsPrivate); Assert.Equal(field.Name, "MyField"); }
public FieldStructure(string name, FieldAttributes attr, TypeStructure dt, object def, bool isEnumField, FieldInfo info = null) { Name = name; Attributes = attr; DataType = dt; DefaultValue = def; IsEnumField = isEnumField; Info = info; }
void GetInfo () { if (inited) return; var info = vm.conn.Field_GetInfo (id); name = info.Name; parent = vm.GetType (info.Parent); type = vm.GetType (info.TypeId); attrs = (FieldAttributes)info.Attrs; inited = true; }
private void SetDataAndRvaImpl(byte[] data, ByteBuffer bb, int readonlyMarker) { attribs |= FieldAttributes.HasFieldRVA; FieldRVATable.Record rec = new FieldRVATable.Record(); bb.Align(8); rec.RVA = bb.Position + readonlyMarker; rec.Field = pseudoToken; typeBuilder.ModuleBuilder.FieldRVA.AddRecord(rec); bb.Write(data); }
internal FieldGen(TypeGen owner, string name, Type type, FieldAttributes attrs) { _owner = owner; _attrs = attrs; Name = name; _type = type; _fb = owner.TypeBuilder.DefineField(name, type, attrs); owner.RegisterForCompletion(this); }
public JsVariableField(JsFieldType fieldType, string name, FieldAttributes fieldAttributes, object value) { m_referenceTable = new HashSet<IJsNameReference>(); m_declarationTable = new HashSet<IJsNameDeclaration>(); Name = name; Attributes = fieldAttributes; FieldValue = value; SetFieldsBasedOnType(fieldType); }
internal JSVariableField AddNewField(String name, FieldAttributes attributeFlags, FunctionObject func){ if (this.nested_functions == null){ this.nested_functions = new ArrayList(); this.fields_for_nested_functions = new ArrayList(); } this.nested_functions.Add(func); JSVariableField result = this.AddNewField(name, (Object)func, attributeFlags); this.fields_for_nested_functions.Add(result); return result; }
public CorFieldInfo(CorType ownerType, uint token, string name, TypeSig fieldType, FieldAttributes attrs, object constant, CorElementType constantType, DebuggerBrowsableState? debuggerBrowsableState, bool compilerGeneratedAttribute) { this.OwnerType = ownerType; this.Token = token; this.Name = name; this.FieldType = fieldType; this.Attributes = attrs; this.Constant = constant; this.ConstantType = constantType; this.DebuggerBrowsableState = debuggerBrowsableState; this.CompilerGeneratedAttribute = compilerGeneratedAttribute; }
/// <summary> /// Constructor /// </summary> /// <param name="TypeBuilder">Type builder</param> /// <param name="Name">Name of the method</param> /// <param name="Attributes">Attributes for the field (public, private, etc.)</param> /// <param name="FieldType">Type for the field</param> public FieldBuilder(TypeBuilder TypeBuilder, string Name, Type FieldType, FieldAttributes Attributes) : base() { Contract.Requires<ArgumentNullException>(TypeBuilder!=null,"TypeBuilder"); Contract.Requires<ArgumentNullException>(!string.IsNullOrEmpty(Name),"Name"); this.Name = Name; this.Type = TypeBuilder; this.DataType = FieldType; this.Attributes = Attributes; Builder = Type.Builder.DefineField(Name, FieldType, Attributes); }
public void DefineUnitializedData_NullName_ThrowsArgumentNullException(FieldAttributes attributes) { ModuleBuilder module = Helpers.DynamicModule(); AssertExtensions.Throws <ArgumentNullException>("name", () => module.DefineUninitializedData(null, 1, attributes)); }
public FieldBuilder __DefineField(string fieldName, Type type, CustomModifiers customModifiers, FieldAttributes attributes) { FieldBuilder fb = new FieldBuilder(this, fieldName, type, customModifiers, attributes); fields.Add(fb); return(fb); }
public CorFieldInfo(CorType ownerType, uint token, string name, TypeSig fieldType, FieldAttributes attrs, object constant, CorElementType constantType, DebuggerBrowsableState?debuggerBrowsableState, bool compilerGeneratedAttribute) { this.OwnerType = ownerType; this.Token = token; this.Name = name; this.FieldType = fieldType; this.Attributes = attrs; this.Constant = constant; this.ConstantType = constantType; this.DebuggerBrowsableState = debuggerBrowsableState; this.CompilerGeneratedAttribute = compilerGeneratedAttribute; }
static bool IsVisible(FieldAttributes att) { return(((att & FieldAttributes.Public) == FieldAttributes.Public) || ((att & FieldAttributes.Family) == FieldAttributes.Family) || ((att & FieldAttributes.FamORAssem) == FieldAttributes.FamORAssem)); }
public FieldBuilder DefineField(string name, Type fieldType, FieldAttributes attribs) { return(DefineField(name, fieldType, null, null, attribs)); }
internal FieldBuilder(TypeBuilder typeBuilder, string fieldName, Type type, Type[]?requiredCustomModifiers, Type[]?optionalCustomModifiers, FieldAttributes attributes) { if (fieldName == null) { throw new ArgumentNullException(nameof(fieldName)); } if (fieldName.Length == 0) { throw new ArgumentException(SR.Argument_EmptyName, nameof(fieldName)); } if (fieldName[0] == '\0') { throw new ArgumentException(SR.Argument_IllegalName, nameof(fieldName)); } if (type == null) { throw new ArgumentNullException(nameof(type)); } if (type == typeof(void)) { throw new ArgumentException(SR.Argument_BadFieldType); } m_fieldName = fieldName; m_typeBuilder = typeBuilder; m_fieldType = type; m_Attributes = attributes & ~FieldAttributes.ReservedMask; SignatureHelper sigHelp = SignatureHelper.GetFieldSigHelper(m_typeBuilder.Module); sigHelp.AddArgument(type, requiredCustomModifiers, optionalCustomModifiers); byte[] signature = sigHelp.InternalGetSignature(out int sigLength); ModuleBuilder module = m_typeBuilder.GetModuleBuilder(); m_fieldTok = TypeBuilder.DefineField(new QCallModule(ref module), typeBuilder.TypeToken, fieldName, signature, sigLength, m_Attributes); }
public FieldDefinition(string name, FieldAttributes attributes, TypeReference fieldType) : base(name, fieldType) { this.attributes = (ushort)attributes; }
bool GetFlagValue(FieldAttributes flag) => (Attributes & flag) != 0;
public FieldBuilder DefineUninitializedData(string name, int size, FieldAttributes attributes) { return(DefineInitializedData(name, new byte[size], attributes)); }
public static StringBuilder AppendFieldAttributes(StringBuilder sb, FieldAttributes attributes, bool all = true) { string visibility; switch (attributes & FieldAttributes.FieldAccessMask) { case FieldAttributes.PrivateScope: visibility = "privatescope"; break; case FieldAttributes.Private: visibility = "private"; break; case FieldAttributes.FamANDAssem: visibility = "famandassem"; break; case FieldAttributes.Assembly: visibility = "assembly"; break; case FieldAttributes.Family: visibility = "family"; break; case FieldAttributes.FamORAssem: visibility = "famorassem"; break; case FieldAttributes.Public: visibility = "public"; break; default: throw new InvalidOperationException(); } sb.Append(visibility); sb.Append((attributes & FieldAttributes.Static) != 0 ? " static" : " instance"); if ((attributes & FieldAttributes.InitOnly) != 0) { sb.Append(" initonly"); } if ((attributes & FieldAttributes.Literal) != 0) { sb.Append(" literal"); } if ((attributes & FieldAttributes.NotSerialized) != 0) { sb.Append(" notserialized"); } if ((attributes & FieldAttributes.SpecialName) != 0) { sb.Append(" specialname"); } if ((attributes & FieldAttributes.RTSpecialName) != 0) { sb.Append(" rtspecialname"); } if (all) { if ((attributes & FieldAttributes.PinvokeImpl) != 0) { sb.Append(" pinvokeimpl"); } if ((attributes & FieldAttributes.HasFieldMarshal) != 0) { sb.Append(" marshal"); } if ((attributes & FieldAttributes.HasDefault) != 0) { sb.Append(" default"); } if ((attributes & FieldAttributes.HasFieldRVA) != 0) { sb.Append(" rva"); } } return(sb); }
public static FieldDefinition InjectFieldDefinition(TypeDefinition tdef, string name, TypeReference fieldType, FieldAttributes attributes) { var fdef = new FieldDefinition(name, attributes, fieldType); tdef.Fields.Add(fdef); return(fdef); }
private void PosTest(FieldInfo fi, FieldAttributes expected, string id) { FieldAttributes actual = fi.Attributes; Assert.Equal(expected, actual); }
public static bool HasFlag(this FieldDefinition fieldDefinition, FieldAttributes attribute) => (fieldDefinition.Attributes & attribute) == attribute;
internal void SetRVAData(byte[] data) { attrs = attrs | FieldAttributes.HasFieldRVA; rva_data = (byte[])data.Clone(); }
static public FieldDefinition Field <T>(this TypeDefinition type, string name, FieldAttributes attributes, T constant) { var _field = new FieldDefinition(name, attributes | FieldAttributes.Literal, type.Module.Import(typeof(T))); _field.Constant = constant; type.Fields.Add(_field); _field.Attribute <CompilerGeneratedAttribute>(); _field.Attribute(() => new DebuggerBrowsableAttribute(DebuggerBrowsableState.Never)); return(_field); }
public FieldDefinitionProjection(FieldDefinition field, FieldDefinitionTreatment treatment) { Attributes = field.Attributes; Treatment = treatment; }
public FieldBuilder DefineUninitializedData(string name, int size, FieldAttributes attributes) { return(DefineDataImpl(name, size, attributes & ~FieldAttributes.ReservedMask)); }
/// <summary> /// 生成代理类型的字段 /// </summary> /// <param name="typeBuilder">类型生成器</param> /// <param name="fieldName">字段名称</param> /// <param name="type">字段类型</param> /// <returns></returns> private static FieldBuilder BuildField(this TypeBuilder typeBuilder, string fieldName, Type type) { const FieldAttributes filedAttribute = FieldAttributes.Private | FieldAttributes.InitOnly; return(typeBuilder.DefineField(fieldName, type, filedAttribute)); }
public static FieldBuilder DefineField <T>(this TypeBuilder @this, string fieldName, FieldAttributes attributes) { return(@this.DefineField(fieldName, typeof(T), attributes)); }
/// <summary> /// Initializes a new instance of the <see cref="ByteFieldMetadata"/> class. /// </summary> /// <param name="fieldName">Name of the field.</param> /// <param name="minValue">The minimum value.</param> /// <param name="maxValue">The maximum value.</param> /// <param name="attributes">Additional attributes of the field.</param> public ByteFieldMetadata(string fieldName, byte minValue, byte maxValue, FieldAttributes attributes = FieldAttributes.None) : base(fieldName, minValue, maxValue, attributes) { }
public void DefineUninitalizedData_CreateGlobalFunctionsAlreadyCalled_ThrowsInvalidOperationException(FieldAttributes attributes) { ModuleBuilder module = Helpers.DynamicModule(); module.CreateGlobalFunctions(); Assert.Throws <InvalidOperationException>(() => module.DefineUninitializedData("TestField", 1, attributes)); }
// Create a new field within this scope. protected override JSVariableField CreateField (String name, FieldAttributes attributes, Object value) { return(base.CreateField(name, attributes, value)); }
public FieldBuilder DefineField(string fieldName, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes) { FieldBuilder fb = new FieldBuilder(this, fieldName, type, requiredCustomModifiers, optionalCustomModifiers, attributes); fields.Add(fb); return(fb); }
/// <summary> /// Parses property name used for serialization. /// </summary> /// <param name="name">The name found in serialization stream or returned by <B>__sleep</B>.</param> /// <param name="typeName">Will receive the name of the declaring type or <B>null</B> if no /// type information is embedded in the property <paramref name="name"/>.</param> /// <param name="visibility">Will receive the assumed visibility of the property.</param> /// <returns>The bare (unmangled) property name.</returns> /// <remarks> /// Names of protected properties might be prepended with \0*\0, names of private properties might be /// prepended with \0declaring_class_name\0 /// (see <A href="http://bugs.php.net/bug.php?id=26737">http://bugs.php.net/bug.php?id=26737</A>) /// </remarks> public static string /*!*/ ParseSerializedPropertyName(string /*!*/ name, out string typeName, out FieldAttributes visibility) { if (name.Length >= 3 && name[0] == '\0') { if (name[1] == '*' && name[2] == '\0') { // probably a protected field visibility = FieldAttributes.Family; typeName = null; return(name.Substring(3)); } else { // probably a private property int index = name.IndexOf('\0', 2); if (index > 0) { visibility = FieldAttributes.Private; typeName = name.Substring(1, index - 1); // TODO return(name.Substring(index + 1)); } } } visibility = FieldAttributes.Public; typeName = null; return(name); }
/// <summary> /// Constructs a new foreign key field metadata. /// </summary> /// <param name="fieldName">The foreign key field.</param> /// <param name="relatedField">The metadata describing the related field.</param> /// <param name="attributes">Additional attributes of the field.</param> public ForeignKeyFieldMetadata(string fieldName, FieldMetadata relatedField, FieldAttributes attributes = FieldAttributes.None) : base(fieldName, (relatedField is IntegerFieldMetadata) ? ((IntegerFieldMetadata)relatedField).MinimumValue : 0, (relatedField is IntegerFieldMetadata) ? ((IntegerFieldMetadata)relatedField).MaximumValue : Int32.MaxValue, attributes) { RelatedField = relatedField; }
public override JsVariableField CreateField(string name, object value, FieldAttributes attributes) { return(new JsVariableField(JsFieldType.WithField, name, attributes, null)); }
public void GetFieldDefProps(int mdToken, out FieldAttributes fieldAttributes) { _GetFieldDefProps(m_metadataImport2, mdToken, out int _fieldAttributes); fieldAttributes = (FieldAttributes)_fieldAttributes; }
internal static extern void SetValue(RtFieldInfo field, object obj, object value, RuntimeType fieldType, FieldAttributes fieldAttr, RuntimeType declaringType, ref bool domainInitialized);
// FilterAttribute // This method will search for a member based upon the attribute passed in. // filterCriteria -- an Int32 representing the attribute internal virtual bool FilterAttribute(MemberInfo m, Object filterCriteria) { // Check that the criteria object is an Integer object if (filterCriteria == null) { throw new InvalidFilterCriteriaException(Environment.GetResourceString("RFLCT.FltCritInt")); } switch (m.MemberType) { case MemberTypes.Constructor: case MemberTypes.Method: { MethodAttributes criteria = 0; try { int i = (int)filterCriteria; criteria = (MethodAttributes)i; } catch { throw new InvalidFilterCriteriaException(Environment.GetResourceString("RFLCT.FltCritInt")); } MethodAttributes attr; if (m.MemberType == MemberTypes.Method) { attr = ((MethodInfo)m).Attributes; } else { attr = ((ConstructorInfo)m).Attributes; } if (((criteria & MethodAttributes.MemberAccessMask) != 0) && (attr & MethodAttributes.MemberAccessMask) != (criteria & MethodAttributes.MemberAccessMask)) { return(false); } if (((criteria & MethodAttributes.Static) != 0) && (attr & MethodAttributes.Static) == 0) { return(false); } if (((criteria & MethodAttributes.Final) != 0) && (attr & MethodAttributes.Final) == 0) { return(false); } if (((criteria & MethodAttributes.Virtual) != 0) && (attr & MethodAttributes.Virtual) == 0) { return(false); } if (((criteria & MethodAttributes.Abstract) != 0) && (attr & MethodAttributes.Abstract) == 0) { return(false); } if (((criteria & MethodAttributes.SpecialName) != 0) && (attr & MethodAttributes.SpecialName) == 0) { return(false); } return(true); } case MemberTypes.Field: { FieldAttributes criteria = 0; try { int i = (int)filterCriteria; criteria = (FieldAttributes)i; } catch { throw new InvalidFilterCriteriaException(Environment.GetResourceString("RFLCT.FltCritInt")); } FieldAttributes attr = ((FieldInfo)m).Attributes; if (((criteria & FieldAttributes.FieldAccessMask) != 0) && (attr & FieldAttributes.FieldAccessMask) != (criteria & FieldAttributes.FieldAccessMask)) { return(false); } if (((criteria & FieldAttributes.Static) != 0) && (attr & FieldAttributes.Static) == 0) { return(false); } if (((criteria & FieldAttributes.InitOnly) != 0) && (attr & FieldAttributes.InitOnly) == 0) { return(false); } if (((criteria & FieldAttributes.Literal) != 0) && (attr & FieldAttributes.Literal) == 0) { return(false); } if (((criteria & FieldAttributes.NotSerialized) != 0) && (attr & FieldAttributes.NotSerialized) == 0) { return(false); } if (((criteria & FieldAttributes.PinvokeImpl) != 0) && (attr & FieldAttributes.PinvokeImpl) == 0) { return(false); } return(true); } } return(false); }
public FieldBuilder DefineField(string fieldName, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes) { return(__DefineField(fieldName, type, CustomModifiers.FromReqOpt(requiredCustomModifiers, optionalCustomModifiers), attributes)); }