Пример #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);
        }
Пример #3
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 locals = methodSymbol.GetLocals();
                    if (locals != null)
                    {
                        for (int i = 0; ; i++)
                        {
                            if (locals.Current == null)
                            {
                                break;
                            }
                            if (locals.Current.Name == name.Name)
                            {
                                Field localField = new DebugFieldNode(this.debugEnv, locals.Current, name, null, this, i);
                                localField.DeclaringType = this;
                                returnList.Add(localField);
                                break;
                            }
                            locals.MoveNext();
                        }
                    }
                }
            }
            return(returnList);
        }
Пример #4
0
 public DebugMethodScope(DebugEnvironment envr, CDebugMethodSymbol method)
 {
     this.debugEnv = envr;
     if (method != null)
     {
         this.methodSymbol = method;
         IDebugFieldSymbol thisSymbol = method.GetThis();
         if (thisSymbol != null)
         {
             this.ThisType  = new DebugClassNode(this.debugEnv, thisSymbol.Type, thisSymbol.GetValue(null));
             this.BaseClass = new DebugTypeScope(this.debugEnv, null, this.ThisType);
         }
         else
         {
             IDebugClassType classType = method.GetDeclaringType();
             if (classType != null)
             {
                 Class declaringType = new DebugClassNode(this.debugEnv, classType, null);
                 this.BaseClass = new DebugTypeScope(this.debugEnv, null, declaringType);
             }
         }
         this.DeclaringMethod = new DebugMethod(this.debugEnv, this.methodSymbol, this);
     }
 }