about summary refs log tree commit diff stats
path: root/021check_instruction.cc
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-06-15 22:16:09 -0700
committerKartik Agaram <vc@akkartik.com>2018-06-15 22:16:09 -0700
commitce9b2b0515eaf92a9c68c8608fd9bf392c941d50 (patch)
treeeb1899f86308c712e54ef94a1c85243c26621c45 /021check_instruction.cc
parent0edd9b9fc60440213e4df926ea511419ee291f1e (diff)
downloadmu-ce9b2b0515eaf92a9c68c8608fd9bf392c941d50.tar.gz
4258 - undo 4257
Diffstat (limited to '021check_instruction.cc')
-rw-r--r--021check_instruction.cc25
1 files changed, 7 insertions, 18 deletions
diff --git a/021check_instruction.cc b/021check_instruction.cc
index 4bba31e5..d7628008 100644
--- a/021check_instruction.cc
+++ b/021check_instruction.cc
@@ -112,9 +112,8 @@ def main [
 
 :(code)
 // types_match with some leniency
-bool types_coercible(reagent/*copy*/ to, reagent/*copy*/ from) {
-  // Begin types_coercible(reagent to, reagent from)
-  if (types_match_sub(to, from)) return true;
+bool types_coercible(const reagent& to, const reagent& from) {
+  if (types_match(to, from)) return true;
   if (is_mu_address(from) && is_real_mu_number(to)) return true;
   if (is_mu_boolean(from) && is_real_mu_number(to)) return true;
   if (is_real_mu_number(from) && is_mu_character(to)) return true;
@@ -122,11 +121,10 @@ bool types_coercible(reagent/*copy*/ to, reagent/*copy*/ from) {
   return false;
 }
 
-bool types_match_sub(const reagent& to, const reagent& from) {
+bool types_match(const reagent& to, const reagent& from) {
   // to sidestep type-checking, use /unsafe in the source.
   // this will be highlighted in red inside vim. just for setting up some tests.
   if (is_unsafe(from)) return true;
-
   if (is_literal(from)) {
     if (is_mu_array(to)) return false;
     // End Matching Types For Literal(to)
@@ -136,16 +134,12 @@ bool types_match_sub(const reagent& to, const reagent& from) {
     if (is_mu_boolean(to)) return from.name == "0" || from.name == "1";
     return size_of(to) == 1;  // literals are always scalars
   }
-  return types_strictly_match_sub(to, from);
-}
-// variant for others to call
-bool types_match(reagent/*copy*/ to, reagent/*copy*/ from) {
-  // Begin types_match(reagent to, reagent from)
-  return types_match_sub(to, from);
+  return types_strictly_match(to, from);
 }
 
 //: copy arguments for later layers
-bool types_strictly_match_sub(const reagent& to, const reagent& from) {
+bool types_strictly_match(reagent/*copy*/ to, reagent/*copy*/ from) {
+  // End Preprocess types_strictly_match(reagent to, reagent from)
   if (to.type == NULL) return false;  // error
   if (is_literal(from) && to.type->value == Number_type_ordinal) return true;
   // to sidestep type-checking, use /unsafe in the source.
@@ -156,11 +150,6 @@ bool types_strictly_match_sub(const reagent& to, const reagent& from) {
   if (!to.type) return !from.type;
   return types_strictly_match(to.type, from.type);
 }
-// variant for others to call
-bool types_strictly_match(reagent/*copy*/ to, reagent/*copy*/ from) {
-  // Begin types_strictly_match(reagent to, reagent from)
-  return types_strictly_match_sub(to, from);
-}
 
 bool types_strictly_match(const type_tree* to, const type_tree* from) {
   if (from == to) return true;
@@ -279,7 +268,7 @@ bool is_mu_scalar(reagent/*copy*/ r) {
 }
 bool is_mu_scalar(const type_tree* type) {
   if (!type) return false;
-  if (is_mu_address(type)) return false;
+  if (is_mu_address(type)) return true;
   if (!type->atom) return false;
   if (is_literal(type))
     return type->name != "literal-string";