コード例 #1
0
ファイル: Missing.cs プロジェクト: Semogj/ikvm-fork
		private FieldInfo TryGetForwarder()
		{
			if (forwarder == null && !declaringType.__IsMissing)
			{
				forwarder = declaringType.FindField(name, signature);
			}
			return forwarder;
		}
コード例 #2
0
		internal GenericFieldInstance(Type declaringType, FieldInfo field)
		{
			this.declaringType = declaringType;
			this.field = field;
		}
コード例 #3
0
ファイル: AotTypeWrapper.cs プロジェクト: T0pp3r/ikvm-fork
 protected override TypeBuilder DefineGhostType(string mangledTypeName, TypeAttributes typeAttribs)
 {
     typeAttribs &= ~(TypeAttributes.Interface | TypeAttributes.Abstract);
     typeAttribs |= TypeAttributes.Class | TypeAttributes.Sealed;
     TypeBuilder typeBuilder = classLoader.GetTypeWrapperFactory().ModuleBuilder.DefineType(mangledTypeName, typeAttribs, Types.ValueType);
     AttributeHelper.SetGhostInterface(typeBuilder);
     AttributeHelper.SetModifiers(typeBuilder, Modifiers, IsInternal);
     ghostRefField = typeBuilder.DefineField("__<ref>", Types.Object, FieldAttributes.Public | FieldAttributes.SpecialName);
     typeBuilderGhostInterface = typeBuilder.DefineNestedType("__Interface", TypeAttributes.Interface | TypeAttributes.Abstract | TypeAttributes.NestedPublic);
     AttributeHelper.HideFromJava(typeBuilderGhostInterface);
     ghostIsInstanceMethod = typeBuilder.DefineMethod("IsInstance", MethodAttributes.HideBySig | MethodAttributes.Public | MethodAttributes.Static, Types.Boolean, new Type[] { Types.Object });
     ghostIsInstanceMethod.DefineParameter(1, ParameterAttributes.None, "obj");
     ghostIsInstanceArrayMethod = typeBuilder.DefineMethod("IsInstanceArray", MethodAttributes.HideBySig | MethodAttributes.Public | MethodAttributes.Static, Types.Boolean, new Type[] { Types.Object, Types.Int32 });
     ghostIsInstanceArrayMethod.DefineParameter(1, ParameterAttributes.None, "obj");
     ghostIsInstanceArrayMethod.DefineParameter(2, ParameterAttributes.None, "rank");
     ghostCastMethod = typeBuilder.DefineMethod("Cast", MethodAttributes.HideBySig | MethodAttributes.Public | MethodAttributes.Static, typeBuilder, new Type[] { Types.Object });
     ghostCastMethod.DefineParameter(1, ParameterAttributes.None, "obj");
     ghostCastArrayMethod = typeBuilder.DefineMethod("CastArray", MethodAttributes.HideBySig | MethodAttributes.Public | MethodAttributes.Static, Types.Void, new Type[] { Types.Object, Types.Int32 });
     ghostCastArrayMethod.DefineParameter(1, ParameterAttributes.None, "obj");
     ghostCastArrayMethod.DefineParameter(2, ParameterAttributes.None, "rank");
     return typeBuilder;
 }
コード例 #4
0
		public virtual FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo[] match, object value, CultureInfo culture)
		{
			throw new InvalidOperationException();
		}
コード例 #5
0
		internal FieldInfoWithReflectedType(Type reflectedType, FieldInfo field)
		{
			Debug.Assert(reflectedType != field.DeclaringType);
			this.reflectedType = reflectedType;
			this.field = field;
		}
コード例 #6
0
ファイル: IkvmLoader.cs プロジェクト: jlyonsmith/NRefactory
        void AddAttributes(FieldInfo fieldDefinition, IUnresolvedEntity targetEntity)
        {
            // FieldOffsetAttribute
            int fOffset;
            if (fieldDefinition.__TryGetFieldOffset(out fOffset)) {
                var fieldOffset = new DefaultUnresolvedAttribute(fieldOffsetAttributeTypeRef, new[] { KnownTypeReference.Int32 });
                fieldOffset.PositionalArguments.Add(CreateSimpleConstantValue(KnownTypeReference.Int32, fOffset));
                targetEntity.Attributes.Add(interningProvider.Intern(fieldOffset));
            }

            // NonSerializedAttribute
            if (fieldDefinition.IsNotSerialized) {
                targetEntity.Attributes.Add(nonSerializedAttribute);
            }
            FieldMarshal marshal;
            if (fieldDefinition.__TryGetFieldMarshal (out marshal))
                targetEntity.Attributes.Add(ConvertMarshalInfo(marshal));

            AddCustomAttributes(fieldDefinition.CustomAttributes, targetEntity.Attributes);
        }
コード例 #7
0
ファイル: IkvmLoader.cs プロジェクト: jlyonsmith/NRefactory
        public IUnresolvedField ReadField(FieldInfo field, IUnresolvedTypeDefinition parentType)
        {
            if (field == null)
                throw new ArgumentNullException("field");
            if (parentType == null)
                throw new ArgumentNullException("parentType");
            var f = new DefaultUnresolvedField(parentType, field.Name);
            f.Accessibility = GetAccessibility(field.Attributes);
            f.IsReadOnly = field.IsInitOnly;
            f.IsStatic = field.IsStatic;

            f.ReturnType = ReadTypeReference(field.FieldType, typeAttributes: field.CustomAttributes);

            if (field.Attributes.HasFlag (FieldAttributes.HasDefault)) {
                f.ConstantValue = CreateSimpleConstantValue(f.ReturnType, field.GetRawConstantValue ());
            }
            else {
                var decConstant = field.CustomAttributes.FirstOrDefault(a => a.AttributeType.FullName == "System.Runtime.CompilerServices.DecimalConstantAttribute");
                if (decConstant != null) {
                    var constValue = TryDecodeDecimalConstantAttribute(decConstant);
                    if (constValue != null)
                        f.ConstantValue = CreateSimpleConstantValue(f.ReturnType, constValue);
                }
            }
            AddAttributes(field, f);

            if (field.GetRequiredCustomModifiers ().Any (mt => mt.FullName == typeof(IsVolatile).FullName)) {
                f.IsVolatile = true;
            }

            FinishReadMember(f, field);
            return f;
        }
コード例 #8
0
ファイル: Binder.cs プロジェクト: koush/mono
		public abstract FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo[] match, object value, CultureInfo culture);