Exemplo n.º 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);
        }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 8
0
 /// <summary>
 /// Walks through the code units in the element.
 /// </summary>
 /// <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>
 public void WalkElement(
     CodeWalkerElementVisitor <object> elementCallback, CodeWalkerStatementVisitor <object> statementCallback, CodeWalkerExpressionVisitor <object> expressionCallback)
 {
     Param.Ignore(elementCallback, statementCallback, expressionCallback);
     this.WalkElement(elementCallback, statementCallback, expressionCallback, null, null);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Walks through the code units in the element.
 /// </summary>
 /// <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="context">
 /// The optional visitor context data.
 /// </param>
 /// <typeparam name="T">
 /// The type of the context item.
 /// </typeparam>
 public void WalkElement <T>(
     CodeWalkerElementVisitor <T> elementCallback, CodeWalkerStatementVisitor <T> statementCallback, CodeWalkerExpressionVisitor <T> expressionCallback, T context)
 {
     Param.Ignore(elementCallback, statementCallback, expressionCallback, context);
     this.WalkElement(elementCallback, statementCallback, expressionCallback, null, context);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Walks through the code units in the query clause.
 /// </summary>
 /// <param name="statementCallback">
 /// Callback executed when a statement is visited.
 /// </param>
 /// <param name="expressionCallback">
 /// Callback executed when an expression is visited.
 /// </param>
 public void WalkQueryClause(CodeWalkerStatementVisitor <object> statementCallback, CodeWalkerExpressionVisitor <object> expressionCallback)
 {
     Param.Ignore(statementCallback, expressionCallback);
     this.WalkQueryClause(statementCallback, expressionCallback, null, null);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Walks through the code units in the query clause.
 /// </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="context">
 /// The optional visitor context data.
 /// </param>
 /// <typeparam name="T">
 /// The type of the context item.
 /// </typeparam>
 public void WalkQueryClause <T>(CodeWalkerStatementVisitor <T> statementCallback, CodeWalkerExpressionVisitor <T> expressionCallback, T context)
 {
     Param.Ignore(statementCallback, expressionCallback, context);
     this.WalkQueryClause(statementCallback, expressionCallback, null, context);
 }