Пример #1
0
        public virtual BaseProperty MakeProperty(IDebugPropertySymbol symbol, IDebugProperty parent, IDebugValue containerValue)
        {
            IDebugMethodSymbol getter = symbol.GetGetter();
            IDebugValue        value  = null;

            if (getter != null /*&& (context.flags & EvaluationFlags.NoFuncEval) == 0*/)
            {
                IEnumSymbol parameters = getter.GetParameters();
                if (parameters == null || parameters.Count == 0)
                {
                    IDebugValue[] arguments = null;
                    if ((getter.Modifiers & SymbolModifiers.Static) == 0)
                    {
                        arguments = new IDebugValue[] { containerValue }
                    }
                    ;
                    else
                    {
                        arguments = new IDebugValue[0];
                    }
                    value = getter.Evaluate(containerValue, arguments);
                }
            }
            return(this.MakeProperty(symbol.Name, symbol.Type, value, parent));
        }
Пример #2
0
 public virtual IDebugProperty GetCurrentMethodProperty(IDebugMethodSymbol methodSymbol){
   return new MethodProperty(methodSymbol, this);
 }
Пример #3
0
 public MethodProperty(IDebugMethodSymbol method, CommonExpressionEvaluator evaluator){
   this.method = method;
   this.evaluator = evaluator;
 }
Пример #4
0
 public  IDebugValue CreateObject(IDebugMethodSymbol constructor, IDebugValue[] args) {
   throw new Exception("Not implemented Yet");
 }
Пример #5
0
 public IDebugValue CreateObject(IDebugMethodSymbol constructor, IDebugValue[] args)
 {
     throw new Exception("Not implemented Yet");
 }
Пример #6
0
        private IDebugProperty EvaluateExpression(uint evalFlags, uint timeout, IDebugContext context, String resultType)
        {
            if (this.debugContext == null)
            {
                this.debugContext = new DebugEnvironment();
            }
            this.debugContext.context = context;
            BlockScope    scope  = new DebugBlockScope(this.debugContext);
            ErrorNodeList errors = new ErrorNodeList();

            if (this.cciExpr.compiledExpression == null)
            {
                this.cciExpr.compiledExpression = (Expression)this.cciExpr.EE.ExprCompiler.CompileParseTree(this.cciExpr.ParsedExpr, scope, new Module(), errors);
                if (errors.Count > 0)
                {
                    this.cciExpr.compiledExpression = null;
                }
            }
            if (this.cciExpr.compiledExpression != null)
            {
                StackFrame         currentFrame = new StackFrame();
                IDebugMethodSymbol methodSym    = this.debugContext.context.GetContainer() as CDebugMethodSymbol;
                if (methodSym != null)
                {
                    IDebugFieldSymbol thisSymbol = methodSym.GetThis();
                    if (thisSymbol != null)
                    {
                        currentFrame.thisObject = new Literal(thisSymbol.GetValue(null), ((MethodScope )scope.BaseClass).ThisType);
                    }
                    else
                    {
                        currentFrame.thisObject = null;
                    }
                    currentFrame.parameters[0] = currentFrame.thisObject;
                    IEnumSymbol locals = methodSym.GetLocals();
                    if (locals != null)
                    {
                        for (int i = 0; ; i++)
                        {
                            if (locals.Current == null)
                            {
                                break;
                            }
                            Field localField = new DebugFieldNode(this.debugContext, locals.Current, new Identifier(locals.Current.Name), null, null, i);
                            currentFrame.locals[i] = localField.GetValue(null);
                            locals.MoveNext();
                        }
                    }
                    IEnumSymbol param = methodSym.GetParameters();
                    if (param != null)
                    {
                        for (int i = 1; ; i++)
                        {
                            if (param.Current == null)
                            {
                                break;
                            }
                            Field paramField = new DebugFieldNode(this.debugContext, param.Current, new Identifier(param.Current.Name), null, null, i);
                            currentFrame.parameters[i] = paramField.GetValue(null);
                            param.MoveNext();
                        }
                    }
                }
                if (this.cciExpr.EE.ExprEvaluator == null)
                {
                    this.cciExpr.EE.ExprEvaluator = new Evaluator();
                }
                this.cciExpr.EE.ExprEvaluator.stackFrame = currentFrame;
                Literal resultExpr = this.cciExpr.EE.ExprEvaluator.VisitExpression(this.cciExpr.compiledExpression) as Literal;
                if (resultExpr != null)
                {
                    if (resultExpr.Value is IDebugValue && resultExpr.Type is IDebugInfo) //already wrapped for use by debugger
                    {
                        return(this.cciExpr.EE.MakeProperty(this.cciExpr.Expr, ((IDebugInfo)resultExpr.Type).GetDebugType, (IDebugValue)resultExpr.Value, null));
                    }
                    else if (resultExpr.Value is IDebugValue)
                    {
                        return(this.cciExpr.EE.MakeProperty(this.cciExpr.Expr, ((IDebugValue)resultExpr.Value).RuntimeType(), (IDebugValue)resultExpr.Value, null));
                    }
                    if (resultExpr.Value != null)
                    {
                        return(new ExpressionEvalProperty(this.cciExpr.Expr, resultExpr.Type.FullName, resultExpr.Value.ToString(), resultExpr, this.cciExpr.EE));
                    }
                }
                else
                {
                    return(new ExpressionEvalProperty(this.cciExpr.Expr, String.Empty, "Error Evaluating Expression.", null, this.cciExpr.EE));
                }
            }
            else if (errors.Count > 0)
            {
                return(new ExpressionEvalProperty(this.cciExpr.Expr, String.Empty, errors[0].GetMessage(), null, this.cciExpr.EE));
            }
            return(new ExpressionEvalProperty(this.cciExpr.Expr, String.Empty, "Unknown Compiler Error.", null, this.cciExpr.EE));
        }
Пример #7
0
 public MethodProperty(IDebugMethodSymbol method, CommonExpressionEvaluator evaluator)
 {
     this.method    = method;
     this.evaluator = evaluator;
 }
Пример #8
0
 public virtual IDebugProperty GetCurrentMethodProperty(IDebugMethodSymbol methodSymbol)
 {
     return(new MethodProperty(methodSymbol, this));
 }