Create a list of instructions (a structured object rather than an array of bytes) and store that in self.insts
(self, co)
| 213 | return new_tokens |
| 214 | |
| 215 | def build_instructions(self, co): |
| 216 | """ |
| 217 | Create a list of instructions (a structured object rather than |
| 218 | an array of bytes) and store that in self.insts |
| 219 | """ |
| 220 | # FIXME: remove this when all subsidiary functions have been removed. |
| 221 | # We should be able to get everything from the self.insts list. |
| 222 | self.code = array("B", co.co_code) |
| 223 | |
| 224 | bytecode = Bytecode(co, self.opc) |
| 225 | self.build_prev_op() |
| 226 | self.insts = self.remove_extended_args(list(bytecode)) |
| 227 | self.lines = self.build_lines_data(co) |
| 228 | self.offset2inst_index = {} |
| 229 | for i, inst in enumerate(self.insts): |
| 230 | self.offset2inst_index[inst.offset] = i |
| 231 | |
| 232 | return bytecode |
| 233 | |
| 234 | def build_lines_data(self, code_obj): |
| 235 | """ |