Check for unknown instruction attributes. (#80)
* Check for unknown instruction attributes. * Avoid has_key, at flake8's advice. * Use AssertionError instead of RuntimeError, per review request.
This commit is contained in:
committed by
Jakob Stoklund Olesen
parent
fb9d86f852
commit
38fa75459e
@@ -122,6 +122,10 @@ class Instruction(object):
|
|||||||
i for i, o in enumerate(self.ins) if o.is_immediate())
|
i for i, o in enumerate(self.ins) if o.is_immediate())
|
||||||
|
|
||||||
self._verify_polymorphic()
|
self._verify_polymorphic()
|
||||||
|
for attr in kwargs:
|
||||||
|
if attr not in Instruction.ATTRIBS:
|
||||||
|
raise AssertionError(
|
||||||
|
"unknown instruction attribute '" + attr + "'")
|
||||||
for attr in Instruction.ATTRIBS:
|
for attr in Instruction.ATTRIBS:
|
||||||
setattr(self, attr, not not kwargs.get(attr, False))
|
setattr(self, attr, not not kwargs.get(attr, False))
|
||||||
InstructionGroup.append(self)
|
InstructionGroup.append(self)
|
||||||
|
|||||||
Reference in New Issue
Block a user