internal override Statement CloneInternal(CloneContext ctx) { CompoundStatement clone = new CompoundStatement(); ctx.Map(this, clone); foreach (Statement stmt in Statements) { if (!stmt.IsEliminated) clone.Statements.Add(stmt.GetClone(ctx)); } return clone; }
public void AcceptCompoundStatement(CompoundStatement stmt) { switch (Pass) { case EPass.Preprocess: stmt.Statements.Accept(this); break; case EPass.Remove: stmt.Statements.RemoveAll( s => s is NopStatement && !_gotoTargets.Contains(s)); break; } }
public void AcceptCompoundStatement(CompoundStatement stmt) { if (stmt.Statements.Count == 1) stmt.Statements.Single().Accept(this); else throw new NotConvertibleToInlineExpressionException(); }
public void DefaultCase() { CaseStatement cstmt = (CaseStatement)_sstack.Peek(); CompoundStatement branch = new CompoundStatement(); cstmt.Branches.Add(branch); _cstack.Push(branch); }
public DependendAlgorithmBuilder(Function func, CompoundStatement root) { _func = func; Reset(root); }
public virtual LoopBlock Loop() { LoopBlock block = new LoopBlock(); CompoundStatement body = new CompoundStatement(); block.Body = body; _sstack.Push(block); _cstack.Peek().Statements.Add(block); _cstack.Push(body); return block; }
public virtual void Case(Expression cond) { CaseStatement cstmt = (CaseStatement)_sstack.Peek(); CompoundStatement branch = new CompoundStatement(); cstmt.Cases.Add(cond); cstmt.Branches.Add(branch); _cstack.Push(branch); }
public virtual void ElseIf(Expression cond) { IfStatement ifstmt = (IfStatement)_sstack.Peek(); CompoundStatement branch = new CompoundStatement(); ifstmt.Conditions.Add(cond); ifstmt.Branches.Add(branch); _cstack.Pop(); _cstack.Push(branch); }
public virtual void Else() { IfStatement ifstmt = (IfStatement)_sstack.Peek(); CompoundStatement branch = new CompoundStatement(); ifstmt.Branches.Add(branch); _cstack.Pop(); _cstack.Push(branch); }
public virtual IAlgorithmBuilder BeginSubAlgorithm() { CompoundStatement sub = new CompoundStatement(); _cstack.Peek().Statements.Add(sub); return new DependendAlgorithmBuilder(ResultFunction, sub); }
public virtual IfStatement If(Expression cond) { IfStatement ifstmt = new IfStatement(); CompoundStatement ifbranch = new CompoundStatement(); ifstmt.Conditions.Add(cond); ifstmt.Branches.Add(ifbranch); _cstack.Peek().Statements.Add(ifstmt); _cstack.Push(ifbranch); _sstack.Push(ifstmt); return ifstmt; }
/// <summary> /// Resets the currently active statement hierarchy. /// </summary> /// <param name="root">new statement to take as root statement</param> protected virtual void Reset(CompoundStatement root) { _cstack.Clear(); _sstack.Clear(); _cstack.Push(root); _sstack.Push(root); }
public void AcceptCompoundStatement(CompoundStatement stmt) { foreach (Statement s in stmt.Statements) s.Accept(this); }
public void AcceptCompoundStatement(CompoundStatement stmt) { Statement last = null; foreach (Statement child in stmt.Statements) { if (last != null) last.Successor = child; last = child; } if (stmt.Statements.Count > 0) { stmt.Statements.Last().Successor = stmt.Successor; } foreach (Statement child in stmt.Statements) { child.Accept(this); } }
public void AcceptCompoundStatement(CompoundStatement stmt) { stmt.Statements.Accept(this); }
public void AcceptCompoundStatement(CompoundStatement stmt) { GenerateComments(stmt); LoopBlock forLoop = stmt.AsForLoop(EForLoopLevel.StrictOneInc); if (forLoop != null) { if (forLoop.Label != null) _tw.Write(forLoop.Label + ": "); GenerateForLoop(forLoop); } else { foreach (Statement substmt in stmt.Statements) substmt.AcceptIfEnabled(this); } }