diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-12-01 14:13:33 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-12-01 14:13:33 -0800 |
commit | e4ac3c9e6e5464a0fc0f8fd3763a572e0e180c04 (patch) | |
tree | 7f6ca26afcdf8e3bf54459c6592ebf26fb968133 /html/057immutable.cc.html | |
parent | 54e5128a14dcea5b93a8a9402558f0736fb7dba3 (diff) | |
download | mu-e4ac3c9e6e5464a0fc0f8fd3763a572e0e180c04.tar.gz |
4814
Diffstat (limited to 'html/057immutable.cc.html')
-rw-r--r-- | html/057immutable.cc.html | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/html/057immutable.cc.html b/html/057immutable.cc.html index 7de41706..e329f342 100644 --- a/html/057immutable.cc.html +++ b/html/057immutable.cc.html @@ -11,21 +11,22 @@ <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; } +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; } .muData { color: #ffff00; } -.Constant { color: #00a0a0; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } -.cSpecial { color: #008000; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -60,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/057immutable.cc'>https://github.com/akkartik/mu/blob/master/057immutable.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Ingredients of a recipe are meant to be immutable unless they're also</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: products. This layer will start enforcing this check.</span> @@ -398,7 +400,7 @@ if ('onhashchange' in window) { <span id="L335" class="LineNr">335 </span>$error: <span class="Constant">0</span> <span id="L336" class="LineNr">336 </span> <span id="L337" class="LineNr">337 </span><span class="Delimiter">:(before "End Transforms")</span> -<span id="L338" class="LineNr">338 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='057immutable.cc.html#L341'>check_immutable_ingredients</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L338" class="LineNr">338 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='057immutable.cc.html#L341'>check_immutable_ingredients</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L339" class="LineNr">339 </span> <span id="L340" class="LineNr">340 </span><span class="Delimiter">:(code)</span> <span id="L341" class="LineNr">341 </span><span class="Normal">void</span> <a href='057immutable.cc.html#L341'>check_immutable_ingredients</a><span class="Delimiter">(</span><span class="Normal">const</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -406,7 +408,7 @@ if ('onhashchange' in window) { <span id="L343" class="LineNr">343 </span> <span class="Comment">// a) we never write to its contents directly,</span> <span id="L344" class="LineNr">344 </span> <span class="Comment">// b) we never call 'put' or 'put-index' on it, and</span> <span id="L345" class="LineNr">345 </span> <span class="Comment">// c) any non-primitive recipe calls in the body aren't returning it as a product</span> -<span id="L346" class="LineNr">346 </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="L346" class="LineNr">346 </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="L347" class="LineNr">347 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- check mutability of ingredients in <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L348" class="LineNr">348 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!caller<span class="Delimiter">.</span>has_header<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span class="Comment">// skip check for old-style recipes calling next-ingredient directly</span> <span id="L349" class="LineNr">349 </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> @@ -426,7 +428,7 @@ if ('onhashchange' in window) { <span id="L363" class="LineNr">363 </span> <span id="L364" class="LineNr">364 </span><span class="Normal">void</span> <a href='057immutable.cc.html#L364'>update_aliases</a><span class="Delimiter">(</span><span class="Normal">const</span> instruction& inst<span class="Delimiter">,</span> set<reagent<span class="Delimiter">,</span> name_and_space_lt>& current_ingredient_and_aliases<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L365" class="LineNr">365 </span> set<<span class="Normal">int</span>> current_ingredient_indices = <a href='057immutable.cc.html#L544'>ingredient_indices</a><span class="Delimiter">(</span>inst<span class="Delimiter">,</span> current_ingredient_and_aliases<span class="Delimiter">);</span> -<span id="L366" class="LineNr">366 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L366" class="LineNr">366 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L367" class="LineNr">367 </span> <span class="Comment">// primitive recipe</span> <span id="L368" class="LineNr">368 </span> <span class="Normal">switch</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L369" class="LineNr">369 </span> <span class="Normal">case</span> <a href='010vm.cc.html#L196'>COPY</a>: @@ -457,7 +459,7 @@ if ('onhashchange' in window) { <span id="L394" class="LineNr">394 </span> <span id="L395" class="LineNr">395 </span>set<<span class="Normal">int</span>> <a href='057immutable.cc.html#L395'>scan_contained_in_product_indices</a><span class="Delimiter">(</span><span class="Normal">const</span> instruction& inst<span class="Delimiter">,</span> set<<span class="Normal">int</span>>& <a href='057immutable.cc.html#L544'>ingredient_indices</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L396" class="LineNr">396 </span> set<reagent<span class="Delimiter">,</span> name_and_space_lt> selected_ingredients<span class="Delimiter">;</span> -<span id="L397" class="LineNr">397 </span> <span class="Normal">const</span> recipe& callee = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">);</span> +<span id="L397" class="LineNr">397 </span> <span class="Normal">const</span> recipe& callee = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">);</span> <span id="L398" class="LineNr">398 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>set<<span class="Normal">int</span>>::iterator p = <a href='057immutable.cc.html#L544'>ingredient_indices</a><span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <a href='057immutable.cc.html#L544'>ingredient_indices</a><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L399" class="LineNr">399 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>*p >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>callee<span class="Delimiter">.</span>ingredients<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span class="Comment">// optional immutable ingredient</span> <span id="L400" class="LineNr">400 </span> selected_ingredients<span class="Delimiter">.</span>insert<span class="Delimiter">(</span>callee<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>*p<span class="Delimiter">));</span> @@ -480,8 +482,8 @@ if ('onhashchange' in window) { <span id="L417" class="LineNr">417 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span id="L418" class="LineNr">418 </span> <span class="Identifier">return</span> is_mu_container<span class="Delimiter">(</span>get_base_type<span class="Delimiter">(</span>type<span class="Delimiter">));</span> <span id="L419" class="LineNr">419 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>type<span class="Delimiter">-></span>value == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> -<span id="L420" class="LineNr">420 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span class="Comment">// error raised elsewhere</span> -<span id="L421" class="LineNr">421 </span> type_info& info = get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">);</span> +<span id="L420" class="LineNr">420 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span class="Comment">// error raised elsewhere</span> +<span id="L421" class="LineNr">421 </span> type_info& info = get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">);</span> <span id="L422" class="LineNr">422 </span> <span class="Identifier">return</span> info<span class="Delimiter">.</span>kind == <a href='010vm.cc.html#L180'>CONTAINER</a><span class="Delimiter">;</span> <span id="L423" class="LineNr">423 </span><span class="Delimiter">}</span> <span id="L424" class="LineNr">424 </span> @@ -493,8 +495,8 @@ if ('onhashchange' in window) { <span id="L430" class="LineNr">430 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span id="L431" class="LineNr">431 </span> <span class="Identifier">return</span> is_mu_exclusive_container<span class="Delimiter">(</span>get_base_type<span class="Delimiter">(</span>type<span class="Delimiter">));</span> <span id="L432" class="LineNr">432 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>type<span class="Delimiter">-></span>value == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> -<span id="L433" class="LineNr">433 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span class="Comment">// error raised elsewhere</span> -<span id="L434" class="LineNr">434 </span> type_info& info = get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">);</span> +<span id="L433" class="LineNr">433 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span class="Comment">// error raised elsewhere</span> +<span id="L434" class="LineNr">434 </span> type_info& info = get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">);</span> <span id="L435" class="LineNr">435 </span> <span class="Identifier">return</span> info<span class="Delimiter">.</span>kind == <a href='010vm.cc.html#L181'>EXCLUSIVE_CONTAINER</a><span class="Delimiter">;</span> <span id="L436" class="LineNr">436 </span><span class="Delimiter">}</span> <span id="L437" class="LineNr">437 </span> @@ -545,9 +547,9 @@ if ('onhashchange' in window) { <span id="L482" class="LineNr">482 </span> && current_ingredient_and_aliases<span class="Delimiter">.</span>find<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> != current_ingredient_and_aliases<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L483" class="LineNr">483 </span> string current_product_name = inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name<span class="Delimiter">;</span> <span id="L484" class="LineNr">484 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>current_product_name == original_ingredient_name<span class="Delimiter">)</span> -<span id="L485" class="LineNr">485 </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">"cannot modify '"</span> << current_product_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because it's an ingredient of recipe "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L485" class="LineNr">485 </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">"cannot modify '"</span> << current_product_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because it's an ingredient of recipe "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product\n"</span> << end<span class="Delimiter">();</span> <span id="L486" class="LineNr">486 </span> <span class="Normal">else</span> -<span id="L487" class="LineNr">487 </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">"cannot modify '"</span> << current_product_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because that would modify "</span> << original_ingredient_name << <span class="Constant">" which is an ingredient of <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L487" class="LineNr">487 </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">"cannot modify '"</span> << current_product_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because that would modify "</span> << original_ingredient_name << <span class="Constant">" which is an ingredient of <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L488" class="LineNr">488 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L489" class="LineNr">489 </span> <span class="Delimiter">}</span> <span id="L490" class="LineNr">490 </span> <span class="Delimiter">}</span> @@ -559,7 +561,7 @@ if ('onhashchange' in window) { <span id="L496" class="LineNr">496 </span> reagent current_ingredient = inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>current_ingredient_index<span class="Delimiter">);</span> <span id="L497" class="LineNr">497 </span> canonize_type<span class="Delimiter">(</span>current_ingredient<span class="Delimiter">);</span> <span id="L498" class="LineNr">498 </span> <span class="Normal">const</span> string& current_ingredient_name = current_ingredient<span class="Delimiter">.</span>name<span class="Delimiter">;</span> -<span id="L499" class="LineNr">499 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L499" class="LineNr">499 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L500" class="LineNr">500 </span> <span class="Comment">// primitive recipe</span> <span id="L501" class="LineNr">501 </span> <span class="Comment">// we got here only because we got an instruction with an implicit product, and the instruction didn't explicitly spell it out</span> <span id="L502" class="LineNr">502 </span> <span class="Comment">// put x, y:offset, z</span> @@ -568,9 +570,9 @@ if ('onhashchange' in window) { <span id="L505" class="LineNr">505 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation == PUT || inst<span class="Delimiter">.</span>operation == PUT_INDEX<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L506" class="LineNr">506 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>current_ingredient_index == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L507" class="LineNr">507 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>current_ingredient_name == original_ingredient_name<span class="Delimiter">)</span> -<span id="L508" class="LineNr">508 </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">"cannot modify '"</span> << current_ingredient_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because it's an ingredient of recipe "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L508" class="LineNr">508 </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">"cannot modify '"</span> << current_ingredient_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because it's an ingredient of recipe "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product\n"</span> << end<span class="Delimiter">();</span> <span id="L509" class="LineNr">509 </span> <span class="Normal">else</span> -<span id="L510" class="LineNr">510 </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">"cannot modify '"</span> << current_ingredient_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because that would modify '"</span> << original_ingredient_name << <span class="Constant">"' which is an ingredient of <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L510" class="LineNr">510 </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">"cannot modify '"</span> << current_ingredient_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because that would modify '"</span> << original_ingredient_name << <span class="Constant">"' which is an ingredient of <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L511" class="LineNr">511 </span> <span class="Delimiter">}</span> <span id="L512" class="LineNr">512 </span> <span class="Delimiter">}</span> <span id="L513" class="LineNr">513 </span> <span class="Delimiter">}</span> @@ -578,18 +580,18 @@ if ('onhashchange' in window) { <span id="L515" class="LineNr">515 </span> <span class="Comment">// defined recipe</span> <span id="L516" class="LineNr">516 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='057immutable.cc.html#L526'>is_modified_in_recipe</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation<span class="Delimiter">,</span> current_ingredient_index<span class="Delimiter">,</span> caller<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L517" class="LineNr">517 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>current_ingredient_name == original_ingredient_name<span class="Delimiter">)</span> -<span id="L518" class="LineNr">518 </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">"cannot modify '"</span> << current_ingredient_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because it's an ingredient of recipe "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L518" class="LineNr">518 </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">"cannot modify '"</span> << current_ingredient_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because it's an ingredient of recipe "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product\n"</span> << end<span class="Delimiter">();</span> <span id="L519" class="LineNr">519 </span> <span class="Normal">else</span> -<span id="L520" class="LineNr">520 </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">"cannot modify '"</span> << current_ingredient_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because that would modify '"</span> << original_ingredient_name << <span class="Constant">"' which is an ingredient of <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L520" class="LineNr">520 </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">"cannot modify '"</span> << current_ingredient_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because that would modify '"</span> << original_ingredient_name << <span class="Constant">"' which is an ingredient of <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L521" class="LineNr">521 </span> <span class="Delimiter">}</span> <span id="L522" class="LineNr">522 </span> <span class="Delimiter">}</span> <span id="L523" class="LineNr">523 </span> <span class="Delimiter">}</span> <span id="L524" class="LineNr">524 </span><span class="Delimiter">}</span> <span id="L525" class="LineNr">525 </span> <span id="L526" class="LineNr">526 </span><span class="Normal">bool</span> <a href='057immutable.cc.html#L526'>is_modified_in_recipe</a><span class="Delimiter">(</span><span class="Normal">const</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r<span class="Delimiter">,</span> <span class="Normal">const</span> <span class="Normal">int</span> ingredient_index<span class="Delimiter">,</span> <span class="Normal">const</span> recipe& caller<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L527" class="LineNr">527 </span> <span class="Normal">const</span> recipe& callee = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L527" class="LineNr">527 </span> <span class="Normal">const</span> recipe& callee = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L528" class="LineNr">528 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!callee<span class="Delimiter">.</span>has_header<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L529" class="LineNr">529 </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">"can't check mutability of ingredients in recipe "</span> << callee<span class="Delimiter">.</span>name << <span class="Constant">" because it uses 'next-ingredient' directly, rather than a recipe header.</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L529" class="LineNr">529 </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">"can't check mutability of ingredients in recipe "</span> << callee<span class="Delimiter">.</span>name << <span class="Constant">" because it uses 'next-ingredient' directly, rather than a recipe header.\n"</span> << end<span class="Delimiter">();</span> <span id="L530" class="LineNr">530 </span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L531" class="LineNr">531 </span> <span class="Delimiter">}</span> <span id="L532" class="LineNr">532 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>ingredient_index >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>callee<span class="Delimiter">.</span>ingredients<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span class="Comment">// optional immutable ingredient</span> @@ -660,7 +662,7 @@ if ('onhashchange' in window) { <span id="L597" class="LineNr">597 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!tmp<span class="Delimiter">-></span>atom <span id="L598" class="LineNr">598 </span> || <span class="Delimiter">(</span>!is_present_in_ingredients<span class="Delimiter">(</span>caller<span class="Delimiter">,</span> tmp<span class="Delimiter">-></span>value<span class="Delimiter">)</span> <span id="L599" class="LineNr">599 </span> && !is_present_in_products<span class="Delimiter">(</span>caller<span class="Delimiter">,</span> tmp<span class="Delimiter">-></span>value<span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L600" class="LineNr">600 </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">"/contained-in can only point to another ingredient or product, but got '"</span> << to_string<span class="Delimiter">(</span>property<span class="Delimiter">(</span>current_ingredient<span class="Delimiter">,</span> <span class="Constant">"contained-in"</span><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="L600" class="LineNr">600 </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">"/contained-in can only point to another ingredient or product, but got '"</span> << to_string<span class="Delimiter">(</span>property<span class="Delimiter">(</span>current_ingredient<span class="Delimiter">,</span> <span class="Constant">"contained-in"</span><span class="Delimiter">))</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L601" class="LineNr">601 </span> <span class="Delimiter">}</span> <span id="L602" class="LineNr">602 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L603" class="LineNr">603 </span><span class="Delimiter">}</span> |