MCPcopy Create free account
hub / github.com/Whiley/WhileyCompiler / writeOperands

Method writeOperands

src/main/java/wycc/io/HeapWriter.java:85–105  ·  view source on GitHub ↗
(Item item)

Source from the content-addressed store, hash-verified

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

Callers 1

writeSyntacticItemMethod · 0.95

Calls 7

getIndexMethod · 0.95
getOperandLayoutMethod · 0.80
write_uvMethod · 0.80
getDescriptorMethod · 0.65
getOpcodeMethod · 0.65
sizeMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected