@@ -3676,7 +3676,7 @@ private CodeExecutableElement createBegin(OperationModel operation) {
3676
3676
b.statement("tagNodes.add(node)");
3677
3677
}
3678
3678
3679
- if (operation.requiresRootOperation) {
3679
+ if (operation.requiresRootOperation() ) {
3680
3680
b.startStatement().startCall("validateRootOperationBegin").end(2);
3681
3681
}
3682
3682
@@ -4195,16 +4195,16 @@ private CodeExecutableElement createEnd(OperationModel operation) {
4195
4195
emitThrowIllegalStateException(b, "\"Operation " + operation.name + " expected at least " + childString(1) +
4196
4196
", but \" + operation.childCount + \" provided. This is probably a bug in the parser.\"");
4197
4197
b.end();
4198
- } else if (operation.isVariadic && operation.numChildren > 1) {
4198
+ } else if (operation.isVariadic && operation.numChildren() > 1) {
4199
4199
// The variadic child is included in numChildren, so the operation requires
4200
4200
// numChildren - 1 children at minimum.
4201
- b.startIf().string("operation.childCount < " + (operation.numChildren - 1)).end().startBlock();
4202
- emitThrowIllegalStateException(b, "\"Operation " + operation.name + " expected at least " + childString(operation.numChildren - 1) +
4201
+ b.startIf().string("operation.childCount < " + (operation.numChildren() - 1)).end().startBlock();
4202
+ emitThrowIllegalStateException(b, "\"Operation " + operation.name + " expected at least " + childString(operation.numChildren() - 1) +
4203
4203
", but \" + operation.childCount + \" provided. This is probably a bug in the parser.\"");
4204
4204
b.end();
4205
4205
} else if (!operation.isVariadic) {
4206
- b.startIf().string("operation.childCount != " + operation.numChildren).end().startBlock();
4207
- emitThrowIllegalStateException(b, "\"Operation " + operation.name + " expected exactly " + childString(operation.numChildren) +
4206
+ b.startIf().string("operation.childCount != " + operation.numChildren() ).end().startBlock();
4207
+ emitThrowIllegalStateException(b, "\"Operation " + operation.name + " expected exactly " + childString(operation.numChildren() ) +
4208
4208
", but \" + operation.childCount + \" provided. This is probably a bug in the parser.\"");
4209
4209
b.end();
4210
4210
}
@@ -5038,7 +5038,7 @@ private CodeExecutableElement createEmit(OperationModel operation) {
5038
5038
}
5039
5039
}
5040
5040
5041
- if (operation.requiresRootOperation) {
5041
+ if (operation.requiresRootOperation() ) {
5042
5042
b.startStatement().startCall("validateRootOperationBegin").end(2);
5043
5043
}
5044
5044
@@ -5153,7 +5153,7 @@ private List<String> emitConstantOperands(CodeTreeBuilder b, OperationModel oper
5153
5153
return List.of();
5154
5154
}
5155
5155
5156
- boolean inEmit = operation.numChildren == 0 ;
5156
+ boolean inEmit = ! operation.hasChildren() ;
5157
5157
List<String> result = new ArrayList<>(numConstantOperands);
5158
5158
for (int i = 0; i < numConstantOperands; i++) {
5159
5159
if (i < constantOperandsBefore.size()) {
@@ -5195,11 +5195,11 @@ private String[] buildCustomInitializer(CodeTreeBuilder b, OperationModel operat
5195
5195
b.statement("doEmitVariadic(operation.childCount - " + (instruction.signature.dynamicOperandCount - 1) + ")");
5196
5196
}
5197
5197
5198
- if (customChildBci != null && operation.numChildren > 1) {
5198
+ if (customChildBci != null && operation.numChildren() > 1) {
5199
5199
throw new AssertionError("customChildBci can only be used with a single child.");
5200
5200
}
5201
5201
5202
- boolean inEmit = operation.numChildren == 0 ;
5202
+ boolean inEmit = ! operation.hasChildren() ;
5203
5203
5204
5204
if (!inEmit) {
5205
5205
// make "operationData" available for endX methods.
@@ -5279,7 +5279,7 @@ private CodeExecutableElement createBeforeChild() {
5279
5279
b.startSwitch().string("operationStack[operationSp - 1].operation").end().startBlock();
5280
5280
5281
5281
Map<BeforeChildKind, List<OperationModel>> groupedOperations = model.getOperations().stream().filter(OperationModel::hasChildren).collect(Collectors.groupingBy(op -> {
5282
- if (op.isTransparent && (op.isVariadic || op.numChildren > 1)) {
5282
+ if (op.isTransparent && (op.isVariadic || op.numChildren() > 1)) {
5283
5283
return BeforeChildKind.TRANSPARENT;
5284
5284
} else if (op.kind == OperationKind.CUSTOM_SHORT_CIRCUIT) {
5285
5285
return BeforeChildKind.SHORT_CIRCUIT;
@@ -5442,12 +5442,12 @@ private CodeExecutableElement createAfterChild() {
5442
5442
* Ensure the stack balances. If a value was expected, assert that the child
5443
5443
* produced a value. If a value was not expected but the child produced one, pop it.
5444
5444
*/
5445
- if (op.childrenMustBeValues != null ) {
5445
+ if (op.requiresStackBalancing() ) {
5446
5446
List<Integer> valueChildren = new ArrayList<>();
5447
5447
List<Integer> nonValueChildren = new ArrayList<>();
5448
5448
5449
- for (int i = 0; i < op.childrenMustBeValues .length; i++) {
5450
- if (op.childrenMustBeValues [i]) {
5449
+ for (int i = 0; i < op.dynamicOperands .length; i++) {
5450
+ if (! op.dynamicOperands [i].voidAllowed() ) {
5451
5451
valueChildren.add(i);
5452
5452
} else {
5453
5453
nonValueChildren.add(i);
@@ -5475,7 +5475,7 @@ private CodeExecutableElement createAfterChild() {
5475
5475
if (i != 0) {
5476
5476
b.string(" || ");
5477
5477
}
5478
- String operator = (op.isVariadic && valueChildren.get(i) == op.childrenMustBeValues .length - 1) ? ">=" : "==";
5478
+ String operator = (op.isVariadic && valueChildren.get(i) == op.dynamicOperands .length - 1) ? ">=" : "==";
5479
5479
b.string("childIndex " + operator + " " + valueChildren.get(i));
5480
5480
}
5481
5481
b.string(") && !producedValue");
@@ -5492,7 +5492,7 @@ private CodeExecutableElement createAfterChild() {
5492
5492
if (i != 0) {
5493
5493
b.string(" || ");
5494
5494
}
5495
- String operator = (op.isVariadic && nonValueChildren.get(i) == op.childrenMustBeValues .length - 1) ? ">=" : "==";
5495
+ String operator = (op.isVariadic && nonValueChildren.get(i) == op.dynamicOperands .length - 1) ? ">=" : "==";
5496
5496
b.string("childIndex " + operator + " " + nonValueChildren.get(i));
5497
5497
}
5498
5498
b.string(") && producedValue");
0 commit comments