VB -> C#: Support Is, IsNot, LeftShift, RightShift
This commit is contained in:
Родитель
54c2eb00f0
Коммит
9ef202fa2d
|
@ -358,6 +358,14 @@ namespace ICSharpCode.CodeConverter.CSharp
|
|||
return SyntaxKind.LessThanExpression;
|
||||
case VBasic.SyntaxKind.LessThanOrEqualExpression:
|
||||
return SyntaxKind.LessThanOrEqualExpression;
|
||||
case VBasic.SyntaxKind.IsExpression:
|
||||
return SyntaxKind.EqualsExpression;
|
||||
case VBasic.SyntaxKind.IsNotExpression:
|
||||
return SyntaxKind.NotEqualsExpression;
|
||||
case VBasic.SyntaxKind.LeftShiftExpression:
|
||||
return SyntaxKind.LeftShiftExpression;
|
||||
case VBasic.SyntaxKind.RightShiftExpression:
|
||||
return SyntaxKind.RightShiftExpression;
|
||||
// assignment
|
||||
case VBasic.SyntaxKind.SimpleAssignmentStatement:
|
||||
return SyntaxKind.SimpleAssignmentExpression;
|
||||
|
|
|
@ -98,6 +98,10 @@ namespace ICSharpCode.CodeConverter.Util
|
|||
return SyntaxKind.SlashToken;
|
||||
case SyntaxKind.ModuloExpression:
|
||||
return SyntaxKind.PercentToken;
|
||||
case SyntaxKind.LeftShiftExpression:
|
||||
return SyntaxKind.LessThanLessThanToken;
|
||||
case SyntaxKind.RightShiftExpression:
|
||||
return SyntaxKind.GreaterThanGreaterThanToken;
|
||||
// assignments
|
||||
case SyntaxKind.SimpleAssignmentExpression:
|
||||
return SyntaxKind.EqualsToken;
|
||||
|
|
|
@ -44,15 +44,19 @@ class TestClass
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void IsAndIsNotKeyword()
|
||||
public void BinaryOperatorsIsIsNotLeftShiftRightShift()
|
||||
{
|
||||
TestConversionVisualBasicToCSharp(@"Class TestClass
|
||||
Private bIs as Boolean = New Object Is New Object
|
||||
Private bIsNot as Boolean = New Object IsNot New Object
|
||||
Private bLeftShift as Integer = 1 << 3
|
||||
Private bRightShift as Integer = 8 >> 3
|
||||
End Class", @"class TestClass
|
||||
{
|
||||
private bool bIs = object.ReferenceEquals(new Object(), new Object())
|
||||
private bool bIsNot = !object.ReferenceEquals(new Object(), new Object())
|
||||
private bool bIs = new object() == new object();
|
||||
private bool bIsNot = new object() != new object();
|
||||
private int bLeftShift = 1 << 3;
|
||||
private int bRightShift = 8 >> 3;
|
||||
}");
|
||||
}
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ using Microsoft.VisualBasic;
|
|||
/// </summary>
|
||||
private static bool IsTwoLineCsIfStatement(string line, string nextLine)
|
||||
{
|
||||
return line.Contains("if") && !nextLine.Trim().Equals("{");
|
||||
return line.Contains("if ") && !nextLine.Trim().Equals("{");
|
||||
}
|
||||
|
||||
private static bool HasNoTargetLine(string prevLine, string line, string nextLine)
|
||||
|
@ -161,7 +161,7 @@ using Microsoft.VisualBasic;
|
|||
|
||||
private static bool IsFirstOfMultiLineVbIfStatement(string line)
|
||||
{
|
||||
return line.Trim().StartsWith("If") && line.Trim().EndsWith("Then");
|
||||
return line.Trim().StartsWith("If ") && line.Trim().EndsWith("Then");
|
||||
}
|
||||
|
||||
private static bool IsVbInheritsOrImplements(string line)
|
||||
|
|
Загрузка…
Ссылка в новой задаче