/// <summary> /// Initializes a new instance of the <see cref="ExpressionStatementASTWalker"/> class. /// </summary> /// <param name="node"></param> /// <param name="statement"></param> /// <param name="semanticModel">The semantic model.</param> protected ExpressionStatementASTWalker(CSharpSyntaxNode node, ExpressionStatementTranslationUnit expressionStatement, SemanticModel semanticModel) : base(node, semanticModel) { var returnSyntaxNode = node as ReturnStatementSyntax; var throwSyntaxNode = node as ThrowStatementSyntax; var expressionSyntaxNode = node as ExpressionStatementSyntax; if (returnSyntaxNode == null && throwSyntaxNode == null && expressionSyntaxNode == null) { throw new ArgumentException( string.Format("Specified node ({0}) is not one of these types: {1}, {2}, {3}!", node.GetType().Name, typeof(ReturnStatementSyntax).Name, typeof(ThrowStatementSyntax).Name), typeof(ExpressionStatementSyntax).Name); } if (expressionStatement == null) { throw new ArgumentNullException(nameof(expressionStatement)); } // Node assigned in base, no need to assign it here this.statement = expressionStatement; }
/// <summary> /// Copy initializes a new instance of the <see cref="ExpressionStatementTranslationUnit"/> class. /// </summary> /// <param name="other"></param> /// <remarks> /// For testability. /// </remarks> public ExpressionStatementTranslationUnit(ExpressionStatementTranslationUnit other) : base(other) { this.expression = other.expression; this.keyword = other.keyword; }