public void DoWhileStatementTest() { DoWhileStatement loopStmt = ParseUtilCSharp.ParseStatement <DoWhileStatement>("do { } while (true);"); Assert.IsTrue(loopStmt.Condition is PrimitiveExpression); Assert.IsTrue(loopStmt.EmbeddedStatement is BlockStatement); }
public override AstNode VisitDoWhileStatement(DoWhileStatement forStatement) { var visitor = new LambdaVisitor(); forStatement.EmbeddedStatement.AcceptVisitor(visitor); if (visitor.LambdaExpression.Count == 0 && forStatement.EmbeddedStatement is BlockStatement) { return(base.VisitDoWhileStatement(forStatement)); } var clonForStatement = (DoWhileStatement)base.VisitDoWhileStatement(forStatement); if (clonForStatement != null) { forStatement = clonForStatement; } if (!(forStatement.EmbeddedStatement is BlockStatement)) { var l = (DoWhileStatement)forStatement.Clone(); var block = new BlockStatement(); block.Statements.Add(l.EmbeddedStatement.Clone()); l.EmbeddedStatement = block; return(l); } return(forStatement.Clone()); }
public override AstNode VisitDoWhileStatement(DoWhileStatement forStatement) { if (forStatement.EmbeddedStatement is BlockStatement) { return(base.VisitDoWhileStatement(forStatement)); } var clonForStatement = (DoWhileStatement)base.VisitDoWhileStatement(forStatement); if (clonForStatement != null) { forStatement = clonForStatement; } if (!(forStatement.EmbeddedStatement is BlockStatement)) { var l = (DoWhileStatement)forStatement.Clone(); var block = new BlockStatement(); block.Statements.Add(l.EmbeddedStatement.Clone()); l.EmbeddedStatement = block; return(l); } return(forStatement.Clone()); }
/// <summary> /// http://www.ecma-international.org/ecma-262/5.1/#sec-12.6.1 /// </summary> /// <param name="doWhileStatement"></param> /// <returns></returns> public Completion ExecuteDoWhileStatement(DoWhileStatement doWhileStatement) { JsValue v = Undefined.Instance; bool iterating; do { var stmt = ExecuteStatement(doWhileStatement.Body); if (stmt.Value.HasValue) { v = stmt.Value.Value; } if (stmt.Type != Completion.Continue || stmt.Identifier != doWhileStatement.LabelSet) { if (stmt.Type == Completion.Break && (stmt.Identifier == null || stmt.Identifier == doWhileStatement.LabelSet)) { return(new Completion(Completion.Normal, v, null)); } if (stmt.Type != Completion.Normal) { return(stmt); } } var exprRef = _engine.EvaluateExpression(doWhileStatement.Test); iterating = TypeConverter.ToBoolean(_engine.GetValue(exprRef)); } while (iterating); return(new Completion(Completion.Normal, v, null)); }
public DoWhileExpressionInterpreter(ExpressionInterpreterHandler expressionInterpreterHandler, DoWhileStatement doWhileStatement, LabelTarget brk, LabelTarget cont) { this.expressionInterpreterHandler = expressionInterpreterHandler; this.doWhileStatement = doWhileStatement; this.brk = brk; this.cont = cont; }
static void ConvertToWhileLoop(Script script, DoWhileStatement originalStatement) { script.Replace(originalStatement, new WhileStatement { Condition = originalStatement.Condition.Clone(), EmbeddedStatement = originalStatement.EmbeddedStatement.Clone() }); }
protected void VisitDoWhileStatement() { DoWhileStatement doWhileStatement = this.DoWhileStatement; var jumpStatements = this.Emitter.JumpStatements; this.Emitter.JumpStatements = null; this.WriteDo(); this.EmitBlockOrIndentedLine(doWhileStatement.EmbeddedStatement); if (doWhileStatement.EmbeddedStatement is BlockStatement) { this.WriteSpace(); } this.WriteWhile(); this.WriteOpenParentheses(); doWhileStatement.Condition.AcceptVisitor(this.Emitter); this.WriteCloseParentheses(); this.WriteSemiColon(); this.WriteNewLine(); this.Emitter.JumpStatements = jumpStatements; }
bool ParseDoWhileStatement(out DoWhileStatement doWhileStatement) { doWhileStatement = new DoWhileStatement(); if (tokenReader.Expect(LexKind.Keyword) && tokenReader.ExpectValue("do")) { tokenReader.Skip(1); if (ParseStatement(out Statement body)) { doWhileStatement.Body = body; if (tokenReader.ExpectFatal(LexKind.Keyword) && tokenReader.ExpectValue("while")) { tokenReader.Skip(2); if (ParseExpression(out Expression condition)) { doWhileStatement.Condition = condition; return(true); } else { throw new Exception("Condition expected in do-while loop"); } } } else { throw new Exception("Body expected in do-while loop"); } } return(false); }
/// <summary> /// Generates the code for a DoWhileStatement node. /// </summary> /// <param name="dws">The DoWhileStatement node.</param> /// <returns>String containing C# code for DoWhileStatement dws.</returns> private string GenerateDoWhileStatement(DoWhileStatement dws) { string retstr = String.Empty; retstr += GenerateIndentedLine("do", dws); // CompoundStatement handles indentation itself but we need to do it // otherwise. bool indentHere = dws.kids.Top is Statement; if (indentHere) { m_braceCount++; } retstr += GenerateNode((SYMBOL)dws.kids.Pop()); if (indentHere) { m_braceCount--; } retstr += GenerateIndented("while (", dws); retstr += GenerateNode((SYMBOL)dws.kids.Pop()); retstr += GenerateLine(");"); return(retstr); }
public virtual void VisitDoWhileStatement(DoWhileStatement doWhileStatement) { if (this.ThrowException) { throw (System.Exception) this.CreateException(doWhileStatement); } }
public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement) { var token = CreateBlock(string.Format("while ({0})", doWhileStatement.Condition.GetText()), SDNodeRole.DoWhileLoop); _tokenList.Add(token); VisitChildren(token.Statements, doWhileStatement.EmbeddedStatement); }
private UstStmts.DoWhileStatement VisitDoWhileStatement(DoWhileStatement doWhileStatement) { var statement = VisitStatement(doWhileStatement.Body); var condition = VisitExpression(doWhileStatement.Test); return(new UstStmts.DoWhileStatement(statement, condition, GetTextSpan(doWhileStatement))); }
static void ConvertToWhileLoop(Script script, DoWhileStatement originalStatement) { script.Replace(originalStatement, new WhileStatement { Condition = originalStatement.Condition.Clone(), EmbeddedStatement = originalStatement.EmbeddedStatement.Clone() }); }
public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement) { if (findReturn) { base.VisitDoWhileStatement(doWhileStatement); } }
public virtual void VisitDoWhileStatement(DoWhileStatement doWhileStatement) { if (ThrowException) { throw (Exception)CreateException(doWhileStatement); } }
public override ControlFlowNode VisitDoWhileStatement(DoWhileStatement doWhileStatement, ControlFlowNode data) { // <data> do { <bodyStart> embeddedStmt; <bodyEnd>} <condition> while(cond); <end> ControlFlowNode end = builder.CreateEndNode(doWhileStatement, addToNodeList: false); ControlFlowNode conditionNode = builder.CreateSpecialNode(doWhileStatement, ControlFlowNodeType.LoopCondition, addToNodeList: false); breakTargets.Push(end); continueTargets.Push(conditionNode); ControlFlowNode bodyStart = builder.CreateStartNode(doWhileStatement.EmbeddedStatement); Connect(data, bodyStart); ControlFlowNode bodyEnd = doWhileStatement.EmbeddedStatement.AcceptVisitor(this, bodyStart); Connect(bodyEnd, conditionNode); bool?cond = builder.EvaluateCondition(doWhileStatement.Condition); if (cond != false) { Connect(conditionNode, bodyStart, ControlFlowEdgeType.ConditionTrue); } if (cond != true) { Connect(conditionNode, end, ControlFlowEdgeType.ConditionFalse); } breakTargets.Pop(); continueTargets.Pop(); builder.nodes.Add(conditionNode); builder.nodes.Add(end); return(end); }
protected override void VisitDoWhileStatement(DoWhileStatement doWhileStatement) { using (StartNodeObject(doWhileStatement)) { Member("body", doWhileStatement.Body); Member("test", doWhileStatement.Test); } }
public JNode VisitDoWhileStatement(DoWhileStatement node) { var node2 = new JDoWhileStatement { Statement = VisitStatement(node.EmbeddedStatement), Condition = VisitExpression(node.Condition) }; return(node2); }
public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement) { var token = CreateBlock(string.Format("while ({0})", doWhileStatement.Condition.GetText()), SDNodeRole.DoWhileLoop); _tokenList.Add(token); VisitChildren(token.Statements, doWhileStatement.EmbeddedStatement); }
public override void Visit(DoWhileStatement node) { VisitNode(node.Body); VisitNode(node.Condition); Visit((LoopStatement)node); WriteEdge(node, node.Body, "body"); WriteEdge(node, node.Condition, "condition"); }
void ApplyAction(Script script, WhileStatement statement) { var doWhile = new DoWhileStatement { Condition = statement.Condition.Clone(), EmbeddedStatement = statement.EmbeddedStatement.Clone() }; script.Replace(statement, doWhile); }
public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement) { this.loopLevel++; doWhileStatement.EmbeddedStatement = GetLoopBlock(doWhileStatement.EmbeddedStatement); base.VisitDoWhileStatement(doWhileStatement); this.loopLevel--; }
protected virtual IEnumerable <Syntax> TranslateDoWhileStatement(DoWhileStatement doWhileStatement, ILTranslationContext data) { var bs = new S.DoStatement(); bs.Condition = GetExpression(doWhileStatement.Condition, data); bs.Statements = GetStatements(doWhileStatement.EmbeddedStatement, data); yield return(bs); }
public override void VisitDoWhileStatement(DoWhileStatement doLoopStatement) { base.VisitDoWhileStatement(doLoopStatement); BranchesCounter++; var conditionComplexity = GetConditionComplexity(doLoopStatement.Condition); BranchesCounter += conditionComplexity; }
void ApplyAction(Script script, WhileStatement statement) { var doWhile = new DoWhileStatement { Condition = statement.Condition.Clone(), EmbeddedStatement = statement.EmbeddedStatement.Clone() }; script.Replace(statement, doWhile); }
public override void VisitDoWhileStatement(DoWhileStatement whileStatement) { if (!(whileStatement.EmbeddedStatement is BlockStatement)) { Found = true; } base.VisitDoWhileStatement(whileStatement); }
public object VisitDoWhileStatement(DoWhileStatement s, object context) { StringBuilder.Append("do "); s.Body.AcceptVisitor(this, context); StringBuilder.Append(" while ("); s.Condition.AcceptVisitor(this, context); StringBuilder.Append(")"); return(null); }
public void Visit(DoWhileStatement expression) { outStream.WriteLine("do {"); expression.Statement.Accept(this); outStream.WriteLine(); outStream.Write("} while ("); expression.Condition.Accept(this); outStream.Write(")"); }
public override void VisitDoWhileStatement(DoWhileStatement node) { int index = body.Instructions.Count; Visit(node.Body); Visit(node.Condition); cil.EmitInstruction(OpCodes.Brtrue, body.Instructions[index]); }
public RedILNode VisitDoWhileStatement(DoWhileStatement doWhileStatement, State data) { var doWhile = new DoWhileNode(); doWhile.Condition = CastUtilities.CastRedILNode <ExpressionNode>(doWhileStatement.Condition.AcceptVisitor(this, data.NewState(doWhileStatement, doWhile))); doWhile.Body = RemoveFirstLevelContinue(CastUtilities.CastRedILNode <BlockNode>( doWhileStatement.EmbeddedStatement.AcceptVisitor(this, data.NewState(doWhileStatement, doWhile))), data); return(doWhile); }
protected void VisitAsyncDoWhileStatement() { DoWhileStatement doWhileStatement = this.DoWhileStatement; var oldValue = this.Emitter.ReplaceAwaiterByVar; var jumpStatements = this.Emitter.JumpStatements; this.Emitter.JumpStatements = new List <IJumpInfo>(); var loopStep = this.Emitter.AsyncBlock.Steps.Last(); if (!string.IsNullOrWhiteSpace(loopStep.Output.ToString())) { loopStep = this.Emitter.AsyncBlock.AddAsyncStep(); } this.Emitter.IgnoreBlock = doWhileStatement.EmbeddedStatement; doWhileStatement.EmbeddedStatement.AcceptVisitor(this.Emitter); this.Emitter.AsyncBlock.Steps.Last().JumpToStep = this.Emitter.AsyncBlock.Step; var conditionStep = this.Emitter.AsyncBlock.AddAsyncStep(); this.WriteAwaiters(doWhileStatement.Condition); this.WriteIf(); this.WriteOpenParentheses(true); this.Emitter.ReplaceAwaiterByVar = true; doWhileStatement.Condition.AcceptVisitor(this.Emitter); this.WriteCloseParentheses(true); this.Emitter.ReplaceAwaiterByVar = oldValue; this.WriteSpace(); this.BeginBlock(); this.WriteNewLine(); this.Write(JS.Vars.ASYNC_STEP + " = " + loopStep.Step + ";"); this.WriteNewLine(); this.Write("continue;"); this.WriteNewLine(); this.EndBlock(); var nextStep = this.Emitter.AsyncBlock.AddAsyncStep(); conditionStep.JumpToStep = nextStep.Step; if (this.Emitter.JumpStatements.Count > 0) { this.Emitter.JumpStatements.Sort((j1, j2) => - j1.Position.CompareTo(j2.Position)); foreach (var jump in this.Emitter.JumpStatements) { jump.Output.Insert(jump.Position, jump.Break ? nextStep.Step : conditionStep.Step); } } this.Emitter.JumpStatements = jumpStatements; }
public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement) { bool oldIsInsideLoop = _isInsideLoop; try { _isInsideLoop = true; base.VisitDoWhileStatement(doWhileStatement); } finally { _isInsideLoop = oldIsInsideLoop; } }
public override void VisitDoWhileStatement(DoWhileStatement node) { WriteKeyword("do"); WriteLine(); Visit(node.Body); WriteKeyword("while"); WriteSpace(); WriteBetweenParenthesis(node.Condition); WriteToken(";"); WriteLine(); }
public void Visit(DoWhileStatement node) { if (node != null) { // do-while statements TECHNICALLY should end with a semicolon. // but IE seems to parse do-while statements WITHOUT the semicolon, so // the terminating semicolon ends up being an empty statement AFTER the // do-while. Which throws off else or other do-while while-clauses. DoesRequire = true; } }
public override object VisitDoWhileStatement(DoWhileStatement doWhileStatement, object data) { if (doWhileStatement.EmbeddedStatement is BlockStatement) { foreach (Statement innerstatement in (BlockStatement)doWhileStatement.EmbeddedStatement) { if (innerstatement is WhileStatement || innerstatement is DoWhileStatement) UnlockWith(doWhileStatement); } } return base.VisitDoWhileStatement(doWhileStatement, data); }
static BlockStatement ReplaceJump(JumpStatement jump, BlockStatement block) { if (jump.StartOffset < block.StartOffset) throw new ArgumentOutOfRangeException("jump", "jump should be inside the given block"); if (jump.JumpOffset > block.EndOffset) throw new ArgumentOutOfRangeException("jump", "jump should be inside the given block"); var newBlock = new BlockStatement(); var doWhileStatement = new DoWhileStatement(jump.Condition, new BlockStatement()){ StartOffset = jump.StartOffset, EndOffset = jump.JumpOffset }; var inside = false; foreach (var statement in block) { if (statement.StartOffset == jump.JumpOffset) { ((BlockStatement)doWhileStatement.Statement).AddStatement(statement); inside = true; } else if (statement.StartOffset == jump.StartOffset) { if (doWhileStatement == null) throw new InvalidOperationException("DoWhileStatement can't be null"); newBlock.AddStatement(doWhileStatement); doWhileStatement = null; inside = false; } else if (inside) { ((BlockStatement)doWhileStatement.Statement).AddStatement(statement); } else { var lastStatement = newBlock.LastOrDefault(); if (lastStatement != null && lastStatement.EndOffset > statement.StartOffset) { throw new NotSupportedException("invalid Statement"); } newBlock.AddStatement(statement); } } return newBlock; }
public virtual void VisitDoWhileStatement(DoWhileStatement doWhileStatement) { if (this.ThrowException) { throw (Exception)this.CreateException(doWhileStatement); } }
public void Visit(DoWhileStatement expression) { outStream.WriteLine("do {"); expression.Statement.Accept(this); outStream.WriteLine(); outStream.Write("} while ("); expression.Condition.Accept(this); outStream.Write(")"); }
private Statement ParseDoWhile(TokenSet followers) //^ requires this.currentToken == Token.Do; //^ ensures followers[this.currentToken] || this.currentToken == Token.EndOfFile; { SourceLocationBuilder slb = new SourceLocationBuilder(this.scanner.SourceLocationOfLastScannedToken); this.GetNextToken(); Statement body = this.ParseStatement(followers|Token.While); if (body is EmptyStatement) this.HandleError(body.SourceLocation, Error.PossibleMistakenNullStatement); this.Skip(Token.While); Expression condition = this.ParseParenthesizedExpression(false, followers|Token.Semicolon); DoWhileStatement result = new DoWhileStatement(body, condition, slb); this.SkipSemiColon(followers); return result; }
public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement) { new DoWhileBlock(this, doWhileStatement).Emit(); }
public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement) { PlaceOnNewLine(policy.PlaceWhileOnNewLine, doWhileStatement.WhileToken); FixEmbeddedStatment(policy.StatementBraceStyle, policy.WhileBraceForcement, doWhileStatement.EmbeddedStatement); }
public override StringBuilder VisitDoWhileStatement(DoWhileStatement doWhileStatement, int data) { var result = new StringBuilder("do"); var stmt = doWhileStatement.EmbeddedStatement; result.Append(Indent(stmt, stmt.AcceptVisitor(this, data))); result.Append("while (").Append(doWhileStatement.Condition.AcceptVisitor(this, data)).Append(");"); return result; }
public override object Visit (Do doStatement) { var result = new DoWhileStatement (); var location = LocationsBag.GetLocations (doStatement); result.AddChild (new CSharpTokenNode (Convert (doStatement.loc), "do".Length), DoWhileStatement.DoKeywordRole); result.AddChild ((MonoDevelop.CSharp.Ast.Statement)doStatement.EmbeddedStatement.Accept (this), WhileStatement.Roles.EmbeddedStatement); if (location != null) result.AddChild (new CSharpTokenNode (Convert (location[0]), "while".Length), DoWhileStatement.WhileKeywordRole); if (location != null) result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), DoWhileStatement.Roles.LPar); result.AddChild ((MonoDevelop.CSharp.Ast.Expression)doStatement.expr.Accept (this), DoWhileStatement.Roles.Condition); if (location != null) { result.AddChild (new CSharpTokenNode (Convert (location[2]), 1), DoWhileStatement.Roles.RPar); result.AddChild (new CSharpTokenNode (Convert (location[3]), 1), DoWhileStatement.Roles.Semicolon); } return result; }
public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement) { FixEmbeddedStatment(policy.StatementBraceStyle, doWhileStatement.EmbeddedStatement); PlaceOnNewLine(doWhileStatement.EmbeddedStatement is BlockStatement ? policy.WhileNewLinePlacement : NewLinePlacement.NewLine, doWhileStatement.WhileToken); Align(doWhileStatement.LParToken, doWhileStatement.Condition, policy.SpacesWithinWhileParentheses); ForceSpacesBeforeRemoveNewLines(doWhileStatement.RParToken, policy.SpacesWithinWhileParentheses); }
public void VisitDoWhileStatement(DoWhileStatement doWhileStatement) { VisitExpression(doWhileStatement.Condition); VisitStatement(doWhileStatement.Body); }
public override void VisitDoWhileStatement (DoWhileStatement doWhileStatement) { base.VisitDoWhileStatement (doWhileStatement); CheckCondition (doWhileStatement.Condition); }
public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement) { if (findReturn) { base.VisitDoWhileStatement(doWhileStatement); } }
public void DoWhileStatementRequiresStatement() { var d = new DoWhileStatement(JS.Null(), null); Expect.Throw<InvalidOperationException>(() => d.ToString()); }
public void DoWhileStatementRequiresCondition() { var d = new DoWhileStatement(); Expect.Throw<InvalidOperationException>(() => d.ToString()); }
public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement) { }
/// <summary> /// Generates the code for a DoWhileStatement node. /// </summary> /// <param name="dws">The DoWhileStatement node.</param> /// <returns>String containing C# code for DoWhileStatement dws.</returns> private string GenerateDoWhileStatement(DoWhileStatement dws) { StringBuilder retVal = new StringBuilder(); retVal.Append(GenerateIndentedLine("do", dws)); if (IsParentEnumerable) { retVal.Append(GenerateLine("{")); // SLAM! retVal.Append(GenerateLine("if (CheckSlice()) yield return null;")); } // CompoundStatement handles indentation itself but we need to do it // otherwise. bool indentHere = dws.kids.Top is Statement; if (indentHere) m_braceCount++; retVal.Append(GenerateNode((SYMBOL) dws.kids.Pop())); if (indentHere) m_braceCount--; if (IsParentEnumerable) retVal.Append(GenerateLine("}")); bool marc = FuncCallsMarc(); //Forces all functions to use MoveNext() instead of .Current, as it never changes otherwise, and the loop runs infinitely m_isInEnumeratedDeclaration = true; retVal.Append(GenerateIndented("while (", dws)); retVal.Append(GenerateNode((SYMBOL) dws.kids.Pop())); retVal.Append(GenerateLine(");")); m_isInEnumeratedDeclaration = false; //End above return DumpFunc(marc) + retVal.ToString() + DumpAfterFunc(marc); }
public virtual void Visit(DoWhileStatement node) { DefaultVisit(node); }
public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement) { var body = CreateInnerCompiler().Compile(doWhileStatement.EmbeddedStatement); var compiledCondition = CompileExpression(doWhileStatement.Condition, true); if (compiledCondition.AdditionalStatements.Count > 0) body = new JsBlockStatement(body.Statements.Concat(compiledCondition.AdditionalStatements)); _result.Add(new JsDoWhileStatement(compiledCondition.Expression, body)); }
public virtual void VisitDoWhileStatement (DoWhileStatement doWhileStatement) { VisitChildren (doWhileStatement); }
public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement) { var body = CreateInnerCompiler().Compile(doWhileStatement.EmbeddedStatement); var compiledCondition = CompileExpression(doWhileStatement.Condition, CompileExpressionFlags.ReturnValueIsImportant); if (compiledCondition.AdditionalStatements.Count > 0) body = JsStatement.Block(body.Statements.Concat(compiledCondition.AdditionalStatements)); _result.Add(JsStatement.DoWhile(compiledCondition.Expression, body)); }
public abstract StringBuilder VisitDoWhileStatement(DoWhileStatement doWhileStatement, int data);
public override object Visit(Do doStatement) { var result = new DoWhileStatement(); var location = LocationsBag.GetLocations(doStatement); result.AddChild(new CSharpTokenNode(Convert(doStatement.loc), DoWhileStatement.DoKeywordRole), DoWhileStatement.DoKeywordRole); if (doStatement.Statement != null) result.AddChild((Statement)doStatement.Statement.Accept(this), Roles.EmbeddedStatement); if (location != null) result.AddChild(new CSharpTokenNode(Convert(location [0]), DoWhileStatement.WhileKeywordRole), DoWhileStatement.WhileKeywordRole); if (location != null && location.Count > 1) result.AddChild(new CSharpTokenNode(Convert(location [1]), Roles.LPar), Roles.LPar); if (doStatement.expr != null) result.AddChild((Expression)doStatement.expr.Accept(this), Roles.Condition); if (location != null && location.Count > 2) { result.AddChild(new CSharpTokenNode(Convert(location [2]), Roles.RPar), Roles.RPar); if (location.Count > 3) result.AddChild(new CSharpTokenNode(Convert(location [3]), Roles.Semicolon), Roles.Semicolon); } return result; }
public DoWhileBlock(IEmitter emitter, DoWhileStatement doWhileStatement) : base(emitter, doWhileStatement) { this.Emitter = emitter; this.DoWhileStatement = doWhileStatement; }
public void VisitDoWhileStatement(DoWhileStatement doWhileStatement) { StartNode(doWhileStatement); WriteKeyword(DoWhileStatement.DoKeywordRole); WriteEmbeddedStatement(doWhileStatement.EmbeddedStatement); WriteKeyword(DoWhileStatement.WhileKeywordRole); Space(policy.SpaceBeforeWhileParentheses); LPar(); Space(policy.SpacesWithinWhileParentheses); doWhileStatement.Condition.AcceptVisitor(this); Space(policy.SpacesWithinWhileParentheses); RPar(); Semicolon(); EndNode(doWhileStatement); }
public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement) { this.loopLevel++; doWhileStatement.EmbeddedStatement = GetLoopBlock (doWhileStatement.EmbeddedStatement); base.VisitDoWhileStatement (doWhileStatement); this.loopLevel--; }