about summary refs log tree commit diff stats
path: root/043new.cc
diff options
context:
space:
mode:
Diffstat (limited to '043new.cc')
-rw-r--r--043new.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/043new.cc b/043new.cc
index 191d9e87..c324bff7 100644
--- a/043new.cc
+++ b/043new.cc
@@ -56,12 +56,14 @@ NEW,
 Recipe_ordinal["new"] = NEW;
 :(before "End Primitive Recipe Implementations")
 case NEW: {
+  products.resize(1);
   if (ingredients.empty() || SIZE(ingredients) > 2) {
     raise << current_recipe_name() << ": 'new' requires one or two ingredients, but got " << current_instruction().to_string() << '\n' << end();
     break;
   }
   if (!scalar(ingredients.at(0))) {
     raise << current_recipe_name() << ": first ingredient of 'new' should be a type, but got " << current_instruction().ingredients.at(0).original_string << '\n' << end();
+    break;
   }
   // compute the space we need
   long long int size = 0;
@@ -88,7 +90,6 @@ case NEW: {
   const long long int result = Current_routine->alloc;
   trace(Primitive_recipe_depth, "mem") << "new alloc: " << result << end();
   // save result
-  products.resize(1);
   products.at(0).push_back(result);
   // initialize allocated space
   for (long long int address = result; address < result+size; ++address) {