Skip to content
Snippets Groups Projects
Commit a4b6b11a authored by Taddeus Kroes's avatar Taddeus Kroes
Browse files

Source code cleanup.

parent 6af97203
No related branches found
No related tags found
No related merge requests found
...@@ -19,7 +19,7 @@ class Statement: ...@@ -19,7 +19,7 @@ class Statement:
"""Check if two statements are equal by comparing their type, name and """Check if two statements are equal by comparing their type, name and
arguments.""" arguments."""
return self.stype == other.stype and self.name == other.name \ return self.stype == other.stype and self.name == other.name \
and self.args == other.args and self.args == other.args
def __str__(self): # pragma: nocover def __str__(self): # pragma: nocover
return '<Statement type=%s name=%s args=%s>' \ return '<Statement type=%s name=%s args=%s>' \
...@@ -39,11 +39,11 @@ class Statement: ...@@ -39,11 +39,11 @@ class Statement:
def is_label(self, name=None): def is_label(self, name=None):
return self.stype == 'label' if name == None \ return self.stype == 'label' if name == None \
else self.stype == 'label' and self.name == name else self.stype == 'label' and self.name == name
def is_command(self, name=None): def is_command(self, name=None):
return self.stype == 'command' if name == None \ return self.stype == 'command' if name == None \
else self.stype == 'command' and self.name == name else self.stype == 'command' and self.name == name
def is_jump(self): def is_jump(self):
"""Check if the statement is a jump.""" """Check if the statement is a jump."""
...@@ -66,11 +66,11 @@ class Statement: ...@@ -66,11 +66,11 @@ class Statement:
def jump_target(self): def jump_target(self):
"""Get the jump target of this statement.""" """Get the jump target of this statement."""
if self.is_jump(): if not self.is_jump():
return self[-1]
else:
raise Exception('Command "%s" has no jump target' % self.name) raise Exception('Command "%s" has no jump target' % self.name)
return self[-1]
def get_def(self): def get_def(self):
"""Get the def[S] of this statement.""" """Get the def[S] of this statement."""
if not self.is_command(): if not self.is_command():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment