diff options
Diffstat (limited to 'html/056shape_shifting_recipe.cc.html')
-rw-r--r-- | html/056shape_shifting_recipe.cc.html | 131 |
1 files changed, 67 insertions, 64 deletions
diff --git a/html/056shape_shifting_recipe.cc.html b/html/056shape_shifting_recipe.cc.html index 498320b6..c7af3430 100644 --- a/html/056shape_shifting_recipe.cc.html +++ b/html/056shape_shifting_recipe.cc.html @@ -11,23 +11,25 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Delimiter { color: #800080; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Delimiter { color:#800080; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } .SalientComment { color: #00ffff; } .CommentedCode { color: #6c6c6c; } .muRecipe { color: #ff8700; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .traceContains { color: #008000; } .muData { color: #ffff00; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } --> </style> @@ -62,6 +64,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/056shape_shifting_recipe.cc'>https://github.com/akkartik/mu/blob/master/056shape_shifting_recipe.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="SalientComment">//:: Like container definitions, recipes too can contain type parameters.</span> <span id="L2" class="LineNr"> 2 </span> @@ -96,11 +99,11 @@ if ('onhashchange' in window) { <span id="L31" class="LineNr"> 31 </span> <span id="L32" class="LineNr"> 32 </span><span class="Delimiter">:(before "End Transform Checks")</span> <span id="L33" class="LineNr"> 33 </span>r<span class="Delimiter">.</span>transformed_until = t<span class="Delimiter">;</span> -<span id="L34" class="LineNr"> 34 </span><span class="Normal">if</span> <span class="Delimiter">(</span>Transform<span class="Delimiter">.</span>at<span class="Delimiter">(</span>t<span class="Delimiter">)</span> != <span class="Normal">static_cast</span><transform_fn><span class="Delimiter">(</span>expand_type_abbreviations<span class="Delimiter">)</span> && <a href='056shape_shifting_recipe.cc.html#L156'>any_type_ingredient_in_header</a><span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment"><a href='010vm.cc.html#L14'>recipe_ordinal</a></span><span class="Comment">*/</span>p<span class="Delimiter">-></span>first<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L34" class="LineNr"> 34 </span><span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Transform</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>t<span class="Delimiter">)</span> != <span class="Normal">static_cast</span><transform_fn><span class="Delimiter">(</span>expand_type_abbreviations<span class="Delimiter">)</span> && <a href='056shape_shifting_recipe.cc.html#L156'>any_type_ingredient_in_header</a><span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment"><a href='010vm.cc.html#L14'>recipe_ordinal</a></span><span class="Comment">*/</span>p<span class="Delimiter">-></span>first<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L35" class="LineNr"> 35 </span> <span id="L36" class="LineNr"> 36 </span><span class="Delimiter">:(after "Running One Instruction")</span> -<span id="L37" class="LineNr"> 37 </span><span class="Normal">if</span> <span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>running_step_index == <span class="Constant">0</span> -<span id="L38" class="LineNr"> 38 </span> && <a href='056shape_shifting_recipe.cc.html#L156'>any_type_ingredient_in_header</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>running_recipe<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L37" class="LineNr"> 37 </span><span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>running_step_index == <span class="Constant">0</span> +<span id="L38" class="LineNr"> 38 </span> && <a href='056shape_shifting_recipe.cc.html#L156'>any_type_ingredient_in_header</a><span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>running_recipe<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L39" class="LineNr"> 39 </span><span class="CommentedCode">//? DUMP("");</span> <span id="L40" class="LineNr"> 40 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"ran into unspecialized shape-shifting <a href='010vm.cc.html#L19'>recipe</a> "</span> << <a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">()</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L41" class="LineNr"> 41 </span><span class="CommentedCode">//? exit(0);</span> @@ -115,7 +118,7 @@ if ('onhashchange' in window) { <span id="L50" class="LineNr"> 50 </span>candidates = <a href='056shape_shifting_recipe.cc.html#L73'>strictly_matching_shape_shifting_variants</a><span class="Delimiter">(</span>inst<span class="Delimiter">,</span> variants<span class="Delimiter">);</span> <span id="L51" class="LineNr"> 51 </span><span class="Normal">if</span> <span class="Delimiter">(</span>!candidates<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L52" class="LineNr"> 52 </span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> exemplar = <a href='056shape_shifting_recipe.cc.html#L106'>best_shape_shifting_variant</a><span class="Delimiter">(</span>inst<span class="Delimiter">,</span> candidates<span class="Delimiter">);</span> -<span id="L53" class="LineNr"> 53 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"found variant to specialize: "</span> << exemplar << <span class="Constant">' '</span> << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> exemplar<span class="Delimiter">).</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L53" class="LineNr"> 53 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"found variant to specialize: "</span> << exemplar << <span class="Constant">' '</span> << get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> exemplar<span class="Delimiter">).</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L54" class="LineNr"> 54 </span> string new_recipe_name = <a href='056shape_shifting_recipe.cc.html#L241'>insert_new_variant</a><span class="Delimiter">(</span>exemplar<span class="Delimiter">,</span> inst<span class="Delimiter">,</span> caller_recipe<span class="Delimiter">);</span> <span id="L55" class="LineNr"> 55 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>new_recipe_name != <span class="Constant">""</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L56" class="LineNr"> 56 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"new specialization: "</span> << new_recipe_name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> @@ -127,9 +130,9 @@ if ('onhashchange' in window) { <span id="L62" class="LineNr"> 62 </span><span class="Comment">//: recipes can be called</span> <span id="L63" class="LineNr"> 63 </span> <span id="L64" class="LineNr"> 64 </span><span class="Delimiter">:(before "End Instruction Operation Checks")</span> -<span id="L65" class="LineNr"> 65 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">)</span> && !is_primitive<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation<span class="Delimiter">)</span> +<span id="L65" class="LineNr"> 65 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">)</span> && !is_primitive<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation<span class="Delimiter">)</span> <span id="L66" class="LineNr"> 66 </span> && <a href='056shape_shifting_recipe.cc.html#L156'>any_type_ingredient_in_header</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L67" class="LineNr"> 67 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"instruction '"</span> << inst<span class="Delimiter">.</span>name << <span class="Constant">"' has no valid specialization</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L67" class="LineNr"> 67 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"instruction '"</span> << inst<span class="Delimiter">.</span>name << <span class="Constant">"' has no valid specialization\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L68" class="LineNr"> 68 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L69" class="LineNr"> 69 </span><span class="Delimiter">}</span> <span id="L70" class="LineNr"> 70 </span> @@ -140,7 +143,7 @@ if ('onhashchange' in window) { <span id="L75" class="LineNr"> 75 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>variants<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L76" class="LineNr"> 76 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)</span> == -<span class="Constant">1</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L77" class="LineNr"> 77 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!any_type_ingredient_in_header<span class="Delimiter">(</span>variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L78" class="LineNr"> 78 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!all_concrete_header_reagents_strictly_match<span class="Delimiter">(</span>inst<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L78" class="LineNr"> 78 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!all_concrete_header_reagents_strictly_match<span class="Delimiter">(</span>inst<span class="Delimiter">,</span> get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L79" class="LineNr"> 79 </span> result<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> <span id="L80" class="LineNr"> 80 </span> <span class="Delimiter">}</span> <span id="L81" class="LineNr"> 81 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> @@ -182,10 +185,10 @@ if ('onhashchange' in window) { <span id="L117" class="LineNr"> 117 </span><span class="CommentedCode">//? cerr << "C picking shape-shifting variant:\n";</span> <span id="L118" class="LineNr"> 118 </span> vector<recipe_ordinal> result3 = <a href='056shape_shifting_recipe.cc.html#L128'>keep_max</a><span class="Delimiter">(</span>inst<span class="Delimiter">,</span> result2<span class="Delimiter">,</span> number_of_type_ingredients<span class="Delimiter">);</span> <span id="L119" class="LineNr"> 119 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>result3<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L120" class="LineNr"> 120 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">Couldn't decide the best shape-shifting variant for instruction '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> -<span id="L121" class="LineNr"> 121 </span> cerr << <span class="Constant">"This is a hole in Mu. Please copy the following candidates into an email to Kartik Agaram <mu@akkartik.com></span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L120" class="LineNr"> 120 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"\nCouldn't decide the best shape-shifting variant for instruction '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> +<span id="L121" class="LineNr"> 121 </span> cerr << <span class="Constant">"This is a hole in Mu. Please copy the following candidates into an email to Kartik Agaram <mu@akkartik.com>\n"</span><span class="Delimiter">;</span> <span id="L122" class="LineNr"> 122 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>candidates<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> -<span id="L123" class="LineNr"> 123 </span> cerr << <span class="Constant">" "</span> << header_label<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> candidates<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L123" class="LineNr"> 123 </span> cerr << <span class="Constant">" "</span> << header_label<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> candidates<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L124" class="LineNr"> 124 </span> <span class="Delimiter">}</span> <span id="L125" class="LineNr"> 125 </span> <span class="Identifier">return</span> result3<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L126" class="LineNr"> 126 </span><span class="Delimiter">}</span> @@ -213,13 +216,13 @@ if ('onhashchange' in window) { <span id="L148" class="LineNr"> 148 </span><span class="Delimiter">}</span> <span id="L149" class="LineNr"> 149 </span> <span id="L150" class="LineNr"> 150 </span><span class="Normal">int</span> <a href='056shape_shifting_recipe.cc.html#L150'>arity_fit</a><span class="Delimiter">(</span><span class="Normal">const</span> instruction& inst<span class="Delimiter">,</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> candidate<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L151" class="LineNr"> 151 </span> <span class="Normal">const</span> recipe& r = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> candidate<span class="Delimiter">);</span> +<span id="L151" class="LineNr"> 151 </span> <span class="Normal">const</span> recipe& r = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> candidate<span class="Delimiter">);</span> <span id="L152" class="LineNr"> 152 </span> <span class="Identifier">return</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> - <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>products<span class="Delimiter">))</span> <span id="L153" class="LineNr"> 153 </span> + <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> - <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">));</span> <span id="L154" class="LineNr"> 154 </span><span class="Delimiter">}</span> <span id="L155" class="LineNr"> 155 </span> <span id="L156" class="LineNr"> 156 </span><span class="Normal">bool</span> <a href='056shape_shifting_recipe.cc.html#L156'>any_type_ingredient_in_header</a><span class="Delimiter">(</span><a href='010vm.cc.html#L14'>recipe_ordinal</a> variant<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L157" class="LineNr"> 157 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> variant<span class="Delimiter">);</span> +<span id="L157" class="LineNr"> 157 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> variant<span class="Delimiter">);</span> <span id="L158" class="LineNr"> 158 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L159" class="LineNr"> 159 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>contains_type_ingredient_name<span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> <span id="L160" class="LineNr"> 160 </span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> @@ -250,9 +253,9 @@ if ('onhashchange' in window) { <span id="L185" class="LineNr"> 185 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>from<span class="Delimiter">-></span>atom != to<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L186" class="LineNr"> 186 </span> <span class="Comment">// both from and to are atoms</span> <span id="L187" class="LineNr"> 187 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>from<span class="Delimiter">-></span>name == <span class="Constant">"literal"</span><span class="Delimiter">)</span> -<span id="L188" class="LineNr"> 188 </span> <span class="Identifier">return</span> Literal_type_names<span class="Delimiter">.</span>find<span class="Delimiter">(</span>to<span class="Delimiter">-></span>name<span class="Delimiter">)</span> != Literal_type_names<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L188" class="LineNr"> 188 </span> <span class="Identifier">return</span> <span class="Special">Literal_type_names</span><span class="Delimiter">.</span>find<span class="Delimiter">(</span>to<span class="Delimiter">-></span>name<span class="Delimiter">)</span> != <span class="Special">Literal_type_names</span><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L189" class="LineNr"> 189 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>to<span class="Delimiter">-></span>name == <span class="Constant">"literal"</span><span class="Delimiter">)</span> -<span id="L190" class="LineNr"> 190 </span> <span class="Identifier">return</span> Literal_type_names<span class="Delimiter">.</span>find<span class="Delimiter">(</span>from<span class="Delimiter">-></span>name<span class="Delimiter">)</span> != Literal_type_names<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L190" class="LineNr"> 190 </span> <span class="Identifier">return</span> <span class="Special">Literal_type_names</span><span class="Delimiter">.</span>find<span class="Delimiter">(</span>from<span class="Delimiter">-></span>name<span class="Delimiter">)</span> != <span class="Special">Literal_type_names</span><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L191" class="LineNr"> 191 </span> <span class="Identifier">return</span> to<span class="Delimiter">-></span>name == from<span class="Delimiter">-></span>name<span class="Delimiter">;</span> <span id="L192" class="LineNr"> 192 </span><span class="Delimiter">}</span> <span id="L193" class="LineNr"> 193 </span> @@ -267,7 +270,7 @@ if ('onhashchange' in window) { <span id="L202" class="LineNr"> 202 </span><span class="Delimiter">}</span> <span id="L203" class="LineNr"> 203 </span> <span id="L204" class="LineNr"> 204 </span><span class="Normal">int</span> number_of_concrete_type_names<span class="Delimiter">(</span><span class="Normal">const</span> instruction& <span class="Comment">/*</span><span class="Comment">unused</span><span class="Comment">*/</span><span class="Delimiter">,</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L205" class="LineNr"> 205 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L205" class="LineNr"> 205 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L206" class="LineNr"> 206 </span> <span class="Normal">int</span> result = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L207" class="LineNr"> 207 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L208" class="LineNr"> 208 </span> result += number_of_concrete_type_names<span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>type<span class="Delimiter">);</span> @@ -285,7 +288,7 @@ if ('onhashchange' in window) { <span id="L220" class="LineNr"> 220 </span><span class="Delimiter">}</span> <span id="L221" class="LineNr"> 221 </span> <span id="L222" class="LineNr"> 222 </span><span class="Normal">int</span> number_of_type_ingredients<span class="Delimiter">(</span><span class="Normal">const</span> instruction& <span class="Comment">/*</span><span class="Comment">unused</span><span class="Comment">*/</span><span class="Delimiter">,</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L223" class="LineNr"> 223 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L223" class="LineNr"> 223 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L224" class="LineNr"> 224 </span> <span class="Normal">int</span> result = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L225" class="LineNr"> 225 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L226" class="LineNr"> 226 </span> result += number_of_type_ingredients<span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>type<span class="Delimiter">);</span> @@ -305,13 +308,13 @@ if ('onhashchange' in window) { <span id="L240" class="LineNr"> 240 </span><span class="Comment">// returns name of new variant</span> <span id="L241" class="LineNr"> 241 </span>string <a href='056shape_shifting_recipe.cc.html#L241'>insert_new_variant</a><span class="Delimiter">(</span><a href='010vm.cc.html#L14'>recipe_ordinal</a> exemplar<span class="Delimiter">,</span> <span class="Normal">const</span> instruction& inst<span class="Delimiter">,</span> <span class="Normal">const</span> recipe& caller_recipe<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L242" class="LineNr"> 242 </span> string new_name = <a href='054static_dispatch.cc.html#L111'>next_unused_recipe_name</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name<span class="Delimiter">);</span> -<span id="L243" class="LineNr"> 243 </span> assert<span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> new_name<span class="Delimiter">));</span> -<span id="L244" class="LineNr"> 244 </span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> new_recipe_ordinal = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> new_name<span class="Delimiter">,</span> Next_recipe_ordinal++<span class="Delimiter">);</span> +<span id="L243" class="LineNr"> 243 </span> assert<span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> new_name<span class="Delimiter">));</span> +<span id="L244" class="LineNr"> 244 </span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> new_recipe_ordinal = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> new_name<span class="Delimiter">,</span> <span class="Special">Next_recipe_ordinal</span>++<span class="Delimiter">);</span> <span id="L245" class="LineNr"> 245 </span> <span class="Comment">// make a copy</span> -<span id="L246" class="LineNr"> 246 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> exemplar<span class="Delimiter">));</span> -<span id="L247" class="LineNr"> 247 </span> assert<span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> new_recipe_ordinal<span class="Delimiter">));</span> -<span id="L248" class="LineNr"> 248 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> new_recipe_ordinal<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> exemplar<span class="Delimiter">));</span> -<span id="L249" class="LineNr"> 249 </span> recipe& new_recipe = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> new_recipe_ordinal<span class="Delimiter">);</span> +<span id="L246" class="LineNr"> 246 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> exemplar<span class="Delimiter">));</span> +<span id="L247" class="LineNr"> 247 </span> assert<span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> new_recipe_ordinal<span class="Delimiter">));</span> +<span id="L248" class="LineNr"> 248 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> new_recipe_ordinal<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> exemplar<span class="Delimiter">));</span> +<span id="L249" class="LineNr"> 249 </span> recipe& new_recipe = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> new_recipe_ordinal<span class="Delimiter">);</span> <span id="L250" class="LineNr"> 250 </span> new_recipe<span class="Delimiter">.</span>name = new_name<span class="Delimiter">;</span> <span id="L251" class="LineNr"> 251 </span> new_recipe<span class="Delimiter">.</span>ordinal = new_recipe_ordinal<span class="Delimiter">;</span> <span id="L252" class="LineNr"> 252 </span> new_recipe<span class="Delimiter">.</span>is_autogenerated =<span class="Constant"> true</span><span class="Delimiter">;</span> @@ -320,9 +323,9 @@ if ('onhashchange' in window) { <span id="L255" class="LineNr"> 255 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"transforming new specialization: "</span> << new_recipe<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L256" class="LineNr"> 256 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << new_recipe<span class="Delimiter">.</span>name << <span class="Constant">": performing transforms until check_or_set_types_by_name"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L257" class="LineNr"> 257 </span> <span class="Normal">int</span> transform_index = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L258" class="LineNr"> 258 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>transform_index = <span class="Constant">0</span><span class="Delimiter">;</span> transform_index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Transform<span class="Delimiter">);</span> ++transform_index<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L259" class="LineNr"> 259 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Transform<span class="Delimiter">.</span>at<span class="Delimiter">(</span>transform_index<span class="Delimiter">)</span> == <a href='046check_type_by_name.cc.html#L35'>check_or_set_types_by_name</a><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L260" class="LineNr"> 260 </span> <span class="Delimiter">(</span>*Transform<span class="Delimiter">.</span>at<span class="Delimiter">(</span>transform_index<span class="Delimiter">))(</span>new_recipe_ordinal<span class="Delimiter">);</span> +<span id="L258" class="LineNr"> 258 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>transform_index = <span class="Constant">0</span><span class="Delimiter">;</span> transform_index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Transform</span><span class="Delimiter">);</span> ++transform_index<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L259" class="LineNr"> 259 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Transform</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>transform_index<span class="Delimiter">)</span> == <a href='046check_type_by_name.cc.html#L35'>check_or_set_types_by_name</a><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L260" class="LineNr"> 260 </span> <span class="Delimiter">(</span>*<span class="Special">Transform</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>transform_index<span class="Delimiter">))(</span>new_recipe_ordinal<span class="Delimiter">);</span> <span id="L261" class="LineNr"> 261 </span> <span class="Delimiter">}</span> <span id="L262" class="LineNr"> 262 </span> new_recipe<span class="Delimiter">.</span>transformed_until = transform_index-<span class="Constant">1</span><span class="Delimiter">;</span> <span id="L263" class="LineNr"> 263 </span> @@ -334,21 +337,21 @@ if ('onhashchange' in window) { <span id="L269" class="LineNr"> 269 </span> <span class="Delimiter">{</span> <span id="L270" class="LineNr"> 270 </span> map<string<span class="Delimiter">,</span> <span class="Normal">const</span> type_tree*> mappings<span class="Delimiter">;</span> <span id="L271" class="LineNr"> 271 </span> <span class="Normal">bool</span> error =<span class="Constant"> false</span><span class="Delimiter">;</span> -<span id="L272" class="LineNr"> 272 </span> <a href='056shape_shifting_recipe.cc.html#L328'>compute_type_ingredient_mappings</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> exemplar<span class="Delimiter">),</span> inst<span class="Delimiter">,</span> mappings<span class="Delimiter">,</span> caller_recipe<span class="Delimiter">,</span> &error<span class="Delimiter">);</span> +<span id="L272" class="LineNr"> 272 </span> <a href='056shape_shifting_recipe.cc.html#L328'>compute_type_ingredient_mappings</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> exemplar<span class="Delimiter">),</span> inst<span class="Delimiter">,</span> mappings<span class="Delimiter">,</span> caller_recipe<span class="Delimiter">,</span> &error<span class="Delimiter">);</span> <span id="L273" class="LineNr"> 273 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!error<span class="Delimiter">)</span> error = <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>mappings<span class="Delimiter">)</span> != <a href='056shape_shifting_recipe.cc.html#L466'>type_ingredient_count_in_header</a><span class="Delimiter">(</span>exemplar<span class="Delimiter">));</span> <span id="L274" class="LineNr"> 274 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!error<span class="Delimiter">)</span> replace_type_ingredients<span class="Delimiter">(</span>new_recipe<span class="Delimiter">,</span> mappings<span class="Delimiter">);</span> <span id="L275" class="LineNr"> 275 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<string<span class="Delimiter">,</span> <span class="Normal">const</span> type_tree*>::iterator p = mappings<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != mappings<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span id="L276" class="LineNr"> 276 </span> <span class="Normal">delete</span> p<span class="Delimiter">-></span>second<span class="Delimiter">;</span> <span id="L277" class="LineNr"> 277 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>error<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">""</span><span class="Delimiter">;</span> <span id="L278" class="LineNr"> 278 </span> <span class="Delimiter">}</span> -<span id="L279" class="LineNr"> 279 </span> ensure_all_concrete_types<span class="Delimiter">(</span>new_recipe<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> exemplar<span class="Delimiter">));</span> +<span id="L279" class="LineNr"> 279 </span> ensure_all_concrete_types<span class="Delimiter">(</span>new_recipe<span class="Delimiter">,</span> get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> exemplar<span class="Delimiter">));</span> <span id="L280" class="LineNr"> 280 </span> <span id="L281" class="LineNr"> 281 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << new_recipe<span class="Delimiter">.</span>name << <span class="Constant">": recording the new variant before recursively calling resolve_ambiguous_calls"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L282" class="LineNr"> 282 </span> get<span class="Delimiter">(</span>Recipe_variants<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>name<span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>new_recipe_ordinal<span class="Delimiter">);</span> +<span id="L282" class="LineNr"> 282 </span> get<span class="Delimiter">(</span><span class="Special">Recipe_variants</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>name<span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>new_recipe_ordinal<span class="Delimiter">);</span> <span id="L283" class="LineNr"> 283 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << new_recipe<span class="Delimiter">.</span>name << <span class="Constant">": performing remaining transforms (including resolve_ambiguous_calls)"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L284" class="LineNr"> 284 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">nada</span><span class="Comment">*/</span><span class="Delimiter">;</span> transform_index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Transform<span class="Delimiter">);</span> ++transform_index<span class="Delimiter">)</span> -<span id="L285" class="LineNr"> 285 </span> <span class="Delimiter">(</span>*Transform<span class="Delimiter">.</span>at<span class="Delimiter">(</span>transform_index<span class="Delimiter">))(</span>new_recipe_ordinal<span class="Delimiter">);</span> -<span id="L286" class="LineNr"> 286 </span> new_recipe<span class="Delimiter">.</span>transformed_until = <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Transform<span class="Delimiter">)</span>-<span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L284" class="LineNr"> 284 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">nada</span><span class="Comment">*/</span><span class="Delimiter">;</span> transform_index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Transform</span><span class="Delimiter">);</span> ++transform_index<span class="Delimiter">)</span> +<span id="L285" class="LineNr"> 285 </span> <span class="Delimiter">(</span>*<span class="Special">Transform</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>transform_index<span class="Delimiter">))(</span>new_recipe_ordinal<span class="Delimiter">);</span> +<span id="L286" class="LineNr"> 286 </span> new_recipe<span class="Delimiter">.</span>transformed_until = <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Transform</span><span class="Delimiter">)</span>-<span class="Constant">1</span><span class="Delimiter">;</span> <span id="L287" class="LineNr"> 287 </span> <span class="Identifier">return</span> new_recipe<span class="Delimiter">.</span>name<span class="Delimiter">;</span> <span id="L288" class="LineNr"> 288 </span><span class="Delimiter">}</span> <span id="L289" class="LineNr"> 289 </span> @@ -381,7 +384,7 @@ if ('onhashchange' in window) { <span id="L316" class="LineNr"> 316 </span> <span class="Comment">// We've found it useful in the past for tracking down bugs in</span> <span id="L317" class="LineNr"> 317 </span> <span class="Comment">// specialization.</span> <span id="L318" class="LineNr"> 318 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L319" class="LineNr"> 319 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>variant<span class="Delimiter">.</span>original_name<span class="Delimiter">)</span> << <span class="Constant">"unknown type for '"</span> << x<span class="Delimiter">.</span>original_string << <span class="Constant">"'"</span> << context << <span class="Constant">" (check the name for typos)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L319" class="LineNr"> 319 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>variant<span class="Delimiter">.</span>original_name<span class="Delimiter">)</span> << <span class="Constant">"unknown type for '"</span> << x<span class="Delimiter">.</span>original_string << <span class="Constant">"'"</span> << context << <span class="Constant">" (check the name for typos)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L320" class="LineNr"> 320 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L321" class="LineNr"> 321 </span> <span class="Delimiter">}</span> <span id="L322" class="LineNr"> 322 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>type<span class="Delimiter">,</span> x<span class="Delimiter">.</span>name<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> @@ -420,7 +423,7 @@ if ('onhashchange' in window) { <span id="L355" class="LineNr"> 355 </span> <span class="Comment">// probably a bug in mu</span> <span id="L356" class="LineNr"> 356 </span> <span class="Comment">// todo: make this smarter; only flag an error if exemplar_type contains some *new* type ingredient</span> <span id="L357" class="LineNr"> 357 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>exemplar<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"missing type ingredient for "</span> << exemplar_reagent<span class="Delimiter">.</span>original_string << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L358" class="LineNr"> 358 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" (called from '"</span> << to_original_string<span class="Delimiter">(</span>call_instruction<span class="Delimiter">)</span> << <span class="Constant">"')</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L358" class="LineNr"> 358 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" (called from '"</span> << to_original_string<span class="Delimiter">(</span>call_instruction<span class="Delimiter">)</span> << <span class="Constant">"')\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L359" class="LineNr"> 359 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L360" class="LineNr"> 360 </span> <span class="Delimiter">}</span> <span id="L361" class="LineNr"> 361 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!exemplar_type<span class="Delimiter">-></span>atom && exemplar_type<span class="Delimiter">-></span>right == <span class="Constant">NULL</span> && !refinement_type<span class="Delimiter">-></span>atom && refinement_type<span class="Delimiter">-></span>right != <span class="Constant">NULL</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -442,7 +445,7 @@ if ('onhashchange' in window) { <span id="L377" class="LineNr"> 377 </span> <span class="Delimiter">}</span> <span id="L378" class="LineNr"> 378 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> <span id="L379" class="LineNr"> 379 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!deeply_equal_type_names<span class="Delimiter">(</span>get<span class="Delimiter">(</span>mappings<span class="Delimiter">,</span> exemplar_type<span class="Delimiter">-></span>name<span class="Delimiter">),</span> curr_refinement_type<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L380" class="LineNr"> 380 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>caller_recipe<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"no call found for '"</span> << to_original_string<span class="Delimiter">(</span>call_instruction<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L380" class="LineNr"> 380 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>caller_recipe<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"no call found for '"</span> << to_original_string<span class="Delimiter">(</span>call_instruction<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L381" class="LineNr"> 381 </span> *error =<span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L382" class="LineNr"> 382 </span> <span class="Normal">delete</span> curr_refinement_type<span class="Delimiter">;</span> <span id="L383" class="LineNr"> 383 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> @@ -492,7 +495,7 @@ if ('onhashchange' in window) { <span id="L427" class="LineNr"> 427 </span> string before = <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">);</span> <span id="L428" class="LineNr"> 428 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"replacing in ingredient "</span> << x<span class="Delimiter">.</span>original_string << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L429" class="LineNr"> 429 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L430" class="LineNr"> 430 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"specializing "</span> << caller<span class="Delimiter">.</span>original_name << <span class="Constant">": missing type for '"</span> << x<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L430" class="LineNr"> 430 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"specializing "</span> << caller<span class="Delimiter">.</span>original_name << <span class="Constant">": missing type for '"</span> << x<span class="Delimiter">.</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L431" class="LineNr"> 431 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L432" class="LineNr"> 432 </span> <span class="Delimiter">}</span> <span id="L433" class="LineNr"> 433 </span> replace_type_ingredients<span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">,</span> mappings<span class="Delimiter">);</span> @@ -509,19 +512,19 @@ if ('onhashchange' in window) { <span id="L444" class="LineNr"> 444 </span> replace_type_ingredients<span class="Delimiter">(</span>type<span class="Delimiter">-></span>right<span class="Delimiter">,</span> mappings<span class="Delimiter">);</span> <span id="L445" class="LineNr"> 445 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L446" class="LineNr"> 446 </span> <span class="Delimiter">}</span> -<span id="L447" class="LineNr"> 447 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">))</span> <span class="Comment">// todo: ugly side effect</span> -<span id="L448" class="LineNr"> 448 </span> type<span class="Delimiter">-></span>value = get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">);</span> +<span id="L447" class="LineNr"> 447 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">))</span> <span class="Comment">// todo: ugly side effect</span> +<span id="L448" class="LineNr"> 448 </span> type<span class="Delimiter">-></span>value = get<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">);</span> <span id="L449" class="LineNr"> 449 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>mappings<span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">))</span> <span id="L450" class="LineNr"> 450 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L451" class="LineNr"> 451 </span> <span class="Normal">const</span> type_tree* replacement = get<span class="Delimiter">(</span>mappings<span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">);</span> <span id="L452" class="LineNr"> 452 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << type<span class="Delimiter">-></span>name << <span class="Constant">" => "</span> << names_to_string<span class="Delimiter">(</span>replacement<span class="Delimiter">)</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L453" class="LineNr"> 453 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>replacement<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L454" class="LineNr"> 454 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> replacement<span class="Delimiter">-></span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L454" class="LineNr"> 454 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> replacement<span class="Delimiter">-></span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L455" class="LineNr"> 455 </span> <span class="Comment">// error in program; should be reported elsewhere</span> <span id="L456" class="LineNr"> 456 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L457" class="LineNr"> 457 </span> <span class="Delimiter">}</span> <span id="L458" class="LineNr"> 458 </span> type<span class="Delimiter">-></span>name = <span class="Delimiter">(</span>replacement<span class="Delimiter">-></span>name == <span class="Constant">"literal"</span><span class="Delimiter">)</span> ? <span class="Constant">"number"</span> : replacement<span class="Delimiter">-></span>name<span class="Delimiter">;</span> -<span id="L459" class="LineNr"> 459 </span> type<span class="Delimiter">-></span>value = get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">);</span> +<span id="L459" class="LineNr"> 459 </span> type<span class="Delimiter">-></span>value = get<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">);</span> <span id="L460" class="LineNr"> 460 </span> <span class="Delimiter">}</span> <span id="L461" class="LineNr"> 461 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> <span id="L462" class="LineNr"> 462 </span> *type = *replacement<span class="Delimiter">;</span> @@ -529,7 +532,7 @@ if ('onhashchange' in window) { <span id="L464" class="LineNr"> 464 </span><span class="Delimiter">}</span> <span id="L465" class="LineNr"> 465 </span> <span id="L466" class="LineNr"> 466 </span><span class="Normal">int</span> <a href='056shape_shifting_recipe.cc.html#L466'>type_ingredient_count_in_header</a><span class="Delimiter">(</span><a href='010vm.cc.html#L14'>recipe_ordinal</a> variant<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L467" class="LineNr"> 467 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> variant<span class="Delimiter">);</span> +<span id="L467" class="LineNr"> 467 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> variant<span class="Delimiter">);</span> <span id="L468" class="LineNr"> 468 </span> set<string> type_ingredients<span class="Delimiter">;</span> <span id="L469" class="LineNr"> 469 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L470" class="LineNr"> 470 </span> accumulate_type_ingredients<span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>type<span class="Delimiter">,</span> type_ingredients<span class="Delimiter">);</span> @@ -736,21 +739,21 @@ if ('onhashchange' in window) { <span id="L671" class="LineNr"> 671 </span><span class="Comment">// this one needs a little more fine-grained control</span> <span id="L672" class="LineNr"> 672 </span><span class="Normal">void</span> <a href='056shape_shifting_recipe.cc.html#L672'>test_shape_shifting_new_ingredient_does_not_pollute_global_namespace</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> <span id="L673" class="LineNr"> 673 </span> <span class="Comment">// if you specialize a shape-shifting recipe that allocates a type-ingredient..</span> -<span id="L674" class="LineNr"> 674 </span> <a href='012transform.cc.html#L99'>transform</a><span class="Delimiter">(</span><span class="Constant">"def barz x:_elem [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L675" class="LineNr"> 675 </span> <span class="Constant">" local-scope</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L676" class="LineNr"> 676 </span> <span class="Constant">" load-ingredients</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L677" class="LineNr"> 677 </span> <span class="Constant">" y:&:num <- new _elem:type</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L678" class="LineNr"> 678 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L679" class="LineNr"> 679 </span> <span class="Constant">"def fooz [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L680" class="LineNr"> 680 </span> <span class="Constant">" local-scope</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L681" class="LineNr"> 681 </span> <span class="Constant">" barz 34</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L682" class="LineNr"> 682 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> +<span id="L674" class="LineNr"> 674 </span> <a href='012transform.cc.html#L99'>transform</a><span class="Delimiter">(</span><span class="Constant">"def barz x:_elem [\n"</span> +<span id="L675" class="LineNr"> 675 </span> <span class="Constant">" local-scope\n"</span> +<span id="L676" class="LineNr"> 676 </span> <span class="Constant">" load-ingredients\n"</span> +<span id="L677" class="LineNr"> 677 </span> <span class="Constant">" y:&:num <- new _elem:type\n"</span> +<span id="L678" class="LineNr"> 678 </span> <span class="Constant">"]\n"</span> +<span id="L679" class="LineNr"> 679 </span> <span class="Constant">"def fooz [\n"</span> +<span id="L680" class="LineNr"> 680 </span> <span class="Constant">" local-scope\n"</span> +<span id="L681" class="LineNr"> 681 </span> <span class="Constant">" barz 34\n"</span> +<span id="L682" class="LineNr"> 682 </span> <span class="Constant">"]\n"</span><span class="Delimiter">);</span> <span id="L683" class="LineNr"> 683 </span> <span class="Comment">// ..and if you then try to load a new shape-shifting container with that</span> <span id="L684" class="LineNr"> 684 </span> <span class="Comment">// type-ingredient</span> -<span id="L685" class="LineNr"> 685 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo:_elem [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L686" class="LineNr"> 686 </span> <span class="Constant">" x:_elem</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L687" class="LineNr"> 687 </span> <span class="Constant">" y:num</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L688" class="LineNr"> 688 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> +<span id="L685" class="LineNr"> 685 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo:_elem [\n"</span> +<span id="L686" class="LineNr"> 686 </span> <span class="Constant">" x:_elem\n"</span> +<span id="L687" class="LineNr"> 687 </span> <span class="Constant">" y:num\n"</span> +<span id="L688" class="LineNr"> 688 </span> <span class="Constant">"]\n"</span><span class="Delimiter">);</span> <span id="L689" class="LineNr"> 689 </span> <span class="Comment">// then it should work as usual</span> <span id="L690" class="LineNr"> 690 </span> reagent callsite<span class="Delimiter">(</span><span class="Constant">"x:foo:point"</span><span class="Delimiter">);</span> <span id="L691" class="LineNr"> 691 </span> reagent element = <a href='030container.cc.html#L212'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> |