示例#1
0
        // ECMA-262 14.4 Yield expression

        public Node parseYieldExpression()
        {
            Node argument;
            Node expr;
            bool @delegate = false;
            bool previousAllowYield;

            argument = null;
            expr = new Node();

            expectKeyword("yield");

            if (!hasLineTerminator)
            {
                previousAllowYield = state.allowYield;
                state.allowYield = false;
                @delegate = match("*");
                if (@delegate)
                {
                    lex();
                    argument = parseAssignmentExpression();
                }
                else
                {
                    if (!match(";") && !match("}") && !match(")") && lookahead.type != TokenType.EOF)
                    {
                        argument = parseAssignmentExpression();
                    }
                }
                state.allowYield = previousAllowYield;
            }

            return expr.finishYieldExpression(argument, @delegate);
        }