From 7402ce32ee0cd3301677d0037718b175868a56a8 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 10 Jul 2015 02:00:49 -0700 Subject: 1745 - hoist warning/response strings out of editor-data Still ugly as hell. Some tests failing, but they're most likely wrong. We need to test cursor positioning at the level of the environment and take it away from the responsibilities of individual editors. Also bring back the line at the bottom of each editor. The non-test run ('main' in edit.mu) is completely borked. Sluggish as hell, and I can't seem to switch focus to the sandbox editor. --- 036call_reply.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to '036call_reply.cc') diff --git a/036call_reply.cc b/036call_reply.cc index 71aa4991..54866765 100644 --- a/036call_reply.cc +++ b/036call_reply.cc @@ -41,7 +41,11 @@ case REPLY: { vector tmp = property(reply_inst.ingredients.at(i), "same-as-ingredient"); assert(SIZE(tmp) == 1); long long int ingredient_index = to_integer(tmp.at(0)); - if (caller_instruction.products.at(i).value != caller_instruction.ingredients.at(ingredient_index).value) + if (ingredient_index >= SIZE(caller_instruction.ingredients)) + raise << current_recipe_name() << ": 'same-as-ingredient' metadata overflows ingredients in: " << caller_instruction.to_string() << '\n'; +//? cerr << caller_instruction.products.size() << ' ' << i << ' ' << caller_instruction.ingredients.size() << ' ' << ingredient_index << '\n'; //? 1 +//? cerr << caller_instruction.to_string() << '\n'; //? 1 + if (!is_dummy(caller_instruction.products.at(i)) && caller_instruction.products.at(i).value != caller_instruction.ingredients.at(ingredient_index).value) raise << current_recipe_name() << ": 'same-as-ingredient' result " << caller_instruction.products.at(i).value << " from call to " << callee << " must be location " << caller_instruction.ingredients.at(ingredient_index).value << '\n'; } } @@ -79,6 +83,18 @@ recipe test1 [ ] +warn: main: 'same-as-ingredient' result 2 from call to test1 must be location 1 +:(scenario reply_same_as_ingredient_dummy) +% Hide_warnings = true; +recipe main [ + 1:number <- copy 0:literal + _ <- test1 1:number # call with different ingredient and product +] +recipe test1 [ + 10:address:number <- next-ingredient + reply 10:address:number/same-as-ingredient:0 +] +$warn: 0 + :(code) string to_string(const vector& in) { if (in.empty()) return "[]"; -- cgit 1.4.1-2-gfad0