private bool ContainsConditionalDirectiveTrivia(SyntaxNode node) { for (var currentDirective = node.GetFirstDirective(); currentDirective != null && node.Contains(currentDirective); currentDirective = currentDirective.GetNextDirective()) { switch (currentDirective.Kind()) { case SyntaxKind.IfDirectiveTrivia: case SyntaxKind.ElseDirectiveTrivia: case SyntaxKind.ElifDirectiveTrivia: case SyntaxKind.EndIfDirectiveTrivia: return true; } } return false; }