Skip to content

Commit

Permalink
Fully replace Settings.debug with Settings.mode
Browse files Browse the repository at this point in the history
  • Loading branch information
iafisher committed Feb 14, 2019
1 parent ad51640 commit 2e201e3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion hera/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def check(
return (Program([], [], {}, None), messages)

debug_info = None # type: Optional[DebugInfo]
if settings.debug:
if settings.mode == "debug":
labels = labels_to_line_numbers(oplist)
debug_info = DebugInfo(labels)
else:
Expand Down
5 changes: 2 additions & 3 deletions hera/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@
class Settings:
"""Global settings of the interpreter."""

def __init__(self, *, color=True, debug=False, volume=VOLUME_NORMAL):
def __init__(self, *, color=True, mode="", volume=VOLUME_NORMAL):
self.allow_interrupts = False
self.code = False
self.color = color
self.data = False
self.data_start = DEFAULT_DATA_START
self.debug = debug
self.mode = ""
self.mode = mode
self.no_debug_ops = False
self.path = None
self.stdout = False
Expand Down
3 changes: 0 additions & 3 deletions hera/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def main(argv=None) -> Optional[VirtualMachine]:
main_preprocess(path, settings)
return None
elif settings.mode == "debug":
settings.debug = True
main_debug(path, settings)
return None
elif settings.mode == "assemble":
Expand Down Expand Up @@ -185,8 +184,6 @@ def parse_args(argv: List[str]) -> Settings:
settings = Settings()
settings.path = posargs[0]
settings.mode = mode
if settings.mode == "debug":
settings.debug = True

settings.allow_interrupts = settings.mode in ("assemble", "preprocess")
settings.code = flags["--code"]
Expand Down
4 changes: 2 additions & 2 deletions test/test_debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def debugger():


def load_shell(program):
settings = Settings(debug=True)
settings = Settings(mode="debug")
return Shell(Debugger(load_program(program, settings), settings), settings)


Expand All @@ -34,7 +34,7 @@ def load_shell(program):
ADD(R3, R1, R2)
HALT()
""",
Settings(debug=True),
Settings(mode="debug"),
)


Expand Down

0 comments on commit 2e201e3

Please sign in to comment.