()
| 2997 | // 12.9 The return statement |
| 2998 | |
| 2999 | function parseReturnStatement() { |
| 3000 | var argument = null; |
| 3001 | |
| 3002 | expectKeyword('return'); |
| 3003 | |
| 3004 | if (!state.inFunctionBody) { |
| 3005 | throwErrorTolerant({}, Messages.IllegalReturn); |
| 3006 | } |
| 3007 | |
| 3008 | // 'return' followed by a space and an identifier is very common. |
| 3009 | if (source.charCodeAt(index) === 0x20) { |
| 3010 | if (isIdentifierStart(source.charCodeAt(index + 1))) { |
| 3011 | argument = parseExpression(); |
| 3012 | consumeSemicolon(); |
| 3013 | return delegate.createReturnStatement(argument); |
| 3014 | } |
| 3015 | } |
| 3016 | |
| 3017 | if (peekLineTerminator()) { |
| 3018 | return delegate.createReturnStatement(null); |
| 3019 | } |
| 3020 | |
| 3021 | if (!match(';')) { |
| 3022 | if (!match('}') && lookahead.type !== Token.EOF) { |
| 3023 | argument = parseExpression(); |
| 3024 | } |
| 3025 | } |
| 3026 | |
| 3027 | consumeSemicolon(); |
| 3028 | |
| 3029 | return delegate.createReturnStatement(argument); |
| 3030 | } |
| 3031 | |
| 3032 | // 12.10 The with statement |
| 3033 |
no test coverage detected