browser/pellets.js
function parseReturnStatement() {
        var token, argument = null;

        expectKeyword('return');

        if (!inFunctionBody) {
            throwErrorTolerant({}, Messages.IllegalReturn);
        }

        // 'return' followed by a space and an identifier is very common.
        if (source[index] === ' ') {
            if (isIdentifierStart(source[index + 1])) {
                argument = parseExpression();
                consumeSemicolon();
                return {
                    type: Syntax.ReturnStatement,
                    argument: argument
                };
            }
        }

        if (peekLineTerminator()) {
            return {
                type: Syntax.ReturnStatement,
                argument: null
            };
        }

        if (!match(';')) {
            token = lookahead();
            if (!match('}') && token.type !== Token.EOF) {
                argument = parseExpression();
            }
        }

        consumeSemicolon();

        return {
            type: Syntax.ReturnStatement,
            argument: argument
        };
    }
function parseReturnStatement() {
        var token, argument = null;

        expectKeyword('return');

        if (!inFunctionBody) {
            throwErrorTolerant({}, Messages.IllegalReturn);
        }

        // 'return' followed by a space and an identifier is very common.
        if (source[index] === ' ') {
            if (isIdentifierStart(source[index + 1])) {
                argument = parseExpression();
                consumeSemicolon();
                return {
                    type: Syntax.ReturnStatement,
                    argument: argument
                };
            }
        }

        if (peekLineTerminator()) {
            return {
                type: Syntax.ReturnStatement,
                argument: null
            };
        }

        if (!match(';')) {
            token = lookahead();
            if (!match('}') && token.type !== Token.EOF) {
                argument = parseExpression();
            }
        }

        consumeSemicolon();

        return {
            type: Syntax.ReturnStatement,
            argument: argument
        };
    }
function parseReturnStatement ( ) { var token , argument = null ; expectKeyword ( 'return' ) ; if ( ! inFunctionBody ) { throwErrorTolerant ( { } , Messages . IllegalReturn ) ; } // 'return' followed by a space and an identifier is very common. if ( source [ index ] === ' ' ) { if ( isIdentifierStart ( source [ index + 1 ] ) ) { argument = parseExpression ( ) ; consumeSemicolon ( ) ; return { type : Syntax . ReturnStatement , argument : argument } ; } } if ( peekLineTerminator ( ) ) { return { type : Syntax . ReturnStatement , argument : null } ; } if ( ! match ( ';' ) ) { token = lookahead ( ) ; if ( ! match ( '}' ) && token . type !== Token . EOF ) { argument = parseExpression ( ) ; } } consumeSemicolon ( ) ; return { type : Syntax . ReturnStatement , argument : argument } ; }
12.9 The return statement
12 . 9 The return statement