about summary refs log tree commit diff stats
path: root/subx/034discourage_raw_hex.cc
diff options
context:
space:
mode:
Diffstat (limited to 'subx/034discourage_raw_hex.cc')
-rw-r--r--subx/034discourage_raw_hex.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/subx/034discourage_raw_hex.cc b/subx/034discourage_raw_hex.cc
index 8d5eac7d..2b2e2675 100644
--- a/subx/034discourage_raw_hex.cc
+++ b/subx/034discourage_raw_hex.cc
@@ -4,15 +4,14 @@
 //: While SubX will let you write raw machine code, don't do that unless you
 //: have a very good reason.
 
-:(after "Begin Level-2 Transforms")
-Transform.push_back(warn_on_raw_jumps);
+:(before "Pack Operands(segment code)")
+warn_on_raw_hex(code);
+if (trace_contains_errors()) return;
 :(code)
-void warn_on_raw_jumps(/*const*/ program& p) {
-  if (p.segments.empty()) return;
-  segment& code = p.segments.at(0);
+void warn_on_raw_hex(const segment& code) {
   trace(99, "transform") << "-- warn on raw hex instructions" << end();
   for (int i = 0;  i < SIZE(code.lines);  ++i) {
-    line& inst = code.lines.at(i);
+    const line& inst = code.lines.at(i);
     if (all_hex_bytes(inst) && has_operands(inst)) {
       warn << "'" << to_string(inst) << "': using raw hex is not recommended\n" << end();
       break;