From d1343b58b47e1db419bb2bf0d2f8aa863692756d Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Thu, 12 Sep 2013 00:50:17 -0500 Subject: remove global from load_asm2 Why is there even a second method in the first place? --- pokemontools/crystal.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pokemontools/crystal.py b/pokemontools/crystal.py index a3d87f0..9f156c5 100644 --- a/pokemontools/crystal.py +++ b/pokemontools/crystal.py @@ -7144,12 +7144,9 @@ class AsmSection: def to_asm(self): return self.line -new_asm = None -def load_asm2(filename="../main.asm", force=False): +def load_asm2(filename="../main.asm"): """loads the asm source code into memory""" - global new_asm - if new_asm == None or force: - new_asm = Asm(filename=filename) + new_asm = Asm(filename=filename) return new_asm class Asm: @@ -7643,7 +7640,7 @@ class Label: entries to the Asm.parts list. """ # assert new_asm != None, "new_asm should be an instance of Asm" - load_asm2() + new_asm = load_asm2() is_in_file = new_asm.is_label_name_in_file(self.name) self.is_in_file = is_in_file return is_in_file @@ -7652,7 +7649,7 @@ class Label: """ Checks if the address is in use by another label. """ - load_asm2() + new_asm = load_asm2() self.address_is_in_file = new_asm.does_address_have_label(self.address) return self.address_is_in_file -- cgit v1.2.3