forked from paulirwin/JavaToCSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWhileStatementVisitor.cs
More file actions
28 lines (24 loc) · 819 Bytes
/
Copy pathWhileStatementVisitor.cs
File metadata and controls
28 lines (24 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using japa.parser.ast.stmt;
using JavaToCSharp.Expressions;
using Roslyn.Compilers.CSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JavaToCSharp.Statements
{
public class WhileStatementVisitor : StatementVisitor<WhileStmt>
{
public override StatementSyntax Visit(ConversionContext context, WhileStmt whileStmt)
{
var expr = whileStmt.getCondition();
var syntax = ExpressionVisitor.VisitExpression(context, expr);
var body = whileStmt.getBody();
var bodySyntax = StatementVisitor.VisitStatement(context, body);
if (bodySyntax == null)
return null;
return Syntax.WhileStatement(syntax, bodySyntax);
}
}
}