private static bool IsValidContinueKeywordContext(bool isStatementContext, SyntaxToken token) { if (!isStatementContext) { return(false); } foreach (var v in token.Ancestors().Cast <SyntaxNode>()) { if (v.IsContinuableConstruct()) { return(true); } } return(false); }
private static bool IsValidBreakKeywordContext(bool isStatementContext, SyntaxToken token) { if (!isStatementContext) { return(false); } foreach (var v in token.Ancestors()) { if (v.IsBreakableConstruct()) { return(true); } } return(false); }
public static SyntaxNode FindCommonAncestor(this SyntaxToken token, SyntaxToken otherToken) { var otherTokenAncestors = otherToken.Ancestors().ToList(); return(token.Ancestors().Cast <SyntaxNode>().FirstOrDefault(ancestor => otherTokenAncestors.Contains(ancestor))); }
private static bool IsValidContinueKeywordContext(bool isStatementContext, SyntaxToken token) { if (!isStatementContext) return false; foreach (var v in token.Ancestors()) if (v.IsContinuableConstruct()) return true; return false; }
public static SyntaxNode FindCommonAncestor(this SyntaxToken token, SyntaxToken otherToken) { var otherTokenAncestors = otherToken.Ancestors().ToList(); return token.Ancestors().FirstOrDefault(ancestor => otherTokenAncestors.Contains(ancestor)); }