()
| 2737 | } |
| 2738 | |
| 2739 | private AstNode condExpr() throws IOException { |
| 2740 | AstNode pn = nullishCoalescingExpr(); |
| 2741 | if (matchToken(Token.HOOK, true)) { |
| 2742 | int qmarkPos = ts.tokenBeg, colonPos = -1; |
| 2743 | /* |
| 2744 | * Always accept the 'in' operator in the middle clause of a ternary, |
| 2745 | * where it's unambiguous, even if we might be parsing the init of a |
| 2746 | * for statement. |
| 2747 | */ |
| 2748 | boolean wasInForInit = inForInit; |
| 2749 | inForInit = false; |
| 2750 | AstNode ifTrue; |
| 2751 | try { |
| 2752 | ifTrue = assignExpr(); |
| 2753 | } finally { |
| 2754 | inForInit = wasInForInit; |
| 2755 | } |
| 2756 | if (mustMatchToken(Token.COLON, "msg.no.colon.cond", true)) colonPos = ts.tokenBeg; |
| 2757 | AstNode ifFalse = assignExpr(); |
| 2758 | int beg = pn.getPosition(), len = getNodeEnd(ifFalse) - beg; |
| 2759 | ConditionalExpression ce = new ConditionalExpression(beg, len); |
| 2760 | ce.setLineColumnNumber(pn.getLineno(), pn.getColumn()); |
| 2761 | ce.setTestExpression(pn); |
| 2762 | ce.setTrueExpression(ifTrue); |
| 2763 | ce.setFalseExpression(ifFalse); |
| 2764 | ce.setQuestionMarkPosition(qmarkPos - beg); |
| 2765 | ce.setColonPosition(colonPos - beg); |
| 2766 | pn = ce; |
| 2767 | } |
| 2768 | return pn; |
| 2769 | } |
| 2770 | |
| 2771 | private AstNode nullishCoalescingExpr() throws IOException { |
| 2772 | AstNode pn = orExpr(); |
no test coverage detected