// does the expression contain declaration? public static bool ContainsDeclarations(this ExpressionSyntax node) { return(node.ContainsNodeThatVerifies(x => x.IsKind(SyntaxKind.DeclarationExpression) || x.IsKind(SyntaxKind.DeclarationPattern))); }