/// <summary> /// Parses the list of expressions. /// </summary> /// <param name="expressionParent">The direct parent of the expressions to check.</param> /// <param name="parentExpression">The parent expression, if there is one.</param> /// <param name="parentElement">The element that contains the expressions.</param> /// <param name="parentClass">The class that the element belongs to.</param> /// <param name="members">The collection of members of the parent class.</param> private void CheckClassMemberRulesForExpressions( CodeUnit expressionParent, Expression parentExpression, Element parentElement, ClassBase parentClass, Dictionary <string, List <Element> > members) { Param.AssertNotNull(expressionParent, "expressionParent"); Param.AssertNotNull(parentElement, "parentElement"); Param.Ignore(parentExpression); Param.Ignore(parentClass); Param.Ignore(members); // Loop through each of the expressions in the list. for (Expression expression = expressionParent.FindFirstChildExpression(); expression != null; expression = expression.FindNextSiblingExpression()) { // If the expression is a variable declarator expression, we don't // want to match against the identifier tokens. if (expression.ExpressionType == ExpressionType.VariableDeclarator) { VariableDeclaratorExpression declarator = (VariableDeclaratorExpression)expression; if (declarator.Initializer != null) { this.CheckClassMemberRulesForExpression(declarator.Initializer, parentExpression, parentElement, parentClass, members); } } else { this.CheckClassMemberRulesForExpression(expression, parentExpression, parentElement, parentClass, members); } } }
/// <summary> /// Checks the given list of expressions. /// </summary> /// <param name="element">The element containing the expressions.</param> /// <param name="expressionParent">The parent of the expressions to check.</param> private void CheckStatementFormattingRulesForExpressions(Element element, CodeUnit expressionParent) { Param.AssertNotNull(element, "element"); Param.AssertNotNull(expressionParent, "expressionParent"); for (Expression expression = expressionParent.FindFirstChildExpression(); expression != null; expression = expression.FindNextSiblingExpression()) { if (expression.ExpressionType == ExpressionType.AnonymousMethod) { // Check the statements within this anonymous method expression. AnonymousMethodExpression anonymousMethod = expression as AnonymousMethodExpression; this.CheckStatementFormattingRulesForStatements(element, anonymousMethod); } else { // Check the child expressions under this expression. this.CheckStatementFormattingRulesForExpressions(element, expression); } } }
/// <summary> /// Parses the list of expressions. /// </summary> /// <param name="expressionParent">The direct parent of the expressions to check.</param> /// <param name="parentExpression">The parent expression, if there is one.</param> /// <param name="parentElement">The element that contains the expressions.</param> /// <param name="parentClass">The class that the element belongs to.</param> /// <param name="members">The collection of members of the parent class.</param> private void CheckClassMemberRulesForExpressions( CodeUnit expressionParent, Expression parentExpression, Element parentElement, ClassBase parentClass, Dictionary<string, List<Element>> members) { Param.AssertNotNull(expressionParent, "expressionParent"); Param.AssertNotNull(parentElement, "parentElement"); Param.Ignore(parentExpression); Param.Ignore(parentClass); Param.Ignore(members); // Loop through each of the expressions in the list. for (Expression expression = expressionParent.FindFirstChildExpression(); expression != null; expression = expression.FindNextSiblingExpression()) { // If the expression is a variable declarator expression, we don't // want to match against the identifier tokens. if (expression.ExpressionType == ExpressionType.VariableDeclarator) { VariableDeclaratorExpression declarator = (VariableDeclaratorExpression)expression; if (declarator.Initializer != null) { this.CheckClassMemberRulesForExpression(declarator.Initializer, parentExpression, parentElement, parentClass, members); } } else { this.CheckClassMemberRulesForExpression(expression, parentExpression, parentElement, parentClass, members); } } }
/// <summary> /// Checks the given list of expressions. /// </summary> /// <param name="element">The element containing the expressions.</param> /// <param name="expressionParent">The parent of the expressions to check.</param> private void CheckStatementFormattingRulesForExpressions(Element element, CodeUnit expressionParent) { Param.AssertNotNull(element, "element"); Param.AssertNotNull(expressionParent, "expressionParent"); for (Expression expression = expressionParent.FindFirstChildExpression(); expression != null; expression = expression.FindNextSiblingExpression()) { if (expression.ExpressionType == ExpressionType.AnonymousMethod) { // Check the statements within this anonymous method expression. AnonymousMethodExpression anonymousMethod = expression as AnonymousMethodExpression; this.CheckStatementFormattingRulesForStatements(element, anonymousMethod); } else { // Check the child expressions under this expression. this.CheckStatementFormattingRulesForExpressions(element, expression); } } }