Esempio n. 1
0
        // ECMA-262 12.3.3 The new Operator

        public Node parseNewExpression()
        {
            Node callee;
            List<Node> args;
            Node node = new Node();

            expectKeyword("new");

            if (match("."))
            {
                lex();
                if (lookahead.type == TokenType.Identifier && lookahead.value == "target")
                {
                    if (state.inFunctionBody)
                    {
                        lex();
                        return node.finishMetaProperty("new", "target");
                    }
                }
                throwUnexpectedToken(lookahead);
            }

            callee = isolateCoverGrammar(parseLeftHandSideExpression);
            args = match("(") ? parseArguments() : new List<Node>();

            isAssignmentTarget = isBindingElement = false;

            return node.finishNewExpression(callee, args);
        }