diff options
-rw-r--r-- | 028call_return.cc | 6 | ||||
-rw-r--r-- | 043space.cc | 2 | ||||
-rw-r--r-- | 053recipe_header.cc | 2 | ||||
-rw-r--r-- | 054static_dispatch.cc | 2 | ||||
-rw-r--r-- | 056shape_shifting_recipe.cc | 2 | ||||
-rw-r--r-- | 099hardware_checks.cc | 2 |
6 files changed, 10 insertions, 6 deletions
diff --git a/028call_return.cc b/028call_return.cc index 3e547f06..0227acee 100644 --- a/028call_return.cc +++ b/028call_return.cc @@ -67,7 +67,7 @@ void check_types_of_return_instructions(const recipe_ordinal r) { const instruction& caller_instruction = caller.steps.at(i); if (caller_instruction.is_label) continue; if (caller_instruction.products.empty()) continue; - if (caller_instruction.operation < MAX_PRIMITIVE_RECIPES) continue; + if (is_primitive(caller_instruction.operation)) continue; const recipe& callee = get(Recipe, caller_instruction.operation); for (int i = 0; i < SIZE(callee.steps); ++i) { const instruction& return_inst = callee.steps.at(i); @@ -111,6 +111,10 @@ void check_types_of_return_instructions(const recipe_ordinal r) { } } +bool is_primitive(recipe_ordinal r) { + return r < MAX_PRIMITIVE_RECIPES; +} + :(scenario return_type_mismatch) % Hide_errors = true; def main [ diff --git a/043space.cc b/043space.cc index 76faa5d3..ca8ee648 100644 --- a/043space.cc +++ b/043space.cc @@ -293,7 +293,7 @@ bool escaping(const reagent& r) { if (Writing_products_of_instruction) { const instruction& inst = current_instruction(); // should_update_refcounts() Special-cases When Writing Products Of Primitive Instructions - if (inst.operation < MAX_PRIMITIVE_RECIPES) return true; + if (is_primitive(inst.operation)) return true; if (!contains_key(Recipe, inst.operation)) return true; const recipe& callee = get(Recipe, inst.operation); if (callee.steps.empty()) return true; diff --git a/053recipe_header.cc b/053recipe_header.cc index 54bc452e..9e01db42 100644 --- a/053recipe_header.cc +++ b/053recipe_header.cc @@ -291,7 +291,7 @@ void check_calls_against_header(const recipe_ordinal r) { trace(9991, "transform") << "--- type-check calls inside recipe " << caller.name << end(); for (int i = 0; i < SIZE(caller.steps); ++i) { const instruction& inst = caller.steps.at(i); - if (inst.operation < MAX_PRIMITIVE_RECIPES) continue; + if (is_primitive(inst.operation)) continue; const recipe& callee = get(Recipe, inst.operation); if (!callee.has_header) continue; for (long int i = 0; i < min(SIZE(inst.ingredients), SIZE(callee.ingredients)); ++i) { diff --git a/054static_dispatch.cc b/054static_dispatch.cc index 450d887f..e4e417d8 100644 --- a/054static_dispatch.cc +++ b/054static_dispatch.cc @@ -200,7 +200,7 @@ string best_variant(instruction& inst, const recipe& caller_recipe) { if (!candidates.empty()) return best_variant(inst, candidates).name; // error messages - if (get(Recipe_ordinal, inst.name) >= MAX_PRIMITIVE_RECIPES) { // we currently don't check types for primitive variants + if (!is_primitive(get(Recipe_ordinal, inst.name))) { // we currently don't check types for primitive variants if (SIZE(variants) == 1) { raise << maybe(caller_recipe.name) << "types don't match in call for '" << to_original_string(inst) << "'\n" << end(); raise << " which tries to call '" << original_header_label(get(Recipe, variants.at(0))) << "'\n" << end(); diff --git a/056shape_shifting_recipe.cc b/056shape_shifting_recipe.cc index 7f74136d..917fce5c 100644 --- a/056shape_shifting_recipe.cc +++ b/056shape_shifting_recipe.cc @@ -75,7 +75,7 @@ skip_shape_shifting_variants:; //: recipes can be called :(before "End Instruction Operation Checks") -if (contains_key(Recipe, inst.operation) && inst.operation >= MAX_PRIMITIVE_RECIPES +if (contains_key(Recipe, inst.operation) && !is_primitive(inst.operation) && any_type_ingredient_in_header(inst.operation)) { raise << maybe(caller.name) << "instruction '" << inst.name << "' has no valid specialization\n" << end(); return; diff --git a/099hardware_checks.cc b/099hardware_checks.cc index 42ad271f..0a6a1ebd 100644 --- a/099hardware_checks.cc +++ b/099hardware_checks.cc @@ -38,7 +38,7 @@ void check_for_misuse_of_real_hardware(const recipe_ordinal r) { trace(9991, "transform") << "--- check if recipe " << caller.name << " has any dependency-injection mistakes" << end(); for (int index = 0; index < SIZE(caller.steps); ++index) { const instruction& inst = caller.steps.at(index); - if (inst.operation < MAX_PRIMITIVE_RECIPES) continue; + if (is_primitive(inst.operation)) continue; for (int i = 0; i < SIZE(inst.ingredients); ++i) { const reagent& ing = inst.ingredients.at(i); if (!is_literal(ing) || ing.name != "0") continue; |