Пример #1
0
        public DebugMethod(DebugEnvironment envr, CDebugMethodSymbol method, DebugMethodScope scope)
        {
            this.debugEnv      = envr;
            this.methodSymbol  = method;
            this.DeclaringType = method.GetDeclaringType().CompilerType;
            SymbolModifiers modifier = this.methodSymbol.Modifiers;

            if ((modifier & SymbolModifiers.Abstract) != 0)
            {
                this.Flags |= MethodFlags.Abstract;
            }
            if ((modifier & SymbolModifiers.Final) != 0)
            {
                this.Flags |= MethodFlags.Final;
            }
            if ((modifier & SymbolModifiers.Private) != 0)
            {
                this.Flags |= MethodFlags.Private;
            }
            if ((modifier & SymbolModifiers.Public) != 0)
            {
                this.Flags |= MethodFlags.Public;
            }
            if ((modifier & SymbolModifiers.Static) != 0)
            {
                this.Flags |= MethodFlags.Static;
            }

            this.Scope = scope;
            if (this.methodSymbol != null)
            {
                IDebugFieldSymbol thisSymbol = this.methodSymbol.GetThis();
                if (thisSymbol != null)
                {
                    this.ThisParameter = new This(new DebugClassNode(this.debugEnv, thisSymbol.Type, thisSymbol.GetValue(null)));
                }
                ParameterList pList = new ParameterList();
                IEnumSymbol   param = methodSymbol.GetParameters();
                if (param != null)
                {
                    for (int i = 1; ; i++)
                    {
                        if (param.Current == null)
                        {
                            break;
                        }
                        ParameterField paramField = new DebugParameterField(this.debugEnv, param.Current, new Identifier(param.Current.Name), null, scope);
                        paramField.DeclaringType = scope;
                        pList[i] = new Parameter(paramField.Name, paramField.Type);
                        pList[i].ArgumentListIndex = i;
                        param.MoveNext();
                    }
                }
                this.Parameters = pList;
            }
        }
Пример #2
0
        public override MemberList GetMembersNamed(Identifier name)
        {
            MemberList   returnList = new MemberList();
            IDebugSymbol container  = this.debugEnv.context.GetContainer();

            CDebugMethodSymbol methodSymbol = null;

            if ((methodSymbol = container as CDebugMethodSymbol) != null)
            {
                if (name.Name == "this")
                {
                    returnList.Add(new DebugFieldNode(this.debugEnv, methodSymbol.GetThis(), name, null, null, 0));
                }
                else
                {
                    IEnumSymbol param = methodSymbol.GetParameters();
                    if (param != null)
                    {
                        for (int i = 1; ; i++)
                        {
                            if (param.Current == null)
                            {
                                break;
                            }
                            if (param.Current.Name == name.Name)
                            {
                                DebugParameterField paramField = new DebugParameterField(this.debugEnv, param.Current, name, null, this);
                                paramField.DeclaringType = this;
                                paramField.Parameter     = this.DeclaringMethod.Parameters[i];
                                returnList.Add(paramField);
                                break;
                            }
                            param.MoveNext();
                        }
                    }
                }
            }
            return(returnList);
        }