1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2025-02-09 01:30:50 +00:00

Generalize forward reference resolution a smidge.

This commit is contained in:
Chris Pressey 2018-09-07 13:27:18 +01:00
parent 33d5093e5a
commit 26a2fb448c

View File

@ -122,13 +122,9 @@ class Parser(object):
if not isinstance(model.type, (RoutineType, VectorType)):
self.syntax_error('Illegal call of non-executable "%s"' % name)
instr.location = model
if instr.opcode in ('copy',) and isinstance(instr.src, ForwardReference):
forward_reference = instr.src
name = forward_reference.name
model = self.lookup(name)
if not isinstance(model.type, (RoutineType, VectorType)):
self.syntax_error('Illegal copy of non-executable "%s"' % name)
instr.src = model
if instr.opcode in ('copy',):
if isinstance(instr.src, ForwardReference):
instr.src = self.lookup(instr.src.name)
return program