Exemplo n.º 1
0
        internal override Node ShallowClone(Node replace, int pos)
        {
            var cnode  = new Compr(this, true);
            int occurs = 0;

            cnode.Heads  = new ImmutableCollection <Node>(CloneCollection <Node>(heads, replace, pos, ref occurs, out cnode.heads));
            cnode.Bodies = new ImmutableCollection <Body>(CloneCollection <Body>(bodies, replace, pos, ref occurs, out cnode.bodies));
            return(cnode);
        }
Exemplo n.º 2
0
        internal override Node DeepClone(IEnumerable <Node> clonedChildren, bool keepCompilerData)
        {
            var cnode = new Compr(this, keepCompilerData);

            cnode.cachedHashCode = this.cachedHashCode;
            using (var cenum = clonedChildren.GetEnumerator())
            {
                cnode.Heads  = new ImmutableCollection <Node>(TakeClones <Node>(heads.Count, cenum, out cnode.heads));
                cnode.Bodies = new ImmutableCollection <Body>(TakeClones <Body>(bodies.Count, cenum, out cnode.bodies));
            }

            return(cnode);
        }
Exemplo n.º 3
0
 private Compr(Compr n, bool keepCompilerData)
     : base(n.Span)
 {
     CompilerData = keepCompilerData ? n.CompilerData : null;
 }