本文整理汇总了C#中DoStatementSyntax类的典型用法代码示例。如果您正苦于以下问题:C# DoStatementSyntax类的具体用法?C# DoStatementSyntax怎么用?C# DoStatementSyntax使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DoStatementSyntax类属于命名空间,在下文中一共展示了DoStatementSyntax类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitDoStatement
public override void VisitDoStatement(DoStatementSyntax node)
{
var token = CreateBlock($"while ({node.Condition})", SDNodeRole.DoWhileLoop);
_tokenList.Add(token);
VisitChildren(token.Statements, node.Statement);
}
示例2: BindDoStatement
private BoundStatement BindDoStatement(DoStatementSyntax syntax, Symbol parent)
{
BindAttributes(syntax.Attributes);
return new BoundDoStatement(
Bind(syntax.Condition, BindExpression),
Bind(syntax.Statement, x => BindStatement(x, parent)));
}
示例3: AddBraces
public static DoStatementSyntax AddBraces(DoStatementSyntax doStatement)
{
Debug.Assert(doStatement != null && NeedsBraces(doStatement));
return doStatement
.WithStatement(SyntaxFactory.Block(doStatement.Statement))
.WithAdditionalAnnotations(Formatter.Annotation);
}
示例4: BindDo
public BoundDoStatement BindDo(DoStatementSyntax node)
{
var condition = BindBooleanExpression(node.Condition);
var loopContext = this.containingMethod.BlockMap.GetValueOrDefault(node);
Debug.Assert(loopContext != null);
var analyzer = new SemanticAnalyzer(this.containingMethod, loopContext, this.diagnostics);
var body = analyzer.BindStatement(node.Statement);
return new BoundDoStatement(node, condition, body, loopContext.GetBreakLabel(), loopContext.GetContinueLabel());
}
示例5: VisitDoStatement
protected override SyntaxNode VisitDoStatement(DoStatementSyntax node)
{
if (!node.DescendentNodes().OfType<BlockSyntax>().Any())
{
node = node.Update (node.DoKeyword, Syntax.Block (statements: node.Statement), node.WhileKeyword,
node.OpenParenToken, node.Condition, node.CloseParenToken, node.SemicolonToken);
}
return base.VisitDoStatement (node);
}
示例6: VisitDoStatement
public override SyntaxNode VisitDoStatement(DoStatementSyntax node)
{
node = (DoStatementSyntax)base.VisitDoStatement(node);
if (!node.Statement.IsKind(SyntaxKind.Block))
{
this.addedAnnotations = true;
node = node.WithStatement(SyntaxFactory.Block(node.Statement));
}
return node;
}
示例7: Go
public static void Go(OutputWriter writer, DoStatementSyntax statement)
{
var info = new LoopInfo(statement);
writer.WriteLine("do");
writer.OpenBrace();
Core.WriteStatementAsBlock(writer, statement.Statement, false);
writer.CloseBrace();
writer.WriteIndent();
writer.Write("while (");
Core.Write(writer, statement.Condition);
writer.Write(");\r\n");
}
示例8: VisitDoStatement
public override SyntaxNode VisitDoStatement(DoStatementSyntax node)
{
node = (DoStatementSyntax)base.VisitDoStatement(node);
if (!node.CloseParenToken.IsMissing && node.Statement.Kind != SyntaxKind.Block)
{
return CodeAnnotations.Formatting.AddAnnotationTo(
Syntax.DoStatement(
node.DoKeyword,
WrapStatementWithBlock(node.Statement),
node.WhileKeyword,
node.OpenParenToken,
node.Condition,
node.CloseParenToken,
node.SemicolonToken));
}
else
{
return node;
}
}
示例9: VisitDoStatement
public virtual void VisitDoStatement(DoStatementSyntax node)
{
DefaultVisit(node);
}
示例10: VisitDoStatement
public override void VisitDoStatement(DoStatementSyntax node) => CheckNesting(node.DoKeyword, () => base.VisitDoStatement(node));
示例11: AreEquivalentActiveStatements
private static bool AreEquivalentActiveStatements(DoStatementSyntax oldNode, DoStatementSyntax newNode)
{
// only check the condition, edits in the body are allowed:
return AreEquivalentIgnoringLambdaBodies(oldNode.Condition, newNode.Condition);
}
示例12: VisitDoStatement
public override void VisitDoStatement(DoStatementSyntax node)
{
if (!YieldChecker.HasSpecialStatement(node))
{
currentState.Add(StateMachineThisFixer.Fix(node));
}
else
{
MaybeCreateNewState();
var nextState = GetNextState(node);
var conditionState = new State(this) { BreakState = nextState };
var iterationState = currentState;
conditionState.Add(Cs.If(StateMachineThisFixer.Fix(node.Condition), ChangeState(iterationState), ChangeState(nextState)));
conditionState.Add(GotoTop());
SetClosed(conditionState);
iterationState.NextState = conditionState;
node.Statement.Accept(this);
if (currentState != nextState)
{
Close(currentState);
}
currentState = nextState;
}
}
示例13: BindDo
public BoundDoStatement BindDo(DoStatementSyntax node, DiagnosticBag diagnostics)
{
var loopBinder = this.GetBinder(node);
Debug.Assert(loopBinder != null);
return loopBinder.BindDoParts(diagnostics, loopBinder);
}
示例14: InferTypeInDoStatement
private IEnumerable<ITypeSymbol> InferTypeInDoStatement(DoStatementSyntax doStatement, SyntaxToken? previousToken = null)
{
// If we have a position, we need to be after "do { } while("
if (previousToken.HasValue && previousToken.Value != doStatement.OpenParenToken)
{
return SpecializedCollections.EmptyEnumerable<ITypeSymbol>();
}
return SpecializedCollections.SingletonEnumerable(this.Compilation.GetSpecialType(SpecialType.System_Boolean));
}
示例15: HandleDoStatement
/// <summary>
/// Handles the given do statement.
/// </summary>
/// <param name="stmt">Statement</param>
/// <param name="successor">Successor</param>
private void HandleDoStatement(DoStatementSyntax stmt, ControlFlowGraphNode successor)
{
this.SyntaxNodes.Add(stmt.Condition);
this.IsLoopHeadNode = true;
if (successor != null)
{
this.ISuccessors.Add(successor);
successor.IPredecessors.Add(this);
this.LoopExitNode = successor;
}
var doNode = new ControlFlowGraphNode(this.Summary);
this.ISuccessors.Add(doNode);
doNode.IPredecessors.Add(this);
if (stmt.Statement is BlockSyntax)
{
doNode.Construct((stmt.Statement as BlockSyntax).Statements, 0, false, this);
}
else
{
doNode.Construct(new SyntaxList<StatementSyntax> { stmt.Statement }, 0, false, this);
}
}