本文整理汇总了C#中DoWhileStatement类的典型用法代码示例。如果您正苦于以下问题:C# DoWhileStatement类的具体用法?C# DoWhileStatement怎么用?C# DoWhileStatement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DoWhileStatement类属于命名空间,在下文中一共展示了DoWhileStatement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitDoWhileStatement
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);
}
示例2: ConvertToWhileLoop
static void ConvertToWhileLoop(Script script, DoWhileStatement originalStatement)
{
script.Replace(originalStatement, new WhileStatement {
Condition = originalStatement.Condition.Clone(),
EmbeddedStatement = originalStatement.EmbeddedStatement.Clone()
});
}
示例3: ApplyAction
void ApplyAction(Script script, WhileStatement statement) {
var doWhile = new DoWhileStatement {
Condition = statement.Condition.Clone(),
EmbeddedStatement = statement.EmbeddedStatement.Clone()
};
script.Replace(statement, doWhile);
}
示例4: VisitDoWhileStatement
public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement)
{
bool oldIsInsideLoop = _isInsideLoop;
try {
_isInsideLoop = true;
base.VisitDoWhileStatement(doWhileStatement);
}
finally {
_isInsideLoop = oldIsInsideLoop;
}
}
示例5: VisitDoWhileStatement
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);
}
示例6: ReplaceJump
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;
}
示例7: Visit
public void Visit(DoWhileStatement expression)
{
outStream.WriteLine("do {");
expression.Statement.Accept(this);
outStream.WriteLine();
outStream.Write("} while (");
expression.Condition.Accept(this);
outStream.Write(")");
}
示例8: ParseDoWhile
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;
}
示例9: VisitDoWhileStatement
public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement)
{
PlaceOnNewLine(policy.PlaceWhileOnNewLine, doWhileStatement.WhileToken);
FixEmbeddedStatment(policy.StatementBraceStyle, policy.WhileBraceForcement, doWhileStatement.EmbeddedStatement);
}
示例10: VisitDoWhileStatement
public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement)
{
if (findReturn)
{
base.VisitDoWhileStatement(doWhileStatement);
}
}
示例11: VisitDoWhileStatement
public void VisitDoWhileStatement(DoWhileStatement doWhileStatement)
{
VisitExpression(doWhileStatement.Condition);
VisitStatement(doWhileStatement.Body);
}
示例12: VisitDoWhileStatement
public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement)
{
new DoWhileBlock(this, doWhileStatement).Emit();
}
示例13: VisitDoWhileStatement
public override void VisitDoWhileStatement (DoWhileStatement doWhileStatement)
{
base.VisitDoWhileStatement (doWhileStatement);
CheckCondition (doWhileStatement.Condition);
}
示例14: VisitDoWhileStatement
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));
}
示例15: VisitDoWhileStatement
public virtual void VisitDoWhileStatement (DoWhileStatement doWhileStatement)
{
VisitChildren (doWhileStatement);
}