Example #1
0
 internal void AddContract(ContractItem ci, bool addLast = true)
 {
     Contract.Requires(ci != null && CanHaveContract(ci.ContractKind));
     if (addLast)
     {
         contracts.AddLast(ci);
     }
     else
     {
         contracts.AddFirst(ci);
     }
 }
Example #2
0
 internal void AddConforms(ContractItem ci, bool addLast = true)
 {
     Contract.Requires(ci != null);
     Contract.Requires(ci.ContractKind == ContractKind.ConformsProp);
     if (addLast)
     {
         conforms.AddLast(ci);
     }
     else
     {
         conforms.AddFirst(ci);
     }
 }
Example #3
0
        internal override Node ShallowClone(Node replace, int pos)
        {
            var cnode  = new ContractItem(this, true);
            int occurs = 0;

            if (Config != null)
            {
                cnode.Config = CloneField <Config>(Config, replace, pos, ref occurs);
            }

            cnode.Specification = new ImmutableCollection <Node>(CloneCollection <Node>(specification, replace, pos, ref occurs, out cnode.specification));
            return(cnode);
        }
Example #4
0
        internal override Node DeepClone(IEnumerable <Node> clonedChildren, bool keepCompilerData)
        {
            var cnode = new ContractItem(this, keepCompilerData);

            cnode.cachedHashCode = this.cachedHashCode;
            using (var cenum = clonedChildren.GetEnumerator())
            {
                if (Config != null)
                {
                    cnode.Config = TakeClone <Config>(cenum);
                }

                cnode.Specification = new ImmutableCollection <Node>(TakeClones <Node>(specification.Count, cenum, out cnode.specification));
            }

            return(cnode);
        }
Example #5
0
 private ContractItem(ContractItem n, bool keepCompilerData)
     : base(n.Span)
 {
     ContractKind = n.ContractKind;
     CompilerData = keepCompilerData ? n.CompilerData : null;
 }