Mono.Debugger.Languages.TargetStructType.GetParentType C# (CSharp) Method

GetParentType() abstract private method

abstract private GetParentType ( TargetMemoryAccess target ) : TargetClassType
target TargetMemoryAccess
return TargetClassType
        internal abstract TargetClassType GetParentType(TargetMemoryAccess target);

Same methods

TargetStructType::GetParentType ( System.Thread thread ) : TargetClassType

Usage Example

Example #1
0
        public static MemberExpression FindMember(Thread target, TargetStructType stype,
							   TargetStructObject instance, string name,
							   bool search_static, bool search_instance)
        {
            again:
            TargetClass klass = stype.GetClass (target);
            if (klass != null) {
                TargetMemberInfo member = klass.FindMember (
                    target, name, search_static, search_instance);
                if (member != null)
                    return new StructAccessExpression (stype, instance, member);

                ArrayList methods = new ArrayList ();
                bool is_instance = false;
                bool is_static = false;

                TargetMethodInfo[] klass_methods = klass.GetMethods (target);
                if (klass_methods != null) {
                    foreach (TargetMethodInfo method in klass_methods) {
                        if (method.IsStatic && !search_static)
                            continue;
                        if (!method.IsStatic && !search_instance)
                            continue;
                        if (method.Name != name)
                            continue;

                        methods.Add (method.Type);
                        if (method.IsStatic)
                            is_static = true;
                        else
                            is_instance = true;
                    }
                }

                if (methods.Count > 0) {
                    TargetFunctionType[] funcs = new TargetFunctionType [methods.Count];
                    methods.CopyTo (funcs, 0);
                    return new MethodGroupExpression (
                        stype, instance, name, funcs, is_instance, is_static);
                }
            }

            TargetClassType ctype = stype as TargetClassType;
            if (ctype != null) {
                TargetMemberInfo member = ctype.FindMember (
                    name, search_static, search_instance);

                if (member != null)
                    return new StructAccessExpression (ctype, instance, member);

                ArrayList methods = new ArrayList ();
                bool is_instance = false;
                bool is_static = false;

                if (name == ".ctor") {
                    foreach (TargetMethodInfo method in ctype.Constructors) {
                        if (method.IsStatic)
                            continue;
                        methods.Add (method.Type);
                        is_instance = true;
                    }
                } else if (name == ".cctor") {
                    foreach (TargetMethodInfo method in ctype.Constructors) {
                        if (!method.IsStatic)
                            continue;
                        methods.Add (method.Type);
                        is_static = true;
                    }
                } else {
                    foreach (TargetMethodInfo method in ctype.Methods) {
                        if (method.IsStatic && !search_static)
                            continue;
                        if (!method.IsStatic && !search_instance)
                            continue;
                        if (method.Name != name)
                            continue;

                        methods.Add (method.Type);
                        if (method.IsStatic)
                            is_static = true;
                        else
                            is_instance = true;
                    }
                }

                if (methods.Count > 0) {
                    TargetFunctionType[] funcs = new TargetFunctionType [methods.Count];
                    methods.CopyTo (funcs, 0);
                    return new MethodGroupExpression (
                        ctype, instance, name, funcs, is_instance, is_static);
                }
            }

            if (stype.HasParent) {
                stype = stype.GetParentType (target);
                if (instance != null) {
                    instance = instance.GetParentObject (target);
                    if (instance == null)
                        return null;
                }
                goto again;
            }

            return null;
        }
All Usage Examples Of Mono.Debugger.Languages.TargetStructType::GetParentType