/// <summary>
 /// Initializes a new instance of the ArgumentListWrapper class.
 /// </summary>
 /// <param name="argumentList">The list of arguments.</param>
 public ArgumentListWrapper(ArgumentList argumentList)
 {
     Param.AssertNotNull(argumentList, "argumentList");
     this.argumentList = argumentList;
 }
        /// <summary>
        /// Reads the argument list for a method invocation expression.
        /// </summary>
        /// <param name="expressionProxy">Proxy object for the expression being created.</param>
        /// <param name="closingSymbol">The symbol that closes the argument list.</param>
        /// <param name="unsafeCode">Indicates whether the code being parsed resides in an unsafe code block.</param>
        /// <returns>Returns the list of arguments in the method invocation.</returns>
        private ArgumentList GetArgumentList(CodeUnitProxy expressionProxy, SymbolType closingSymbol, bool unsafeCode)
        {
            Param.AssertNotNull(expressionProxy, "expressionProxy");
            Param.AssertNotNull(closingSymbol, "closingSymbol");
            Param.Ignore(unsafeCode);

            var argumentListProxy = new CodeUnitProxy(this.document);

            Symbol symbol = this.PeekNextSymbol();

            while (symbol != null)
            {
                this.AdvanceToNextCodeSymbol(argumentListProxy);

                symbol = this.PeekNextSymbol();
                if (symbol.SymbolType == closingSymbol)
                {
                    break;
                }

                var argumentProxy = new CodeUnitProxy(this.document);
                if (symbol.SymbolType == SymbolType.Ref)
                {
                    this.GetToken(argumentProxy, TokenType.Ref, SymbolType.Ref);
                }
                else if (symbol.SymbolType == SymbolType.Out)
                {
                    this.GetToken(argumentProxy, TokenType.Out, SymbolType.Out);
                }
                else if (symbol.SymbolType == SymbolType.Params)
                {
                    this.GetToken(argumentProxy, TokenType.Params, SymbolType.Params);
                }

                this.GetNextExpression(argumentProxy, ExpressionPrecedence.None, unsafeCode);
                argumentListProxy.Children.Add(new Argument(argumentProxy));

                symbol = this.PeekNextSymbol();
                if (symbol.SymbolType == SymbolType.Comma)
                {
                    this.GetToken(argumentListProxy, TokenType.Comma, SymbolType.Comma);
                }
            }

            var argumentList = new ArgumentList(argumentListProxy);
            expressionProxy.Children.Add(argumentList);

            return argumentList;
        }