internal void AddFact(ModelFact f, bool addLast = true) { Contract.Requires(f != null); if (addLast) { facts.AddLast(f); } else { facts.AddFirst(f); } }
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); }
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); }
private ModelFact(ModelFact n, bool keepCompilerData) : base(n.Span) { CompilerData = keepCompilerData ? n.CompilerData : null; }