Converts an operator node's meaning to a postfix operator variant. For example, converts PLUS_PLUS to POSTFIX_PLUS_PLUS. @param node the node whose meaning is to be modified @param throwIfInvalid if true, throws GroovyBugError if the type cannot be converted
(CSTNode node, boolean throwIfInvalid)
| 1105 | * @param throwIfInvalid if {@code true}, throws {@link GroovyBugError} if the type cannot be converted |
| 1106 | */ |
| 1107 | public static void makePostfix(CSTNode node, boolean throwIfInvalid) { |
| 1108 | |
| 1109 | switch (node.getMeaning()) { |
| 1110 | case PLUS_PLUS: |
| 1111 | node.setMeaning(POSTFIX_PLUS_PLUS); |
| 1112 | break; |
| 1113 | |
| 1114 | case MINUS_MINUS: |
| 1115 | node.setMeaning(POSTFIX_MINUS_MINUS); |
| 1116 | break; |
| 1117 | |
| 1118 | default: |
| 1119 | if (throwIfInvalid) { |
| 1120 | throw new GroovyBugError("cannot convert to postfix for type [" + node.getMeaning() + "]"); |
| 1121 | } |
| 1122 | } |
| 1123 | |
| 1124 | } |
| 1125 | |
| 1126 | |
| 1127 | //--------------------------------------------------------------------------- |
nothing calls this directly
no test coverage detected