about summary refs log tree commit diff stats
path: root/021check_instruction.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-05-06 00:46:39 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-05-06 00:46:39 -0700
commit3473c63ad94756d6f79ddd5c48813e79d87429ca (patch)
tree9825e9a1c4fecf3f52697364bae17d7572bf5cdf /021check_instruction.cc
parentce9616a77fc4e1c22e913308c8ea55ef05203211 (diff)
downloadmu-3473c63ad94756d6f79ddd5c48813e79d87429ca.tar.gz
2931 - be explicit about making copies
Diffstat (limited to '021check_instruction.cc')
-rw-r--r--021check_instruction.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/021check_instruction.cc b/021check_instruction.cc
index 599fa6c9..2bf0d97a 100644
--- a/021check_instruction.cc
+++ b/021check_instruction.cc
@@ -132,7 +132,8 @@ bool boolean_matches_literal(const reagent& to, const reagent& from) {
 
 // copy arguments because later layers will want to make changes to them
 // without perturbing the caller
-bool types_strictly_match(reagent to, reagent from) {
+bool types_strictly_match(reagent/*copy*/ to, reagent/*copy*/ from) {
+  // End Preprocess types_strictly_match(reagent to, reagent from)
   if (is_literal(from) && to.type->value == get(Type_ordinal, "number")) return true;
   // to sidestep type-checking, use /unsafe in the source.
   // this will be highlighted in red inside vim. just for setting up some tests.
@@ -145,7 +146,7 @@ bool types_strictly_match(reagent to, reagent from) {
 
 // two types match if the second begins like the first
 // (trees perform the same check recursively on each subtree)
-bool types_strictly_match(type_tree* to, type_tree* from) {
+bool types_strictly_match(const type_tree* to, const type_tree* from) {
   if (!to) return true;
   if (!from) return to->value == 0;
   if (from->value == -1) return from->name == to->name;
@@ -169,25 +170,29 @@ bool is_unsafe(const reagent& r) {
   return has_property(r, "unsafe");
 }
 
-bool is_mu_array(reagent r) {
+bool is_mu_array(reagent/*copy*/ r) {
+  // End Preprocess is_mu_array(reagent r)
   if (!r.type) return false;
   if (is_literal(r)) return false;
   return r.type->value == get(Type_ordinal, "array");
 }
 
-bool is_mu_address(reagent r) {
+bool is_mu_address(reagent/*copy*/ r) {
+  // End Preprocess is_mu_address(reagent r)
   if (!r.type) return false;
   if (is_literal(r)) return false;
   return r.type->value == get(Type_ordinal, "address");
 }
 
-bool is_mu_boolean(reagent r) {
+bool is_mu_boolean(reagent/*copy*/ r) {
+  // End Preprocess is_mu_boolean(reagent r)
   if (!r.type) return false;
   if (is_literal(r)) return false;
   return r.type->value == get(Type_ordinal, "boolean");
 }
 
-bool is_mu_number(reagent r) {
+bool is_mu_number(reagent/*copy*/ r) {
+  // End Preprocess is_mu_number(reagent r)
   if (!r.type) return false;
   if (is_literal(r)) {
     if (!r.type) return false;
@@ -198,7 +203,7 @@ bool is_mu_number(reagent r) {
   return r.type->value == get(Type_ordinal, "number");
 }
 
-bool is_mu_scalar(reagent r) {
+bool is_mu_scalar(reagent/*copy*/ r) {
   if (!r.type) return false;
   if (is_literal(r))
     return !r.type || r.type->name != "literal-string";