about summary refs log tree commit diff stats
path: root/subx/026labels.cc
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-07-27 11:05:54 -0700
committerKartik Agaram <vc@akkartik.com>2018-07-27 11:05:54 -0700
commit880bfb78741956af52e94c6abab27c0dca620315 (patch)
tree3c5c582ca23c71c7e8e23d1605b75c2e2c9ce8d2 /subx/026labels.cc
parent53e6c50aeb9341945245e245582d4fb9f78708a6 (diff)
downloadmu-880bfb78741956af52e94c6abab27c0dca620315.tar.gz
4439
Diffstat (limited to 'subx/026labels.cc')
-rw-r--r--subx/026labels.cc13
1 files changed, 5 insertions, 8 deletions
diff --git a/subx/026labels.cc b/subx/026labels.cc
index 33ab8a2d..eb3c255d 100644
--- a/subx/026labels.cc
+++ b/subx/026labels.cc
@@ -50,15 +50,12 @@ void compute_addresses_for_labels(const segment& code, map<string, uint32_t> add
       else {
         if (contains_any_operand_metadata(curr))
           raise << "'" << to_string(inst) << "': label definition (':') not allowed in operand\n" << end();
-        if (j == 0) {
-          string label = curr.data.substr(0, SIZE(curr.data)-1);
-          put(address, label, current_byte);
-          trace(99, "label") << "label '" << label << "' is at address " << (current_byte+code.start) << end();
-          // no modifying current_byte; label definitions won't be in the final binary
-        }
-        else {
+        if (j > 0)
           raise << "'" << to_string(inst) << "': labels can only be the first word in a line.\n" << end();
-        }
+        string label = curr.data.substr(0, SIZE(curr.data)-1);
+        put(address, label, current_byte);
+        trace(99, "label") << "label '" << label << "' is at address " << (current_byte+code.start) << end();
+        // no modifying current_byte; label definitions won't be in the final binary
       }
     }
   }