Class describing conditional statements.
Internal members protected for testability.
상속: StatementTranslationUnit
예제 #1
0
 /// <summary>
 /// Copy initializes a new instance of the <see cref="ConditionalStatementTranslationUnit"/> class.
 /// </summary>
 /// <param name="other"></param>
 /// <remarks>
 /// For testability.
 /// </remarks>
 protected ConditionalStatementTranslationUnit(ConditionalStatementTranslationUnit other)
     : base(other)
 {
     this.testExpressions = other.testExpressions;
     this.bodies          = other.bodies;
     this.lastBody        = other.lastBody;
     this.hasFinalElse    = other.hasFinalElse;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ConditionalStatementASTWalker"/> class.
        /// </summary>
        /// <param name="node"></param>
        /// <param name="conditionalStatement"></param>
        /// <param name="semanticModel">The semantic model.</param>
        protected ConditionalStatementASTWalker(CSharpSyntaxNode node, ConditionalStatementTranslationUnit conditionalStatement, SemanticModel semanticModel)
            : base(node, semanticModel)
        {
            var statementSyntaxNode = node as IfStatementSyntax;
            if (statementSyntaxNode == null)
            {
                throw new ArgumentException(
                    string.Format("Specified node is not of type {0}",
                    typeof(IfStatementSyntax).Name));
            }

            if (conditionalStatement == null)
            {
                throw new ArgumentNullException(nameof(conditionalStatement));
            }

            // Node assigned in base, no need to assign it here
            this.statement = conditionalStatement;

            // Going through parts in the statement and filling the translation unit with initial data
            this.VisitNode(statementSyntaxNode, 0);
        }
 /// <summary>
 /// Copy initializes a new instance of the <see cref="ConditionalStatementTranslationUnit"/> class.
 /// </summary>
 /// <param name="other"></param>
 /// <remarks>
 /// For testability.
 /// </remarks>
 protected ConditionalStatementTranslationUnit(ConditionalStatementTranslationUnit other)
     : base(other)
 {
     this.testExpressions = other.testExpressions;
     this.bodies = other.bodies;
     this.lastBody = other.lastBody;
     this.hasFinalElse = other.hasFinalElse;
 }
 public static MockedConditionalStatementTranslationUnit Create(ConditionalStatementTranslationUnit statementTranslationUnit)
 {
     return new MockedConditionalStatementTranslationUnit(statementTranslationUnit);
 }
 protected MockedConditionalStatementTranslationUnit(ConditionalStatementTranslationUnit original)
     : base(original)
 {
 }