userdiff: better method/property matching for C#
- Support multi-line methods by not requiring closing parenthesis. - Support multiple generics (comma was missing before). - Add missing `foreach`, `lock` and `fixed` keywords to skip over. - Remove `instanceof` keyword, which isn't C#. - Also detect non-method keywords not positioned at the start of a line. - Added tests; none existed before. The overall strategy is to focus more on what isn't expected for method/property definitions, instead of what is, but is fully optional. Signed-off-by: Steven Jeuris <steven.jeuris@gmail.com> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
43072b4ca1
commit
ec0e3075d2
34
t/t4018/csharp-exclude-control-statements
Normal file
34
t/t4018/csharp-exclude-control-statements
Normal file
@ -0,0 +1,34 @@
|
||||
class Example
|
||||
{
|
||||
string Method(int RIGHT)
|
||||
{
|
||||
if (false)
|
||||
{
|
||||
return "out";
|
||||
}
|
||||
else { }
|
||||
if (true) MethodCall(
|
||||
);
|
||||
else MethodCall(
|
||||
);
|
||||
switch ("test")
|
||||
{
|
||||
case "one":
|
||||
return MethodCall(
|
||||
);
|
||||
case "two":
|
||||
break;
|
||||
}
|
||||
(int, int) tuple = (1, 4);
|
||||
switch (tuple)
|
||||
{
|
||||
case (1, 4):
|
||||
MethodCall();
|
||||
break;
|
||||
}
|
||||
|
||||
return "ChangeMe";
|
||||
}
|
||||
|
||||
string MethodCall(int a = 0, int b = 0) => "test";
|
||||
}
|
||||
Reference in New Issue
Block a user