Skip to content

Commit

Permalink
Tests: fix failure due to change in format prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
Marat Dukhan committed Jul 6, 2017
1 parent f50a3a0 commit a597d75
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions peachpy/x86_64/instructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def gas_name(self):
else:
return self._gas_name

def format(self, assembly_format, indent, line_number):
def format(self, assembly_format, indent=False, line_number=None):
from peachpy.x86_64.operand import format_operand
text = "\t" * self._indent_level if indent else ""
if assembly_format == "peachpy":
Expand All @@ -67,7 +67,7 @@ def format(self, assembly_format, indent, line_number):
elif assembly_format == "gas":
if self.operands:
from peachpy.x86_64.pseudo import Label
if len(self.operands) == 1 and isinstance(self.operands[0], Label):
if line_number is not None and len(self.operands) == 1 and isinstance(self.operands[0], Label) and self.operands[0].line_number is not None:
label = self.operands[0]
return "{indent}{mnemonic} {label_line}{direction} # {label_name}".format(
indent=text,
Expand Down
8 changes: 4 additions & 4 deletions peachpy/x86_64/pseudo.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(self, label, origin=None):
def __str__(self):
return ".".join(map(str, self.identifier)) + ":"

def format(self, assembly_format, indent, line_number):
def format(self, assembly_format, indent=False, line_number=None):
assert assembly_format in {"peachpy", "gas", "nasm", "go"}, \
"Supported assembly formats are 'peachpy', 'gas', 'nasm', 'go'"

Expand Down Expand Up @@ -249,7 +249,7 @@ def __str__(self):
else:
return "RETURN " + ", ".join(map(str, self.operands))

def format(self, assembly_format, indent, line_number):
def format(self, assembly_format, indent=False, line_number=None):
text = "\t" if indent else ""
if assembly_format == "peachpy":
return text + str(self)
Expand Down Expand Up @@ -298,7 +298,7 @@ def __init__(self, *args, **kwargs):
if peachpy.stream.active_stream is not None:
peachpy.stream.active_stream.add_instruction(self)

def format(self, assembly_format, indent, line_number):
def format(self, assembly_format, indent=False, line_number=None):
assert assembly_format in {"peachpy", "go"}, \
"Supported assembly formats are 'peachpy' and 'go'"

Expand Down Expand Up @@ -423,7 +423,7 @@ def __init__(self, *args, **kwargs):
if peachpy.stream.active_stream is not None:
peachpy.stream.active_stream.add_instruction(self)

def format(self, assembly_format, indent, line_number):
def format(self, assembly_format, indent=False, line_number=None):
assert assembly_format in {"peachpy", "go"}, \
"Supported assembly formats are 'peachpy' and 'go'"

Expand Down

0 comments on commit a597d75

Please sign in to comment.