(Item item)
| 83 | } |
| 84 | |
| 85 | private void writeOperands(Item item) throws IOException { |
| 86 | // Determine operand layout |
| 87 | Item.Operands layout = schema.getDescriptor(item.getOpcode()).getOperandLayout(); |
| 88 | // Write operands according to layout |
| 89 | switch(layout) { |
| 90 | case MANY: |
| 91 | out.write_uv(item.size()); |
| 92 | break; |
| 93 | default: |
| 94 | if(layout.ordinal() != item.size()) { |
| 95 | throw new IllegalArgumentException( |
| 96 | "invalid number of operands for \"" + item.getClass().getSimpleName() + "\" (got " + item.size() |
| 97 | + ", expecting " + layout.ordinal() + ")"); |
| 98 | } |
| 99 | } |
| 100 | // |
| 101 | for (int i = 0; i != item.size(); ++i) { |
| 102 | Item operand = item.get(i); |
| 103 | out.write_uv(operand.getIndex()); |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | public void writeData(Item item) throws IOException { |
| 108 | // Determine data layout |
no test coverage detected