Verify restrictions on polymorphism.
Add a typevar_operand argument to the InstructionFormat constructor which determines the operand used for inferring the controlling type variable. Identify polymorphic instructions when they are created, determine if the controlling type variable can be inferred from the typevar_operand, and verify the use of type variables in the other operands. Generate type variable summary in the documentation, including how the controlling type variable is inferred.
This commit is contained in:
@@ -151,6 +151,12 @@ def gen_opcodes(groups, fmt):
|
||||
fmt.doc_comment(
|
||||
'`{}{} {}`. ({})'
|
||||
.format(prefix, i.name, suffix, i.format.name))
|
||||
# Document polymorphism.
|
||||
if i.is_polymorphic:
|
||||
if i.use_typevar_operand:
|
||||
fmt.doc_comment(
|
||||
'Type inferred from {}.'
|
||||
.format(i.ins[i.format.typevar_operand]))
|
||||
# Enum variant itself.
|
||||
fmt.line(i.camel_name + ',')
|
||||
fmt.line()
|
||||
|
||||
Reference in New Issue
Block a user