Microsoft.CSharp.RuntimeBinder.Semantics.ExprFactory.AppendItemToList C# (CSharp) Method

AppendItemToList() public method

public AppendItemToList ( EXPR newItem, EXPR &first, EXPR &last ) : void
newItem EXPR
first EXPR
last EXPR
return void
        public void AppendItemToList(
            EXPR newItem,
            ref EXPR first,
            ref EXPR last
        )
        {
            if (newItem == null)
            {
                // Nothing changes.
                return;
            }
            if (first == null)
            {
                Debug.Assert(last == first);
                first = newItem;
                last = newItem;
                return;
            }
            if (first.kind != ExpressionKind.EK_LIST)
            {
                Debug.Assert(last == first);
                first = CreateList(first, newItem);
                last = first;
                return;
            }
            Debug.Assert(last.kind == ExpressionKind.EK_LIST);
            Debug.Assert(last.asLIST().OptionalNextListNode != null);
            Debug.Assert(last.asLIST().OptionalNextListNode.kind != ExpressionKind.EK_LIST);
            last.asLIST().OptionalNextListNode = CreateList(last.asLIST().OptionalNextListNode, newItem);
            last = last.asLIST().OptionalNextListNode;
        }

Usage Example

示例#1
0
        private Expr GenerateArgsList(Expr oldArgs)
        {
            Expr newArgs     = null;
            Expr newArgsTail = newArgs;

            for (ExpressionIterator it = new ExpressionIterator(oldArgs); !it.AtEnd(); it.MoveNext())
            {
                Expr oldArg = it.Current();
                ExprFactory.AppendItemToList(Visit(oldArg), ref newArgs, ref newArgsTail);
            }
            return(newArgs);
        }
All Usage Examples Of Microsoft.CSharp.RuntimeBinder.Semantics.ExprFactory::AppendItemToList