Class describing a local declaration statement.
Acts like a decorator for VariableDeclarationTranslationUnit. Internal members protected for testability.
Inheritance: StatementTranslationUnit
        /// <summary>
        /// Initializes a new instance of the <see cref="LocalDeclarationStatementASTWalker"/> class.
        /// </summary>
        /// <param name="node"></param>
        /// <param name="statement"></param>
        /// <param name="semanticModel">The semantic model.</param>
        protected LocalDeclarationStatementASTWalker(CSharpSyntaxNode node, LocalDeclarationStatementTranslationUnit localDeclarationStatement, SemanticModel semanticModel)
            : base(node, semanticModel)
        {
            var declarationSyntaxNode = node as LocalDeclarationStatementSyntax;
            if (declarationSyntaxNode == null)
            {
                throw new ArgumentException(
                    string.Format("Specified node is not of type {0}",
                    typeof(LocalDeclarationStatementSyntax).Name));
            }

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

            // Node assigned in base, no need to assign it here
            this.statement = localDeclarationStatement;
        }
 public static MockedLocalDeclarationStatementTranslationUnit Create(LocalDeclarationStatementTranslationUnit statementTranslationUnit)
 {
     return new MockedLocalDeclarationStatementTranslationUnit(statementTranslationUnit);
 }
 protected MockedLocalDeclarationStatementTranslationUnit(LocalDeclarationStatementTranslationUnit original)
     : base(original)
 {
     // Reassigning since base class operated on it
     this.variableDeclaration = MockedVariableDeclarationTranslationUnit.Create(this.variableDeclaration);
 }
Esempio n. 4
0
 /// <summary>
 /// Copy initializes a new instance of the <see cref="LocalDeclarationStatementTranslationUnit"/> class.
 /// </summary>
 /// <param name="other"></param>
 /// <remarks>
 /// For testability.
 /// </remarks>
 public LocalDeclarationStatementTranslationUnit(LocalDeclarationStatementTranslationUnit other)
     : base(other)
 {
     this.variableDeclaration = other.variableDeclaration;
 }
 /// <summary>
 /// Copy initializes a new instance of the <see cref="LocalDeclarationStatementTranslationUnit"/> class.
 /// </summary>
 /// <param name="other"></param>
 /// <remarks>
 /// For testability.
 /// </remarks>
 public LocalDeclarationStatementTranslationUnit(LocalDeclarationStatementTranslationUnit other)
     : base(other)
 {
     this.variableDeclaration = other.variableDeclaration;
 }