about summary refs log tree commit diff stats
path: root/043space.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-02-07 00:05:38 -0800
committerKartik K. Agaram <vc@akkartik.com>2017-02-07 00:05:38 -0800
commitd9e39b3b1cfac9487a9a0aee2525ea86e3e137b1 (patch)
treee46dc9a45858cdf362f1699a5fbac50560738e89 /043space.cc
parent95f2fe96262fcc5977c4633828730acc588c99b3 (diff)
downloadmu-d9e39b3b1cfac9487a9a0aee2525ea86e3e137b1.tar.gz
3743
One way to ensure we always set old_name is to create a method to
initialize names as opposed to just assigning them.

Still not ideal because we still assign directly most of the time, so
it's easy to forget.
Diffstat (limited to '043space.cc')
-rw-r--r--043space.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/043space.cc b/043space.cc
index 33c4bb09..46736615 100644
--- a/043space.cc
+++ b/043space.cc
@@ -266,6 +266,10 @@ string old_name;
 old_name.clear();
 :(before "End next_instruction(curr)")
 curr->old_name = curr->name;  // before rewrite rules modify it
+:(before "End instruction Methods")
+void initialize_name(const string& n) {
+  name = old_name = n;
+}
 
 :(code)
 // is this reagent one of the values returned by the current (return) instruction?