public static void Free(ContainsYieldWalker walker) { walker.SearchForYieldBreak = true; walker.SearchForYieldReturn = true; walker.YieldStatement = null; _cachedInstance = walker; }
private static bool ContainsYieldCore(BlockSyntax block, TextSpan?span, bool yieldReturn, bool yieldBreak) { ContainsYieldWalker walker = Create(span, yieldReturn, yieldBreak); walker.VisitBlock(block); return(walker._success); }
public static ContainsYieldWalker GetInstance() { ContainsYieldWalker walker = _cachedInstance; if (walker != null) { Debug.Assert(walker.YieldStatement == null); _cachedInstance = null; return(walker); } return(new ContainsYieldWalker()); }
public static ContainsYieldWalker GetInstance() { ContainsYieldWalker walker = _cachedInstance; if (walker != null) { _cachedInstance = null; } else { walker = new ContainsYieldWalker(); } return(walker); }
public static bool ContainsYield(SyntaxNode node, TextSpan?span = null, bool yieldReturn = true, bool yieldBreak = true) { if (node == null) { throw new ArgumentNullException(nameof(node)); } if (node.Kind() == SyntaxKind.LocalFunctionStatement) { return(ContainsYield((LocalFunctionStatementSyntax)node, span, yieldReturn, yieldBreak)); } ContainsYieldWalker walker = Create(span, yieldReturn, yieldBreak); walker.Visit(node); return(walker._success); }
public static bool ContainsYield(StatementSyntax statement, bool searchForYieldReturn = true, bool searchForYieldBreak = true) { if (statement == null) { throw new ArgumentNullException(nameof(statement)); } ContainsYieldWalker walker = GetInstance(); walker.SearchForYieldBreak = searchForYieldBreak; walker.SearchForYieldReturn = searchForYieldReturn; walker.VisitStatement(statement); bool success = walker.YieldStatement != null; Free(walker); return(success); }
public static void Free(ContainsYieldWalker walker) { walker.Reset(); _cachedInstance = walker; }