示例#1
0
        /// <summary>
        /// Initializes a new instance of the CodeWalker class.
        /// </summary>
        /// <param name="queryClause">The query clause to walk through.</param>
        /// <param name="statementCallback">Callback executed when a statement is visited.</param>
        /// <param name="expressionCallback">Callback executed when an expression is visited.</param>
        /// <param name="queryClauseCallback">Callback executed when a query clause is visited.</param>
        /// <param name="context">The optional visitor context data.</param>
        private CodeWalker(
            QueryClause queryClause,
            CodeWalkerStatementVisitor <T> statementCallback,
            CodeWalkerExpressionVisitor <T> expressionCallback,
            CodeWalkerQueryClauseVisitor <T> queryClauseCallback,
            T context)
        {
            Param.AssertNotNull(queryClause, "queryClause");
            Param.Ignore(statementCallback);
            Param.Ignore(expressionCallback);
            Param.Ignore(queryClauseCallback);
            Param.Ignore(context);

            this.statementCallback   = statementCallback;
            this.expressionCallback  = expressionCallback;
            this.queryClauseCallback = queryClauseCallback;

            this.WalkQueryClause(
                queryClause,
                queryClause.ParentQueryClause,
                queryClause.FindParentExpression(),
                queryClause.FindParentStatement(),
                queryClause.FindParentElement(),
                context);
        }
示例#2
0
 /// <summary>
 /// Walks through the code units in the statement.
 /// </summary>
 /// <param name="statementCallback">
 /// Callback executed when a statement is visited.
 /// </param>
 /// <param name="expressionCallback">
 /// Callback executed when an expression is visited.
 /// </param>
 /// <param name="queryClauseCallback">
 /// Callback executed when a query clause is visited.
 /// </param>
 public void WalkStatement(
     CodeWalkerStatementVisitor <object> statementCallback,
     CodeWalkerExpressionVisitor <object> expressionCallback,
     CodeWalkerQueryClauseVisitor <object> queryClauseCallback)
 {
     Param.Ignore(statementCallback, expressionCallback, queryClauseCallback);
     CodeWalker <object> .Start(this, statementCallback, expressionCallback, queryClauseCallback, null);
 }
示例#3
0
 /// <summary>
 /// Walks through the code units in the statement.
 /// </summary>
 /// <param name="statementCallback">
 /// Callback executed when a statement is visited.
 /// </param>
 /// <param name="expressionCallback">
 /// Callback executed when an expression is visited.
 /// </param>
 /// <param name="queryClauseCallback">
 /// Callback executed when a query clause is visited.
 /// </param>
 /// <param name="context">
 /// The optional visitor context data.
 /// </param>
 /// <typeparam name="T">
 /// The type of the context item.
 /// </typeparam>
 public void WalkStatement <T>(
     CodeWalkerStatementVisitor <T> statementCallback,
     CodeWalkerExpressionVisitor <T> expressionCallback,
     CodeWalkerQueryClauseVisitor <T> queryClauseCallback,
     T context)
 {
     Param.Ignore(statementCallback, expressionCallback, queryClauseCallback, context);
     CodeWalker <T> .Start(this, statementCallback, expressionCallback, queryClauseCallback, context);
 }
示例#4
0
        public static void Start(
            QueryClause queryClause,
            CodeWalkerStatementVisitor <T> statementCallback,
            CodeWalkerExpressionVisitor <T> expressionCallback,
            CodeWalkerQueryClauseVisitor <T> queryClauseCallback,
            T context)
        {
            Param.AssertNotNull(queryClause, "queryClause");
            Param.Ignore(statementCallback);
            Param.Ignore(expressionCallback);
            Param.Ignore(queryClauseCallback);
            Param.Ignore(context);

            new CodeWalker <T>(queryClause, statementCallback, expressionCallback, queryClauseCallback, context);
        }
示例#5
0
        public static void Start(
            CsDocument document,
            CodeWalkerElementVisitor <T> elementCallback,
            CodeWalkerStatementVisitor <T> statementCallback,
            CodeWalkerExpressionVisitor <T> expressionCallback,
            CodeWalkerQueryClauseVisitor <T> queryClauseCallback,
            T context)
        {
            Param.AssertNotNull(document, "document");
            Param.Ignore(elementCallback);
            Param.Ignore(statementCallback);
            Param.Ignore(expressionCallback);
            Param.Ignore(queryClauseCallback);
            Param.Ignore(context);

            new CodeWalker <T>(document, elementCallback, statementCallback, expressionCallback, queryClauseCallback, context);
        }
示例#6
0
        /// <summary>
        /// Initializes a new instance of the CodeWalker class.
        /// </summary>
        /// <param name="element">The element to walk through.</param>
        /// <param name="elementCallback">Callback executed when an element is visited.</param>
        /// <param name="statementCallback">Callback executed when a statement is visited.</param>
        /// <param name="expressionCallback">Callback executed when an expression is visited.</param>
        /// <param name="queryClauseCallback">Callback executed when a query clause is visited.</param>
        /// <param name="context">The optional visitor context data.</param>
        private CodeWalker(
            CsElement element,
            CodeWalkerElementVisitor <T> elementCallback,
            CodeWalkerStatementVisitor <T> statementCallback,
            CodeWalkerExpressionVisitor <T> expressionCallback,
            CodeWalkerQueryClauseVisitor <T> queryClauseCallback,
            T context)
        {
            Param.AssertNotNull(element, "element");
            Param.Ignore(elementCallback);
            Param.Ignore(statementCallback);
            Param.Ignore(expressionCallback);
            Param.Ignore(queryClauseCallback);
            Param.Ignore(context);

            this.elementCallback     = elementCallback;
            this.statementCallback   = statementCallback;
            this.expressionCallback  = expressionCallback;
            this.queryClauseCallback = queryClauseCallback;

            this.WalkElement(element, element.FindParentElement(), context);
        }
示例#7
0
        /// <summary>
        /// Initializes a new instance of the CodeWalker class.
        /// </summary>
        /// <param name="document">The document to walk through.</param>
        /// <param name="elementCallback">Callback executed when an element is visited.</param>
        /// <param name="statementCallback">Callback executed when a statement is visited.</param>
        /// <param name="expressionCallback">Callback executed when an expression is visited.</param>
        /// <param name="queryClauseCallback">Callback executed when a query clause is visited.</param>
        /// <param name="context">The optional visitor context data.</param>
        private CodeWalker(
            CsDocument document,
            CodeWalkerElementVisitor <T> elementCallback,
            CodeWalkerStatementVisitor <T> statementCallback,
            CodeWalkerExpressionVisitor <T> expressionCallback,
            CodeWalkerQueryClauseVisitor <T> queryClauseCallback,
            T context)
        {
            Param.AssertNotNull(document, "document");
            Param.Ignore(elementCallback);
            Param.Ignore(statementCallback);
            Param.Ignore(expressionCallback);
            Param.Ignore(queryClauseCallback);
            Param.Ignore(context);

            this.elementCallback     = elementCallback;
            this.statementCallback   = statementCallback;
            this.expressionCallback  = expressionCallback;
            this.queryClauseCallback = queryClauseCallback;

            this.WalkElement(document.RootElement, null, context);
        }