/// <summary> /// Would be the same as BlockStack.Peek() but only returns the topmost block of given type /// </summary> /// <returns></returns> public T GetTopMostBlock <T>() where T : ParsedScope { T output = BlockStack.Peek() as T; var i = 0; while (output == null) { i++; if (i >= BlockStack.Count) { break; } output = BlockStack.ElementAt(i) as T; } return(output); }
internal SyntaxTreeNode AddNodeToCurrentBlock(SyntaxTreeNode node) { BlockStack.Peek().Block.Add(node); return(node); }