示例#1
0
        // ECMA-262 13.8 The continue statement

        public Node parseContinueStatement(Node node)
        {
            Node label = null;
            string key;

            expectKeyword("continue");

            // Optimize the most common form: "continue;".
            if (source.ToCharArray()[startIndex] == 0x3B)
            {
                lex();

                if (!state.inIteration)
                {
                    throwError(Messages.IllegalContinue);
                }

                return node.finishContinueStatement(null);
            }

            if (hasLineTerminator)
            {
                if (!state.inIteration)
                {
                    throwError(Messages.IllegalContinue);
                }

                return node.finishContinueStatement(null);
            }

            if (lookahead.type == TokenType.Identifier)
            {
                label = parseVariableIdentifier();

                key = "$" + label.name;
                //if (!Object.prototype.hasOwnProperty.p(state.labelSet, key)) {
                //    throwError(Messages.UnknownLabel, label.name);
                //}
            }

            consumeSemicolon();

            if (label == null && !state.inIteration)
            {
                throwError(Messages.IllegalContinue);
            }

            return node.finishContinueStatement(label);
        }