internal static ExpressionSyntax CheckAndUnwrapRefExpression( this ExpressionSyntax syntax, DiagnosticBag diagnostics, out RefKind refKind) { refKind = RefKind.None; if (syntax?.Kind() == SyntaxKind.RefExpression) { refKind = RefKind.Ref; syntax = ((RefExpressionSyntax)syntax).Expression; syntax.CheckDeconstructionCompatibleArgument(diagnostics); } return(syntax); }