/// <summary> /// Builds the proper <see cref="StatementASTWalker"/> given the provided <see cref="StatementSyntax"/>. /// </summary> /// <returns></returns> public IASTWalker Build() { switch (this.node.Kind()) { case SyntaxKind.BreakStatement: case SyntaxKind.ContinueStatement: return(KeywordStatementASTWalker.Create(this.node, this.semanticModel)); case SyntaxKind.CheckedStatement: case SyntaxKind.DoStatement: case SyntaxKind.EmptyStatement: return(null); case SyntaxKind.FixedStatement: case SyntaxKind.ForEachStatement: case SyntaxKind.ForStatement: case SyntaxKind.GlobalStatement: case SyntaxKind.GotoCaseStatement: case SyntaxKind.GotoDefaultStatement: case SyntaxKind.GotoStatement: return(null); case SyntaxKind.IfStatement: return(ConditionalStatementASTWalker.Create(this.node, this.semanticModel)); case SyntaxKind.LabeledStatement: return(null); case SyntaxKind.LocalDeclarationStatement: return(LocalDeclarationStatementASTWalker.Create(this.node, this.semanticModel)); case SyntaxKind.ExpressionStatement: case SyntaxKind.ReturnStatement: case SyntaxKind.ThrowStatement: return(ExpressionStatementASTWalker.Create(this.node, this.semanticModel)); case SyntaxKind.SwitchStatement: case SyntaxKind.TryStatement: case SyntaxKind.UncheckedStatement: case SyntaxKind.UsingStatement: case SyntaxKind.WhileStatement: return(null); // Unsupported stuff case SyntaxKind.UnsafeStatement: case SyntaxKind.LockStatement: case SyntaxKind.YieldBreakStatement: case SyntaxKind.YieldReturnStatement: throw new UnsupportedSyntaxException(this.node); } throw new InvalidOperationException("Building path reached an invalid non decidible state!"); }
/// <summary> /// Copy initializes a new instance of the <see cref="KeywordStatementASTWalker"/> class. /// </summary> /// <param name="other"></param> /// <remarks> /// For testability. /// </remarks> public KeywordStatementASTWalker(KeywordStatementASTWalker other) : base(other) { }