Even more general.
Chris Pressey
4 years ago
114 | 114 | for node in program.all_children(): |
115 | 115 | if isinstance(node, SingleOp): |
116 | 116 | instr = node |
117 | if isinstance(instr.location, ForwardReference): | |
118 | instr.location = self.lookup(instr.location.name) | |
117 | 119 | if isinstance(instr.src, ForwardReference): |
118 | 120 | instr.src = self.lookup(instr.src.name) |
119 | if instr.opcode in ('call', 'goto'): | |
120 | if isinstance(instr.location, ForwardReference): | |
121 | instr.location = self.lookup(instr.location.name) | |
121 | if isinstance(instr.dest, ForwardReference): | |
122 | instr.dest = self.lookup(instr.dest.name) | |
122 | 123 | |
123 | 124 | return program |
124 | 125 |