Example #1
0
        /// <summary>
        /// Initializes the contents of the statement.
        /// </summary>
        private void Initialize()
        {
            Token token = this.FindFirstChildToken();

            if (token == null)
            {
                throw new SyntaxException(this.Document, this.LineNumber);
            }
            else if (token.Is(TokenType.Break))
            {
                this.type.Value        = YieldStatement.Type.Break;
                this.returnValue.Value = null;
            }
            else if (token.Is(TokenType.Return))
            {
                this.type.Value        = YieldStatement.Type.Return;
                this.returnValue.Value = token.FindNextSiblingExpression();
            }
            else
            {
                throw new SyntaxException(this.Document, this.LineNumber);
            }
        }