about summary refs log tree commit diff stats
path: root/038new.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-01-19 19:03:20 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-01-19 19:03:20 -0800
commitff9d5f43cfcc18e853de8d92ade1f962961fa516 (patch)
treee2732cbe6e58b9bb42efff3cd0829d639946ae35 /038new.cc
parentbb33c5e89993338f6e554210e87b27a5220ead98 (diff)
downloadmu-ff9d5f43cfcc18e853de8d92ade1f962961fa516.tar.gz
2574
Diffstat (limited to '038new.cc')
-rw-r--r--038new.cc15
1 files changed, 4 insertions, 11 deletions
diff --git a/038new.cc b/038new.cc
index 21273cfa..2d7337a3 100644
--- a/038new.cc
+++ b/038new.cc
@@ -52,17 +52,10 @@ case NEW: {
   }
   reagent product(inst.products.at(0));
   canonize_type(product);
-  drop_address_from_type(product);
+  drop_from_type(product, "address");
   if (SIZE(inst.ingredients) > 1) {
-    // array allocation, so drop an 'array' as well from product.type
-    type_tree* tmp = product.type;
-    if (tmp->value != get(Type_ordinal, "array")) {
-      raise_error << maybe(caller.name) << "result of 'new' should start with 'address:array:...' in " << inst.to_string() << '\n' << end();
-      break;
-    }
-    product.type = tmp->right;
-    tmp->right = NULL;
-    delete tmp;
+    // array allocation
+    drop_from_type(product, "array");
   }
   reagent expected_product("x:"+type.name);
   // End Post-processing(expected_product) When Checking 'new'
@@ -260,7 +253,7 @@ case ABANDON: {
   canonize(types);
   // lookup_memory without drop_one_lookup {
   types.set_value(get_or_insert(Memory, types.value));
-  drop_address_from_type(types);
+  drop_from_type(types, "address");
   // }
   abandon(address, size_of(types));
   break;