about summary refs log tree commit diff stats
path: root/032array.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2018-03-14 00:59:41 -0700
committerKartik K. Agaram <vc@akkartik.com>2018-03-14 00:59:41 -0700
commit090cad5c1b87989049c926e383d2e08667fe325b (patch)
treea921a10dc350869ecbb67d1180407be13aeb6afe /032array.cc
parent49ec25f7d2892d268968c52edc52762c72ce2c2c (diff)
downloadmu-090cad5c1b87989049c926e383d2e08667fe325b.tar.gz
4223
Diffstat (limited to '032array.cc')
-rw-r--r--032array.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/032array.cc b/032array.cc
index bc933aad..e2599df1 100644
--- a/032array.cc
+++ b/032array.cc
@@ -338,8 +338,7 @@ case INDEX: {
   if (inst.products.empty()) break;
   reagent/*copy*/ product = inst.products.at(0);
   // Update INDEX product in Check
-  reagent/*local*/ element;
-  element.type = copy_array_element(base.type);
+  reagent/*local*/ element(copy_array_element(base.type));
   if (!types_coercible(product, element)) {
     raise << maybe(get(Recipe, r).name) << "'index' on '" << base.original_string << "' can't be saved in '" << product.original_string << "'; type should be '" << names_to_string_without_quotes(element.type) << "'\n" << end();
     break;
@@ -363,8 +362,7 @@ case INDEX: {
     raise << maybe(current_recipe_name()) << "invalid index " << no_scientific(index_val.at(0)) << " in '" << to_original_string(current_instruction()) << "'\n" << end();
     break;
   }
-  reagent/*local*/ element;
-  element.type = copy_array_element(base.type);
+  reagent/*local*/ element(copy_array_element(base.type));
   element.set_value(base_address + /*skip length*/1 + index_val.at(0)*size_of(element.type));
   trace(9998, "run") << "address to copy is " << element.value << end();
   trace(9998, "run") << "its type is " << to_string(element.type) << end();
@@ -523,8 +521,7 @@ case PUT_INDEX: {
   }
   reagent/*copy*/ value = inst.ingredients.at(2);
   // Update PUT_INDEX value in Check
-  reagent/*local*/ element;
-  element.type = copy_array_element(base.type);
+  reagent/*local*/ element(copy_array_element(base.type));
   if (!types_coercible(element, value)) {
     raise << maybe(get(Recipe, r).name) << "'put-index " << base.original_string << ", " << inst.ingredients.at(1).original_string << "' should store " << names_to_string_without_quotes(element.type) << " but '" << value.name << "' has type " << names_to_string_without_quotes(value.type) << '\n' << end();
     break;