From 5fe060d582d4a82444243a28b18085c971a85628 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Fri, 27 Jul 2018 17:07:52 -0700 Subject: 4447 --- html/031merge.cc.html | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'html/031merge.cc.html') diff --git a/html/031merge.cc.html b/html/031merge.cc.html index e38b745f..4fc45ec7 100644 --- a/html/031merge.cc.html +++ b/html/031merge.cc.html @@ -25,7 +25,6 @@ a:hover { text-decoration: underline; } .LineNr { color: #444444; } .Identifier { color: #c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.PreProc { color: #800080; } .traceContains { color: #008000; } .cSpecial { color: #008000; } --> @@ -178,12 +177,12 @@ if ('onhashchange' in window) { 114 :(code) 115 void check_merge_calls(const recipe_ordinal r) { 116 const recipe& caller = get(Recipe, r); -117 trace(9991, "transform") << "--- type-check merge instructions in recipe " << caller.name << end(); +117 trace(9991, "transform") << "--- type-check merge instructions in recipe " << caller.name << end(); 118 for (int i = 0; i < SIZE(caller.steps); ++i) { 119 const instruction& inst = caller.steps.at(i); 120 if (inst.name != "merge") continue; 121 if (SIZE(inst.products) != 1) { -122 raise << maybe(caller.name) << "'merge' should yield a single product in '" << to_original_string(inst) << "'\n" << end(); +122 raise << maybe(caller.name) << "'merge' should yield a single product in '" << to_original_string(inst) << "'\n" << end(); 123 continue; 124 } 125 reagent/*copy*/ product = inst.products.at(0); @@ -191,12 +190,12 @@ if ('onhashchange' in window) { 127 const type_tree* product_base_type = product.type->atom ? product.type : product.type->left; 128 assert(product_base_type->atom); 129 if (product_base_type->value == 0 || !contains_key(Type, product_base_type->value)) { -130 raise << maybe(caller.name) << "'merge' should yield a container in '" << to_original_string(inst) << "'\n" << end(); +130 raise << maybe(caller.name) << "'merge' should yield a container in '" << to_original_string(inst) << "'\n" << end(); 131 continue; 132 } 133 const type_info& info = get(Type, product_base_type->value); -134 if (info.kind != CONTAINER && info.kind != EXCLUSIVE_CONTAINER) { -135 raise << maybe(caller.name) << "'merge' should yield a container in '" << to_original_string(inst) << "'\n" << end(); +134 if (info.kind != CONTAINER && info.kind != EXCLUSIVE_CONTAINER) { +135 raise << maybe(caller.name) << "'merge' should yield a container in '" << to_original_string(inst) << "'\n" << end(); 136 continue; 137 } 138 check_merge_call(inst.ingredients, product, caller, inst); @@ -209,9 +208,9 @@ if ('onhashchange' in window) { 145 state.data.push(merge_check_point(product, 0)); 146 while (true) { 147 assert(!state.data.empty()); -148 trace("transform") << ingredient_index << " vs " << SIZE(ingredients) << end(); +148 trace("transform") << ingredient_index << " vs " << SIZE(ingredients) << end(); 149 if (ingredient_index >= SIZE(ingredients)) { -150 raise << maybe(caller.name) << "too few ingredients in '" << to_original_string(inst) << "'\n" << end(); +150 raise << maybe(caller.name) << "too few ingredients in '" << to_original_string(inst) << "'\n" << end(); 151 return; 152 } 153 reagent& container = state.data.top().container; @@ -220,21 +219,21 @@ if ('onhashchange' in window) { 156 assert(top_root_type->atom); 157 type_info& container_info = get(Type, top_root_type->value); 158 switch (container_info.kind) { -159 case CONTAINER: { +159 case CONTAINER: { 160 // degenerate case: merge with the same type always succeeds -161 if (state.data.top().container_element_index == 0 && types_coercible(container, inst.ingredients.at(ingredient_index))) +161 if (state.data.top().container_element_index == 0 && types_coercible(container, inst.ingredients.at(ingredient_index))) 162 return; -163 const reagent& expected_ingredient = element_type(container.type, state.data.top().container_element_index); -164 trace("transform") << "checking container " << to_string(container) << " || " << to_string(expected_ingredient) << " vs ingredient " << ingredient_index << end(); +163 const reagent& expected_ingredient = element_type(container.type, state.data.top().container_element_index); +164 trace("transform") << "checking container " << to_string(container) << " || " << to_string(expected_ingredient) << " vs ingredient " << ingredient_index << end(); 165 // if the current element is the ingredient we expect, move on to the next element/ingredient -166 if (types_coercible(expected_ingredient, ingredients.at(ingredient_index))) { +166 if (types_coercible(expected_ingredient, ingredients.at(ingredient_index))) { 167 ++ingredient_index; 168 ++state.data.top().container_element_index; 169 while (state.data.top().container_element_index >= SIZE(get(Type, get_base_type(state.data.top().container.type)->value).elements)) { 170 state.data.pop(); 171 if (state.data.empty()) { 172 if (ingredient_index < SIZE(ingredients)) -173 raise << maybe(caller.name) << "too many ingredients in '" << to_original_string(inst) << "'\n" << end(); +173 raise << maybe(caller.name) << "too many ingredients in '" << to_original_string(inst) << "'\n" << end(); 174 return; 175 } 176 ++state.data.top().container_element_index; @@ -250,9 +249,9 @@ if ('onhashchange' in window) { 186 // End check_merge_call Special-cases 187 default: { 188 if (!types_coercible(container, ingredients.at(ingredient_index))) { -189 raise << maybe(caller.name) << "incorrect type of ingredient " << ingredient_index << " in '" << to_original_string(inst) << "'\n" << end(); -190 raise << " (expected '" << debug_string(container) << "')\n" << end(); -191 raise << " (got '" << debug_string(ingredients.at(ingredient_index)) << "')\n" << end(); +189 raise << maybe(caller.name) << "incorrect type of ingredient " << ingredient_index << " in '" << to_original_string(inst) << "'\n" << end(); +190 raise << " (expected '" << debug_string(container) << "')\n" << end(); +191 raise << " (got '" << debug_string(ingredients.at(ingredient_index)) << "')\n" << end(); 192 return; 193 } 194 ++ingredient_index; @@ -261,7 +260,7 @@ if ('onhashchange' in window) { 197 state.data.pop(); 198 if (state.data.empty()) { 199 if (ingredient_index < SIZE(ingredients)) -200 raise << maybe(caller.name) << "too many ingredients in '" << to_original_string(inst) << "'\n" << end(); +200 raise << maybe(caller.name) << "too many ingredients in '" << to_original_string(inst) << "'\n" << end(); 201 return; 202 } 203 ++state.data.top().container_element_index; @@ -287,7 +286,7 @@ if ('onhashchange' in window) { 223 +error: main: 'merge' should yield a container in '1:num <- merge 3' 224 225 :(before "End Includes") -226 #include <stack> +226 #include <stack> 227 using std::stack; -- cgit 1.4.1-2-gfad0