Пример #1
0
        internal static WithThreeChildren List(GreenNode child0, GreenNode child1, GreenNode child2)
        {
            RoslynDebug.Assert(child0 != null);
            RoslynDebug.Assert(child1 != null);
            RoslynDebug.Assert(child2 != null);

            int       hash;
            GreenNode?cached = SyntaxNodeCache.TryGetNode(
                GreenNode.ListKind,
                child0,
                child1,
                child2,
                out hash
                );

            if (cached != null)
            {
                return((WithThreeChildren)cached);
            }

            var result = new WithThreeChildren(child0, child1, child2);

            if (hash >= 0)
            {
                SyntaxNodeCache.AddNode(result, hash);
            }

            return(result);
        }
Пример #2
0
        internal static WithTwoChildren List(GreenNode child0, GreenNode child1)
        {
            Debug.Assert(child0 != null);
            Debug.Assert(child1 != null);

            GreenNode cached = SyntaxNodeCache.TryGetNode(GreenNode.ListKind, child0, child1, out int hash);

            if (cached != null)
            {
                return((WithTwoChildren)cached);
            }

            WithTwoChildren result = new WithTwoChildren(child0, child1);

            if (hash >= 0)
            {
                SyntaxNodeCache.AddNode(result, hash);
            }

            return(result);
        }