private bool TryAdaptLocalVariableDeclarationStatement(JassMapScriptAdapterContext context, JassLocalVariableDeclarationStatementSyntax localVariableDeclarationStatement, [NotNullWhen(true)] out IStatementSyntax?adaptedLocalVariableDeclarationStatement) { if (TryAdaptVariableDeclarator(context, false, localVariableDeclarationStatement.Declarator, out var adaptedDeclarator)) { adaptedLocalVariableDeclarationStatement = new JassLocalVariableDeclarationStatementSyntax(adaptedDeclarator); return(true); } adaptedLocalVariableDeclarationStatement = null; return(false); }
private bool TryAdaptStatement(JassMapScriptAdapterContext context, IStatementSyntax statement, [NotNullWhen(true)] out IStatementSyntax?adaptedStatement) { return(statement switch { JassLocalVariableDeclarationStatementSyntax localVariableDeclarationStatement => TryAdaptLocalVariableDeclarationStatement(context, localVariableDeclarationStatement, out adaptedStatement), JassSetStatementSyntax setStatement => TryAdaptSetStatement(context, setStatement, out adaptedStatement), JassCallStatementSyntax callStatement => TryAdaptCallStatement(context, callStatement, out adaptedStatement), JassIfStatementSyntax ifStatement => TryAdaptIfStatement(context, ifStatement, out adaptedStatement), JassLoopStatementSyntax loopStatement => TryAdaptLoopStatement(context, loopStatement, out adaptedStatement), JassExitStatementSyntax exitStatement => TryAdaptExitStatement(context, exitStatement, out adaptedStatement), JassReturnStatementSyntax returnStatement => TryAdaptReturnStatement(context, returnStatement, out adaptedStatement), JassDebugStatementSyntax debugStatement => TryAdaptDebugStatement(context, debugStatement, out adaptedStatement), _ => TryAdaptDummy(context, statement, out adaptedStatement), });
public LuaStatementSyntax Transpile(IStatementSyntax statement) { return(statement switch { JassEmptyStatementSyntax emptyStatement => Transpile(emptyStatement), JassCommentStatementSyntax commentStatement => Transpile(commentStatement), JassLocalVariableDeclarationStatementSyntax localVariableDeclarationStatement => Transpile(localVariableDeclarationStatement), JassSetStatementSyntax setStatement => Transpile(setStatement), JassCallStatementSyntax callStatement => Transpile(callStatement), JassIfStatementSyntax ifStatement => Transpile(ifStatement), JassLoopStatementSyntax loopStatement => Transpile(loopStatement), JassExitStatementSyntax exitStatement => Transpile(exitStatement), JassReturnStatementSyntax returnStatement => Transpile(returnStatement), JassDebugStatementSyntax debugStatement => Transpile(debugStatement), });
public void Render(JassLocalVariableDeclarationStatementSyntax localVariableDeclarationStatement) { Write($"{JassKeyword.Local} "); Render(localVariableDeclarationStatement.Declarator); }
public StatementSyntax Transpile(JassLocalVariableDeclarationStatementSyntax localVariableDeclarationStatement) { return(SyntaxFactory.LocalDeclarationStatement(Transpile(localVariableDeclarationStatement.Declarator))); }
public LuaStatementSyntax Transpile(JassLocalVariableDeclarationStatementSyntax localVariableDeclarationStatement) { return(Transpile(localVariableDeclarationStatement.Declarator, true)); }