예제 #1
0
        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);
        }
예제 #2
0
        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),
            });
예제 #3
0
 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)));
 }
예제 #6
0
 public LuaStatementSyntax Transpile(JassLocalVariableDeclarationStatementSyntax localVariableDeclarationStatement)
 {
     return(Transpile(localVariableDeclarationStatement.Declarator, true));
 }