示例#1
0
        protected IonContainerLite(IonContainerLite existing, IContext context, bool isStruct) : base(existing, context)
        {
            ChildCount = existing.ChildCount;
            if (existing.Children == null)
            {
                return;
            }

            var isDatagram = this is IonDatagramLite;

            Children = new IonValueLite[ChildCount];
            for (var i = 0; i < existing.Children.Length; i++)
            {
                var child        = existing.Children[i];
                var childContext = isDatagram
                    ? new TopLevelContext(child.GetAssignedSymbolTable(), this as IonDatagramLite)
                    : this as IContext;
                var copy = child.Clone(childContext);
                if (isStruct)
                {
                    if (child.FieldName == null)
                    {
                        // TODO figure out what this is
                        // when name is null it could be a sid 0 so we need to perform the full
                        // symbol token lookup.
                        // this is expensive so only do it when necessary
                        copy.FieldNameSymbol = child.GetKnownFieldNameSymbol();
                    }
                    else
                    {
                        copy.FieldName = child.FieldName;
                    }
                }

                Children[i] = copy;
            }
        }
示例#2
0
 public IonDatagramLite(IonContainerLite existing, IContext context, bool isStruct) : base(existing, context, isStruct)
 {
 }