MCPcopy Index your code
hub / github.com/apache/groovy / makePrefix

Method makePrefix

src/main/java/org/codehaus/groovy/syntax/Types.java:1073–1098  ·  view source on GitHub ↗

Converts an operator node's meaning to a prefix operator variant. For example, converts PLUS to PREFIX_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)

Source from the content-addressed store, hash-verified

1071 * @param throwIfInvalid if {@code true}, throws {@link GroovyBugError} if the type cannot be converted
1072 */
1073 public static void makePrefix(CSTNode node, boolean throwIfInvalid) {
1074
1075 switch (node.getMeaning()) {
1076 case PLUS:
1077 node.setMeaning(PREFIX_PLUS);
1078 break;
1079
1080 case MINUS:
1081 node.setMeaning(PREFIX_MINUS);
1082 break;
1083
1084 case PLUS_PLUS:
1085 node.setMeaning(PREFIX_PLUS_PLUS);
1086 break;
1087
1088 case MINUS_MINUS:
1089 node.setMeaning(PREFIX_MINUS_MINUS);
1090 break;
1091
1092 default:
1093 if (throwIfInvalid) {
1094 throw new GroovyBugError("cannot convert to prefix for type [" + node.getMeaning() + "]");
1095 }
1096 }
1097
1098 }
1099
1100 /**
1101 * Converts an operator node's meaning to a postfix operator variant.

Callers

nothing calls this directly

Calls 2

getMeaningMethod · 0.45
setMeaningMethod · 0.45

Tested by

no test coverage detected