ShaderTools.Hlsl.Parser.DirectiveStack.GetPreviousIfElifElse C# (CSharp) Method

GetPreviousIfElifElse() private static method

private static GetPreviousIfElifElse ( ConsList directives ) : ConsList
directives ConsList
return ConsList
        private static ConsList<Directive> GetPreviousIfElifElse(ConsList<Directive> directives)
        {
            var current = directives;
            while (current != null && current.Any())
            {
                switch (current.Head.Kind)
                {
                    case SyntaxKind.IfDirectiveTrivia:
                    case SyntaxKind.IfDefDirectiveTrivia:
                    case SyntaxKind.IfNDefDirectiveTrivia:
                    case SyntaxKind.ElifDirectiveTrivia:
                    case SyntaxKind.ElseDirectiveTrivia:
                        return current;
                }

                current = current.Tail;
            }

            return current;
        }
    }