()
| 2365 | // 11.4 Unary Operators |
| 2366 | |
| 2367 | function parseUnaryExpression() { |
| 2368 | var token, expr, startToken; |
| 2369 | |
| 2370 | if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) { |
| 2371 | expr = parsePostfixExpression(); |
| 2372 | } else if (match('++') || match('--')) { |
| 2373 | startToken = lookahead; |
| 2374 | token = lex(); |
| 2375 | expr = parseUnaryExpression(); |
| 2376 | // 11.4.4, 11.4.5 |
| 2377 | if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) { |
| 2378 | throwErrorTolerant({}, Messages.StrictLHSPrefix); |
| 2379 | } |
| 2380 | |
| 2381 | if (!isLeftHandSide(expr)) { |
| 2382 | throwErrorTolerant({}, Messages.InvalidLHSInAssignment); |
| 2383 | } |
| 2384 | |
| 2385 | expr = delegate.createUnaryExpression(token.value, expr); |
| 2386 | expr = delegate.markEnd(expr, startToken); |
| 2387 | } else if (match('+') || match('-') || match('~') || match('!')) { |
| 2388 | startToken = lookahead; |
| 2389 | token = lex(); |
| 2390 | expr = parseUnaryExpression(); |
| 2391 | expr = delegate.createUnaryExpression(token.value, expr); |
| 2392 | expr = delegate.markEnd(expr, startToken); |
| 2393 | } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) { |
| 2394 | startToken = lookahead; |
| 2395 | token = lex(); |
| 2396 | expr = parseUnaryExpression(); |
| 2397 | expr = delegate.createUnaryExpression(token.value, expr); |
| 2398 | expr = delegate.markEnd(expr, startToken); |
| 2399 | if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) { |
| 2400 | throwErrorTolerant({}, Messages.StrictDelete); |
| 2401 | } |
| 2402 | } else { |
| 2403 | expr = parsePostfixExpression(); |
| 2404 | } |
| 2405 | |
| 2406 | return expr; |
| 2407 | } |
| 2408 | |
| 2409 | function binaryPrecedence(token, allowIn) { |
| 2410 | var prec = 0; |
no test coverage detected