示例#1
0
 internal void AddFact(ModelFact f, bool addLast = true)
 {
     Contract.Requires(f != null);
     if (addLast)
     {
         facts.AddLast(f);
     }
     else
     {
         facts.AddFirst(f);
     }
 }
示例#2
0
        internal override Node DeepClone(IEnumerable <Node> clonedChildren, bool keepCompilerData)
        {
            var cnode = new ModelFact(this, keepCompilerData);

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

                cnode.Binding = Binding == null ? null : TakeClone <Id>(cenum);
                cnode.Match   = TakeClone <Node>(cenum);
            }

            return(cnode);
        }
示例#3
0
        internal override Node ShallowClone(Node replace, int pos)
        {
            var cnode  = new ModelFact(this, true);
            int occurs = 0;

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

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

            cnode.Match = CloneField <Node>(Match, replace, pos, ref occurs);
            return(cnode);
        }
示例#4
0
 private ModelFact(ModelFact n, bool keepCompilerData)
     : base(n.Span)
 {
     CompilerData = keepCompilerData ? n.CompilerData : null;
 }