GetFields() public method

public GetFields ( ) : Mono.Debugger.Soft.FieldInfoMirror[]
return Mono.Debugger.Soft.FieldInfoMirror[]
Beispiel #1
0
        internal static CustomAttributeDataMirror[] Create(VirtualMachine vm, CattrInfo[] info)
        {
            var res = new CustomAttributeDataMirror [info.Length];

            for (int i = 0; i < info.Length; ++i)
            {
                CattrInfo    attr      = info [i];
                MethodMirror ctor      = vm.GetMethod(attr.ctor_id);
                var          ctor_args = new object [attr.ctor_args.Length];
                for (int j = 0; j < ctor_args.Length; ++j)
                {
                    ctor_args [j] = CreateArg(vm, attr.ctor_args [j]);
                }
                var named_args = new List <object> (attr.named_args.Length);
                for (int j = 0; j < attr.named_args.Length; ++j)
                {
                    CattrNamedArgInfo arg = attr.named_args [j];
                    CustomAttributeTypedArgumentMirror val;
                    CustomAttributeNamedArgumentMirror?named_arg = null;

                    val = CreateArg(vm, arg.value);

                    TypeMirror t = ctor.DeclaringType;
                    while (named_arg == null && t != null)
                    {
                        if (arg.is_property)
                        {
                            foreach (var prop in t.GetProperties())
                            {
                                if (prop.Id == arg.id)
                                {
                                    named_arg = new CustomAttributeNamedArgumentMirror(prop, null, val);
                                }
                            }
                        }
                        else if (vm.Version.AtLeast(2, 12))                              // we don't have the field ID before 2.12
                        {
                            foreach (var field in t.GetFields())
                            {
                                if (field.Id == arg.id)
                                {
                                    named_arg = new CustomAttributeNamedArgumentMirror(null, field, val);
                                }
                            }
                        }
                        t = t.BaseType;
                    }

                    if (named_arg.HasValue)
                    {
                        named_args.Add(named_arg.Value);
                    }
                }
                res [i] = new CustomAttributeDataMirror(ctor, ctor_args, named_args.ToArray());
            }

            return(res);
        }
        internal static CustomAttributeDataMirror[] Create(VirtualMachine vm, CattrInfo[] info)
        {
            var res = new CustomAttributeDataMirror [info.Length];

            for (int i = 0; i < info.Length; ++i)
            {
                CattrInfo    attr      = info [i];
                MethodMirror ctor      = vm.GetMethod(attr.ctor_id);
                var          ctor_args = new object [attr.ctor_args.Length];
                for (int j = 0; j < ctor_args.Length; ++j)
                {
                    ctor_args [j] = CreateArg(vm, attr.ctor_args [j]);
                }
                var named_args = new object [attr.named_args.Length];
                for (int j = 0; j < named_args.Length; ++j)
                {
                    CattrNamedArgInfo arg = attr.named_args [j];
                    CustomAttributeTypedArgumentMirror val;

                    val = CreateArg(vm, arg.value);

                    TypeMirror t = ctor.DeclaringType;
                    while (named_args [j] == null && t != null)
                    {
                        if (arg.is_property)
                        {
                            foreach (var prop in t.GetProperties())
                            {
                                if (prop.Id == arg.id)
                                {
                                    named_args [j] = new CustomAttributeNamedArgumentMirror(prop, null, val);
                                }
                            }
                        }
                        else
                        {
                            foreach (var field in t.GetFields())
                            {
                                if (field.Id == arg.id)
                                {
                                    named_args [j] = new CustomAttributeNamedArgumentMirror(null, field, val);
                                }
                            }
                        }
                        t = t.BaseType;
                    }
                    if (named_args [j] == null)
                    {
                        throw new NotImplementedException();
                    }
                }
                res [i] = new CustomAttributeDataMirror(ctor, ctor_args, named_args);
            }

            return(res);
        }
 public ExpandedProperty(TypeMirror typeMirror, StackFrame frame, LocalVariable localVariable)
 {
     this.frame = frame;
     this.localVariable = localVariable;
     var properties = typeMirror.GetProperties().Cast<Mirror>();
     var methods = typeMirror.GetMethods().Cast<Mirror>();
     var fields = typeMirror.GetFields().Cast<Mirror>();
     var children = properties.Concat(methods).Concat(fields);
     allProperties = children.ToList();
 }