Move all bounds checks for types and recipes to one place.
This commit is contained in:
Kartik K. Agaram 2016-03-27 22:17:03 -07:00
parent 7cca03bd11
commit d3902ff0be
3 changed files with 2 additions and 3 deletions

View File

@ -203,7 +203,7 @@ assert(MAX_PRIMITIVE_RECIPES < 200); // level 0 is primitives; until 199
Next_recipe_ordinal = 200;
put(Recipe_ordinal, "main", Next_recipe_ordinal++);
// End Load Recipes
:(before "End Test Run Initialization")
:(before "End Commandline Parsing")
assert(Next_recipe_ordinal < 1000); // recipes being tested didn't overflow into test space
:(before "End Setup")
Next_recipe_ordinal = 1000; // consistent new numbers for each test

View File

@ -156,7 +156,6 @@ if (argc > 1) {
argc--;
}
if (Run_tests) Recipe.erase(get(Recipe_ordinal, "main"));
// End Loading .mu Files
}
transform_all();
save_snapshots();

View File

@ -56,7 +56,7 @@ $error: 0
:(before "End Globals")
// We'll use large type ordinals to mean "the following type of the variable".
const int START_TYPE_INGREDIENTS = 2000;
:(before "End Test Run Initialization")
:(before "End Commandline Parsing") // after loading .mu files
assert(Next_type_ordinal < START_TYPE_INGREDIENTS);
:(before "End type_info Fields")