Beispiel #1
0
 public static EocSwitchStatement Translate(CodeConverter C, SwitchStatement stat)
 {
     return(new EocSwitchStatement(
                C,
                stat.Case.Select(x => CaseInfo.Translate(C, x)).ToList(),
                EocStatementBlock.Translate(C, stat.DefaultBlock)));
 }
Beispiel #2
0
 public EocIfStatement(CodeConverter c, EocExpression condition, EocStatementBlock block, bool mask, string comment) : base(c)
 {
     Condition = condition;
     Block     = block;
     Comment   = comment;
     Mask      = mask;
 }
 public EocDoWhileStatement(CodeConverter c, EocExpression condition, EocStatementBlock block, bool mask, string commentOnStart, string commentOnEnd) : base(c)
 {
     Condition      = condition;
     Block          = block;
     Mask           = mask;
     CommentOnStart = commentOnStart;
     CommentOnEnd   = commentOnEnd;
 }
 public EocIfElseStatement(CodeConverter c, EocExpression condition, EocStatementBlock blockOnTrue, EocStatementBlock blockOnFalse, bool mask, string comment) : base(c)
 {
     Condition    = condition;
     BlockOnTrue  = blockOnTrue;
     BlockOnFalse = blockOnFalse;
     Comment      = comment;
     Mask         = mask;
 }
 public EocCounterStatement(CodeConverter c, EocExpression count, EocExpression var, EocStatementBlock block, bool mask, string commentOnStart, string commentOnEnd) : base(c)
 {
     Count          = count;
     Var            = var;
     Block          = block;
     Mask           = mask;
     CommentOnStart = commentOnStart;
     CommentOnEnd   = commentOnEnd;
 }
Beispiel #6
0
 public static CaseInfo Translate(CodeConverter C, SwitchStatement.CaseInfo info)
 {
     return(new CaseInfo()
     {
         Condition = EocExpression.Translate(C, info.Condition),
         UnexaminedCode = info.UnexaminedCode,
         Block = EocStatementBlock.Translate(C, info.Block),
         Comment = info.Comment,
         Mask = info.Mask
     });
 }
Beispiel #7
0
 public EocForStatement(CodeConverter c, EocExpression start, EocExpression end, EocExpression step, EocExpression var, EocStatementBlock block, bool mask, string commentOnStart, string commentOnEnd) : base(c)
 {
     Start          = start;
     End            = end;
     Step           = step;
     Var            = var;
     Block          = block;
     Mask           = mask;
     CommentOnStart = commentOnStart;
     CommentOnEnd   = commentOnEnd;
 }
Beispiel #8
0
 public static EocIfStatement Translate(CodeConverter C, IfStatement stat)
 {
     if (stat == null)
     {
         return(null);
     }
     return(new EocIfStatement(
                C,
                EocExpression.Translate(C, stat.Condition),
                EocStatementBlock.Translate(C, stat.Block),
                stat.Mask,
                stat.Comment));
 }
 public static EocDoWhileStatement Translate(CodeConverter C, DoWhileStatement stat)
 {
     if (stat == null)
     {
         return(null);
     }
     return(new EocDoWhileStatement(
                C,
                EocExpression.Translate(C, stat.Condition),
                EocStatementBlock.Translate(C, stat.Block),
                stat.MaskOnStart || stat.MaskOnEnd,
                stat.CommentOnStart,
                stat.CommentOnEnd));
 }
Beispiel #10
0
 public static EocForStatement Translate(CodeConverter C, ForStatement stat)
 {
     if (stat == null)
     {
         return(null);
     }
     return(new EocForStatement(
                C,
                EocExpression.Translate(C, stat.Start),
                EocExpression.Translate(C, stat.End),
                EocExpression.Translate(C, stat.Step),
                EocExpression.Translate(C, stat.Var),
                EocStatementBlock.Translate(C, stat.Block),
                stat.MaskOnStart || stat.MaskOnEnd,
                stat.CommentOnStart,
                stat.CommentOnEnd));
 }
 public override EocStatement Optimize()
 {
     Condition = Condition?.Optimize();
     if (Condition.TryGetConstValueWithCast(ProjectConverter.CppTypeName_Bool, out var x))
     {
         if ((bool)x == true)
         {
             BlockOnFalse = new EocStatementBlock(C);
         }
         else
         {
             BlockOnTrue = new EocStatementBlock(C);
         }
     }
     BlockOnTrue  = BlockOnTrue?.Optimize() as EocStatementBlock;
     BlockOnFalse = BlockOnFalse?.Optimize() as EocStatementBlock;
     return(this);
 }
Beispiel #12
0
 public EocSwitchStatement(CodeConverter c, List <CaseInfo> @case, EocStatementBlock defaultBlock) : base(c)
 {
     Case         = @case;
     DefaultBlock = defaultBlock;
 }