diff options
author | Bryan Bishop <kanzure@gmail.com> | 2013-09-12 01:15:45 -0500 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2013-09-12 01:15:45 -0500 |
commit | 463cd6197f0a7be56312eaf6931563f0572de837 (patch) | |
tree | 20268af2062dca406906fe1b053ff89f8ad777a0 | |
parent | 05c396ddd985bf690590aa920a4f771d5d02d7e1 (diff) |
move find_labels_without_addresses into labels.py
-rw-r--r-- | pokemontools/crystal.py | 10 | ||||
-rw-r--r-- | pokemontools/labels.py | 10 | ||||
-rw-r--r-- | tests/tests.py | 6 |
3 files changed, 13 insertions, 13 deletions
diff --git a/pokemontools/crystal.py b/pokemontools/crystal.py index b4d5185..d5a861f 100644 --- a/pokemontools/crystal.py +++ b/pokemontools/crystal.py @@ -7157,16 +7157,6 @@ class Label: name = obj.make_label() return name -def find_labels_without_addresses(): - """scans the asm source and finds labels that are unmarked""" - without_addresses = [] - for (line_number, line) in enumerate(asm): - if labels.line_has_label(line): - label = labels.get_label_from_line(line) - if not labels.line_has_comment_address(line): - without_addresses.append({"line_number": line_number, "line": line, "label": label}) - return without_addresses - label_errors = "" def get_labels_between(start_line_id, end_line_id, bank): foundlabels = [] diff --git a/pokemontools/labels.py b/pokemontools/labels.py index 8fefd2c..96e34b9 100644 --- a/pokemontools/labels.py +++ b/pokemontools/labels.py @@ -197,3 +197,13 @@ def get_label_from_line(line): #split up the line label = line.split(":")[0] return label + +def find_labels_without_addresses(asm): + """scans the asm source and finds labels that are unmarked""" + without_addresses = [] + for (line_number, line) in enumerate(asm): + if line_has_label(line): + label = get_label_from_line(line) + if not line_has_comment_address(line): + without_addresses.append({"line_number": line_number, "line": line, "label": label}) + return without_addresses diff --git a/tests/tests.py b/tests/tests.py index c6c1265..7919a66 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -35,6 +35,7 @@ from pokemontools.labels import ( line_has_comment_address, line_has_label, get_label_from_line, + find_labels_without_addresses, ) from pokemontools.helpers import ( @@ -84,7 +85,6 @@ from pokemontools.crystal import ( process_incbins, get_labels_between, generate_diff_insert, - find_labels_without_addresses, rom_text_at, get_label_for, split_incbin_line_into_three, @@ -389,10 +389,10 @@ class TestAsmList(unittest.TestCase): def test_find_labels_without_addresses(self): global asm asm = ["hello_world: ; 0x1", "hello_world2: ;"] - labels = find_labels_without_addresses() + labels = find_labels_without_addresses(asm) self.failUnless(labels[0]["label"] == "hello_world2") asm = ["hello world: ;1", "hello_world: ;2"] - labels = find_labels_without_addresses() + labels = find_labels_without_addresses(asm) self.failUnless(len(labels) == 0) asm = None |