public BoundInvalidExpression(BaseExpressionSyntax syntax, bool hasValue, bool hasErrors) : base(hasValue, hasErrors) { Debug.Assert(!syntax.IsDefault(), "'syntax' must not be null."); this.Syntax = syntax; }
private List <ArgumentSyntax> ParseArguments() { var arguments = new List <ArgumentSyntax>(); BaseExpressionSyntax currentArgument = null; while (this.index < this.tokens.Count) { if (!currentArgument.IsDefault()) { switch (this.Peek()) { case TokenKind.Comma: var commaTokenOpt = this.Eat(TokenKind.Comma); arguments.Add(new ArgumentSyntax(currentArgument, commaTokenOpt)); currentArgument = null; break; case TokenKind.RightParen: arguments.Add(new ArgumentSyntax(currentArgument, commaTokenOpt: null)); return(arguments); case TokenKind foundKind: this.diagnostics.ReportUnexpectedTokenFound(this.tokens[this.index].Range, foundKind, TokenKind.Comma); arguments.Add(new ArgumentSyntax(currentArgument, commaTokenOpt: null)); currentArgument = null; break; } } else if (this.Peek() == TokenKind.RightParen) { return(arguments); } else { currentArgument = this.ParseBaseExpression(); } } if (!currentArgument.IsDefault()) { arguments.Add(new ArgumentSyntax(currentArgument, commaTokenOpt: null)); } return(arguments); }