private static void AssertIsClosureScopeSyntax(SyntaxNode syntaxOpt) { // See C# specification, chapter 3.7 Scopes. // static lambdas technically have the class scope so the scope syntax is null if (syntaxOpt == null) { return; } if (LambdaUtilities.IsClosureScope(syntaxOpt)) { return; } throw ExceptionUtilities.UnexpectedValue(syntaxOpt.Kind()); }