(int index, Schema schema, Bytecode[] bytecodes, Item[] items)
| 147 | } |
| 148 | |
| 149 | protected void constructItem(int index, Schema schema, Bytecode[] bytecodes, Item[] items) { |
| 150 | // FIXME: this fails in the presence of truly recursive items. |
| 151 | if (items[index] == null) { |
| 152 | // This item not yet constructed, therefore construct it! |
| 153 | Bytecode bytecode = bytecodes[index]; |
| 154 | // Destructure bytecode |
| 155 | int opcode = bytecode.opcode; |
| 156 | int[] operands = bytecode.operands; |
| 157 | byte[] data = bytecode.data; |
| 158 | // Construct empty item |
| 159 | Item item = schema.getDescriptor(bytecode.opcode).construct(opcode, |
| 160 | new Item[operands.length], data); |
| 161 | // Store item so can be accessed recursively |
| 162 | items[index] = item; |
| 163 | // Recursively construct operands |
| 164 | for (int i = 0; i != operands.length; ++i) { |
| 165 | constructItem(operands[i], schema, bytecodes, items); |
| 166 | item.setOperand(i, items[operands[i]]); |
| 167 | } |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | private static class Bytecode { |
| 172 | public final int opcode; |
no test coverage detected