Exemple #1
0
        // Parses a text-based expression for evaluation.
        // The engine sample only supports locals and parameters so the only task here is to check the names in those collections.
        int IDebugExpressionContext2.ParseText(string pszCode,
                                               enum_PARSEFLAGS dwFlags,
                                               uint nRadix,
                                               out IDebugExpression2 ppExpr,
                                               out string pbstrError,
                                               out uint pichError)
        {
            pbstrError = string.Empty;
            pichError  = 0;

            var evaluationResults = this._stackFrame.Locals.Union(this._stackFrame.Parameters);

            foreach (var currVariable in evaluationResults)
            {
                if (StringComparer.Ordinal.Equals(currVariable.Expression, pszCode))
                {
                    ppExpr = new UncalculatedAD7Expression(this, currVariable.Expression);
                    return(VSConstants.S_OK);
                }
            }

            string errorMsg;

            if (!this._stackFrame.TryParseText(pszCode, out errorMsg))
            {
                pbstrError = "Error: " + errorMsg;
                pichError  = (uint)pbstrError.Length;
            }

            ppExpr = new UncalculatedAD7Expression(this, pszCode);
            return(VSConstants.S_OK);
        }
Exemple #2
0
        // Parses a text-based expression for evaluation.
        // The engine sample only supports locals and parameters so the only task here is to check the names in those collections.
        int IDebugExpressionContext2.ParseText(string pszCode,
            enum_PARSEFLAGS dwFlags,
            uint nRadix,
            out IDebugExpression2 ppExpr,
            out string pbstrError,
            out uint pichError) {
            pbstrError = String.Empty;
            pichError = 0;

            IEnumerable<NodeEvaluationResult> evaluationResults = _stackFrame.Locals.Union(_stackFrame.Parameters);
            foreach (NodeEvaluationResult currVariable in evaluationResults) {
                if (String.CompareOrdinal(currVariable.Expression, pszCode) == 0) {
                    ppExpr = new UncalculatedAD7Expression(this, currVariable.Expression);
                    return VSConstants.S_OK;
                }
            }

            string errorMsg;
            if (!_stackFrame.TryParseText(pszCode, out errorMsg)) {
                pbstrError = "Error: " + errorMsg;
                pichError = (uint)pbstrError.Length;
            }

            ppExpr = new UncalculatedAD7Expression(this, pszCode);
            return VSConstants.S_OK;
        }