Revert "[clang-format] C# property formatting can be controlled by config options"

Committed in error without approval https://reviews.llvm.org/D79000

This reverts commit 015bca3e67.
This commit is contained in:
Jonathan Coe 2020-04-28 17:41:17 +01:00
parent 015bca3e67
commit 85ee97fd89
2 changed files with 2 additions and 32 deletions

View File

@ -1531,8 +1531,6 @@ bool UnwrappedLineParser::tryToParsePropertyAccessor() {
// Try to parse the property accessor:
// https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/properties
Tokens->setPosition(StoredPosition);
if (Style.BraceWrapping.AfterFunction == true)
addUnwrappedLine();
nextToken();
do {
switch (FormatTok->Tok.getKind()) {

View File

@ -245,13 +245,11 @@ TEST_F(FormatTestCSharp, Attributes) {
"}");
verifyFormat("[TestMethod]\n"
"public string Host\n"
"{ set; get; }");
"public string Host { set; get; }");
verifyFormat("[TestMethod(\"start\", HelpText = \"Starts the server "
"listening on provided host\")]\n"
"public string Host\n"
"{ set; get; }");
"public string Host { set; get; }");
verifyFormat(
"[DllImport(\"Hello\", EntryPoint = \"hello_world\")]\n"
@ -671,32 +669,6 @@ class MyClass {
set => veryLongNamedField = value;
} = VeryLongNamedTypeIndeed.Create(DefaultFirstArgument, DefaultSecondArgument,
DefaultThirdArgument);
})",
Style);
// Brace wrapping and single-lining of accessor can be controlled by config.
Style.AllowShortBlocksOnASingleLine = FormatStyle::SBS_Never;
Style.BreakBeforeBraces = FormatStyle::BS_Custom;
Style.BraceWrapping.AfterFunction = true;
verifyFormat(R"(//
public class SaleItem {
public decimal Price
{ get; set; }
})",
Style);
verifyFormat(R"(//
class TimePeriod {
public double Hours
{
get {
return _seconds / 3600;
}
set {
_seconds = value * 3600;
}
}
})",
Style);
}