This repository has been archived by the owner. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
RefactoringEssentials/CSharp/Converter Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -34,10 +34,20 @@ public override SyntaxList<StatementSyntax> DefaultVisit(SyntaxNode node)
3434
3535 public override SyntaxList < StatementSyntax > VisitStopOrEndStatement ( VBSyntax . StopOrEndStatementSyntax node )
3636 {
37- var cSharpEquivalent = node . StopOrEndKeyword . IsKind ( VBasic . SyntaxKind . StopKeyword ) ? "System.Diagnostics.Debugger.Break();"
38- : node . StopOrEndKeyword . IsKind ( VBasic . SyntaxKind . EndKeyword ) ? "System.Environment.Exit(0);"
39- : throw new NotImplementedException ( node . StopOrEndKeyword . Kind ( ) + " not implemented!" ) ;
40- return SingleStatement ( SyntaxFactory . ParseStatement ( cSharpEquivalent ) ) ;
37+ return SingleStatement ( SyntaxFactory . ParseStatement ( GetCSharpEquivalentStatementText ( node ) ) ) ;
38+ }
39+
40+ private static string GetCSharpEquivalentStatementText ( VBSyntax . StopOrEndStatementSyntax node )
41+ {
42+ switch ( VBasic . VisualBasicExtensions . Kind ( node . StopOrEndKeyword ) )
43+ {
44+ case VBasic . SyntaxKind . StopKeyword :
45+ return "System.Diagnostics.Debugger.Break();" ;
46+ case VBasic . SyntaxKind . EndKeyword :
47+ return "System.Environment.Exit(0);" ;
48+ default :
49+ throw new NotImplementedException ( node . StopOrEndKeyword . Kind ( ) + " not implemented!" ) ;
50+ }
4151 }
4252
4353 public override SyntaxList < StatementSyntax > VisitLocalDeclarationStatement ( VBSyntax . LocalDeclarationStatementSyntax node )
You can’t perform that action at this time.
0 commit comments