コード例 #1
0
ファイル: Model.cs プロジェクト: thisiscam/formula
 internal void AddContract(ContractItem ci, bool addLast = true)
 {
     Contract.Requires(ci != null && CanHaveContract(ci.ContractKind));
     if (addLast)
     {
         contracts.AddLast(ci);
     }
     else
     {
         contracts.AddFirst(ci);
     }
 }
コード例 #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);
     }
 }
コード例 #3
0
ファイル: ContractItem.cs プロジェクト: thisiscam/formula
        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);
        }
コード例 #4
0
ファイル: ContractItem.cs プロジェクト: thisiscam/formula
        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);
        }
コード例 #5
0
ファイル: ContractItem.cs プロジェクト: thisiscam/formula
 private ContractItem(ContractItem n, bool keepCompilerData)
     : base(n.Span)
 {
     ContractKind = n.ContractKind;
     CompilerData = keepCompilerData ? n.CompilerData : null;
 }