Forward-reference resolution becomes increasingly general.
Chris Pressey
3 years ago
4 | 4 |
----
|
5 | 5 |
|
6 | 6 |
* `save X, Y, Z { }` now allowed as a shortcut for nested `save`s.
|
|
7 |
* Trying to call or goto a non-routine-typed symbol is now an
|
|
8 |
analysis error, not a syntax error.
|
7 | 9 |
* Split TODO off into own file.
|
8 | 10 |
* `sixtypical` no longer writes the compiled binary to standard
|
9 | 11 |
output. The `--output` command-line argument should be given
|
549 | 549 |
context.invalidate_range(dest)
|
550 | 550 |
elif opcode == 'call':
|
551 | 551 |
type = instr.location.type
|
|
552 |
if not isinstance(type, (RoutineType, VectorType)):
|
|
553 |
raise TypeMismatchError(instr, instr.location)
|
552 | 554 |
if isinstance(type, VectorType):
|
553 | 555 |
type = type.of_type
|
554 | 556 |
for ref in type.inputs:
|
114 | 114 |
for node in program.all_children():
|
115 | 115 |
if isinstance(node, SingleOp):
|
116 | 116 |
instr = node
|
|
117 |
if isinstance(instr.src, ForwardReference):
|
|
118 |
instr.src = self.lookup(instr.src.name)
|
117 | 119 |
if instr.opcode in ('call', 'goto'):
|
118 | |
forward_reference = instr.location
|
119 | |
name = forward_reference.name
|
120 | |
model = self.lookup(name)
|
121 | |
if not isinstance(model.type, (RoutineType, VectorType)):
|
122 | |
self.syntax_error('Illegal call of non-executable "%s"' % name)
|
123 | |
instr.location = model
|
124 | |
if instr.opcode in ('copy',):
|
125 | |
if isinstance(instr.src, ForwardReference):
|
126 | |
instr.src = self.lookup(instr.src.name)
|
|
120 |
if isinstance(instr.location, ForwardReference):
|
|
121 |
instr.location = self.lookup(instr.location.name)
|
127 | 122 |
|
128 | 123 |
return program
|
129 | 124 |
|