diff options
Diffstat (limited to 'html/042name.cc.html')
-rw-r--r-- | html/042name.cc.html | 167 |
1 files changed, 93 insertions, 74 deletions
diff --git a/html/042name.cc.html b/html/042name.cc.html index 23a3ba8f..915412f1 100644 --- a/html/042name.cc.html +++ b/html/042name.cc.html @@ -292,81 +292,100 @@ if ('onhashchange' in window) { <span id="L229" class="LineNr">229 </span><span class="SalientComment">//:: Support element names for containers in 'get' and 'get-location' and 'put'.</span> <span id="L230" class="LineNr">230 </span><span class="Comment">//: (get-location is implemented later)</span> <span id="L231" class="LineNr">231 </span> -<span id="L232" class="LineNr">232 </span><span class="Delimiter">:(scenario transform_names_transforms_container_elements)</span> -<span id="L233" class="LineNr">233 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ -<span id="L234" class="LineNr">234 </span> <span class="Normal">p</span>:&:point<span class="Special"> <- </span>copy <span class="Constant">0</span> -<span id="L235" class="LineNr">235 </span> <span class="Normal">a</span>:num<span class="Special"> <- </span>get *p:&:point<span class="Delimiter">,</span> <span class="Constant">y:offset</span> -<span id="L236" class="LineNr">236 </span> <span class="Normal">b</span>:num<span class="Special"> <- </span>get *p:&:point<span class="Delimiter">,</span> <span class="Constant">x:offset</span> -<span id="L237" class="LineNr">237 </span>] -<span id="L238" class="LineNr">238 </span><span class="traceContains">+name: element y of type point is at offset 1</span> -<span id="L239" class="LineNr">239 </span><span class="traceContains">+name: element x of type point is at offset 0</span> +<span id="L232" class="LineNr">232 </span><span class="Delimiter">:(before "End update GET offset_value in Check")</span> +<span id="L233" class="LineNr">233 </span><span class="Normal">else</span> <span class="Delimiter">{</span> +<span id="L234" class="LineNr">234 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!offset<span class="Delimiter">.</span>initialized<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L235" class="LineNr">235 </span> <a href='003trace.cc.html#L178'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"uninitialized offset '"</span> << offset<span class="Delimiter">.</span>name << <span class="Constant">"' in '"</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> << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> +<span id="L236" class="LineNr">236 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L237" class="LineNr">237 </span> <span class="Delimiter">}</span> +<span id="L238" class="LineNr">238 </span> offset_value = offset<span class="Delimiter">.</span>value<span class="Delimiter">;</span> +<span id="L239" class="LineNr">239 </span><span class="Delimiter">}</span> <span id="L240" class="LineNr">240 </span> -<span id="L241" class="LineNr">241 </span><span class="Delimiter">:(before "End transform_names(inst) Special-cases")</span> -<span id="L242" class="LineNr">242 </span><span class="Comment">// replace element names of containers with offsets</span> -<span id="L243" class="LineNr">243 </span><span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name == <span class="Constant">"get"</span> || inst<span class="Delimiter">.</span>name == <span class="Constant">"get-location"</span> || inst<span class="Delimiter">.</span>name == <span class="Constant">"put"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L244" class="LineNr">244 </span> <span class="Comment">//: avoid raising any errors here; later layers will support overloading new</span> -<span id="L245" class="LineNr">245 </span> <span class="Comment">//: instructions with the same names (static dispatch), which could lead to</span> -<span id="L246" class="LineNr">246 </span> <span class="Comment">//: spurious errors</span> -<span id="L247" class="LineNr">247 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> < <span class="Constant">2</span><span class="Delimiter">)</span> -<span id="L248" class="LineNr">248 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// error raised elsewhere</span> -<span id="L249" class="LineNr">249 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">)))</span> -<span id="L250" class="LineNr">250 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// error raised elsewhere</span> -<span id="L251" class="LineNr">251 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>name<span class="Delimiter">.</span>find_first_not_of<span class="Delimiter">(</span><span class="Constant">"0123456789"</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L252" class="LineNr">252 </span> <span class="Comment">// since first non-address in base type must be a container, we don't have to canonize</span> -<span id="L253" class="LineNr">253 </span> <a href='010vm.cc.html#L124'>type_ordinal</a> base_type = <a href='042name.cc.html#L120'>skip_addresses</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>type<span class="Delimiter">);</span> -<span id="L254" class="LineNr">254 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>base_type == -<span class="Constant">1</span><span class="Delimiter">)</span> -<span id="L255" class="LineNr">255 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// error raised elsewhere</span> -<span id="L256" class="LineNr">256 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>contains_key<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span class="Comment">// otherwise we'll raise an error elsewhere</span> -<span id="L257" class="LineNr">257 </span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span><a href='010vm.cc.html#L66'>set_value</a><span class="Delimiter">(</span><a href='042name.cc.html#L133'>find_element_name</a><span class="Delimiter">(</span>base_type<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>name<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">));</span> -<span id="L258" class="LineNr">258 </span> <a href='003trace.cc.html#L171'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"name"</span><span class="Delimiter">)</span> << <span class="Constant">"element "</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>name << <span class="Constant">" of type "</span> << get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">).</span>name << <span class="Constant">" is at offset "</span> << no_scientific<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>value<span class="Delimiter">)</span> << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> -<span id="L259" class="LineNr">259 </span> <span class="Delimiter">}</span> -<span id="L260" class="LineNr">260 </span> <span class="Delimiter">}</span> -<span id="L261" class="LineNr">261 </span><span class="Delimiter">}</span> -<span id="L262" class="LineNr">262 </span> -<span id="L263" class="LineNr">263 </span><span class="Comment">//: this test is actually illegal so can't call run</span> -<span id="L264" class="LineNr">264 </span><span class="Delimiter">:(scenarios transform)</span> -<span id="L265" class="LineNr">265 </span><span class="Delimiter">:(scenario transform_names_handles_containers)</span> -<span id="L266" class="LineNr">266 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ -<span id="L267" class="LineNr">267 </span> <span class="Normal">a</span>:point<span class="Special"> <- </span>copy <span class="Constant">0</span>/unsafe -<span id="L268" class="LineNr">268 </span> <span class="Normal">b</span>:num<span class="Special"> <- </span>copy <span class="Constant">0</span>/unsafe -<span id="L269" class="LineNr">269 </span>] -<span id="L270" class="LineNr">270 </span><span class="traceContains">+name: assign a 1</span> -<span id="L271" class="LineNr">271 </span><span class="traceContains">+name: assign b 3</span> -<span id="L272" class="LineNr">272 </span> -<span id="L273" class="LineNr">273 </span><span class="SalientComment">//:: Support variant names for exclusive containers in 'maybe-convert'.</span> -<span id="L274" class="LineNr">274 </span> -<span id="L275" class="LineNr">275 </span><span class="Delimiter">:(scenarios run)</span> -<span id="L276" class="LineNr">276 </span><span class="Delimiter">:(scenario transform_names_handles_exclusive_containers)</span> -<span id="L277" class="LineNr">277 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ -<span id="L278" class="LineNr">278 </span> <span class="Constant">12</span>:num<span class="Special"> <- </span>copy <span class="Constant">1</span> -<span id="L279" class="LineNr">279 </span> <span class="Constant">13</span>:num<span class="Special"> <- </span>copy <span class="Constant">35</span> -<span id="L280" class="LineNr">280 </span> <span class="Constant">14</span>:num<span class="Special"> <- </span>copy <span class="Constant">36</span> -<span id="L281" class="LineNr">281 </span> <span class="Constant">20</span>:point<span class="Delimiter">,</span> <span class="Constant">22</span>:<span class="Normal">bool</span><span class="Special"> <- </span>maybe-convert <span class="Constant">12</span>:number-<span class="Normal">or</span>-point/unsafe<span class="Delimiter">,</span> <span class="Constant">p:variant</span> -<span id="L282" class="LineNr">282 </span>] -<span id="L283" class="LineNr">283 </span><span class="traceContains">+name: variant p of type number-or-point has tag 1</span> -<span id="L284" class="LineNr">284 </span><span class="traceContains">+mem: storing 1 in location 22</span> -<span id="L285" class="LineNr">285 </span><span class="traceContains">+mem: storing 35 in location 20</span> -<span id="L286" class="LineNr">286 </span><span class="traceContains">+mem: storing 36 in location 21</span> -<span id="L287" class="LineNr">287 </span> -<span id="L288" class="LineNr">288 </span><span class="Delimiter">:(before "End transform_names(inst) Special-cases")</span> -<span id="L289" class="LineNr">289 </span><span class="Comment">// convert variant names of exclusive containers</span> -<span id="L290" class="LineNr">290 </span><span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name == <span class="Constant">"maybe-convert"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L291" class="LineNr">291 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">2</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L292" class="LineNr">292 </span> <a href='003trace.cc.html#L178'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"exactly 2 ingredients expected in '"</span> << inst<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> -<span id="L293" class="LineNr">293 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L294" class="LineNr">294 </span> <span class="Delimiter">}</span> -<span id="L295" class="LineNr">295 </span> assert<span class="Delimiter">(</span>is_literal<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">)));</span> -<span id="L296" class="LineNr">296 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>name<span class="Delimiter">.</span>find_first_not_of<span class="Delimiter">(</span><span class="Constant">"0123456789"</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L297" class="LineNr">297 </span> <span class="Comment">// since first non-address in base type must be an exclusive container, we don't have to canonize</span> -<span id="L298" class="LineNr">298 </span> <a href='010vm.cc.html#L124'>type_ordinal</a> base_type = <a href='042name.cc.html#L120'>skip_addresses</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>type<span class="Delimiter">);</span> -<span id="L299" class="LineNr">299 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>base_type == -<span class="Constant">1</span><span class="Delimiter">)</span> -<span id="L300" class="LineNr">300 </span> <a href='003trace.cc.html#L178'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"expected an exclusive-container in '"</span> << inst<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> -<span id="L301" class="LineNr">301 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>contains_key<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span class="Comment">// otherwise we'll raise an error elsewhere</span> -<span id="L302" class="LineNr">302 </span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span><a href='010vm.cc.html#L66'>set_value</a><span class="Delimiter">(</span><a href='042name.cc.html#L133'>find_element_name</a><span class="Delimiter">(</span>base_type<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>name<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">));</span> -<span id="L303" class="LineNr">303 </span> <a href='003trace.cc.html#L171'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"name"</span><span class="Delimiter">)</span> << <span class="Constant">"variant "</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>name << <span class="Constant">" of type "</span> << get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">).</span>name << <span class="Constant">" has tag "</span> << no_scientific<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>value<span class="Delimiter">)</span> << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> -<span id="L304" class="LineNr">304 </span> <span class="Delimiter">}</span> -<span id="L305" class="LineNr">305 </span> <span class="Delimiter">}</span> -<span id="L306" class="LineNr">306 </span><span class="Delimiter">}</span> +<span id="L241" class="LineNr">241 </span><span class="Delimiter">:(scenario transform_names_transforms_container_elements)</span> +<span id="L242" class="LineNr">242 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ +<span id="L243" class="LineNr">243 </span> <span class="Normal">p</span>:&:point<span class="Special"> <- </span>copy <span class="Constant">0</span> +<span id="L244" class="LineNr">244 </span> <span class="Normal">a</span>:num<span class="Special"> <- </span>get *p:&:point<span class="Delimiter">,</span> <span class="Constant">y:offset</span> +<span id="L245" class="LineNr">245 </span> <span class="Normal">b</span>:num<span class="Special"> <- </span>get *p:&:point<span class="Delimiter">,</span> <span class="Constant">x:offset</span> +<span id="L246" class="LineNr">246 </span>] +<span id="L247" class="LineNr">247 </span><span class="traceContains">+name: element y of type point is at offset 1</span> +<span id="L248" class="LineNr">248 </span><span class="traceContains">+name: element x of type point is at offset 0</span> +<span id="L249" class="LineNr">249 </span> +<span id="L250" class="LineNr">250 </span><span class="Delimiter">:(before "End transform_names(inst) Special-cases")</span> +<span id="L251" class="LineNr">251 </span><span class="Comment">// replace element names of containers with offsets</span> +<span id="L252" class="LineNr">252 </span><span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name == <span class="Constant">"get"</span> || inst<span class="Delimiter">.</span>name == <span class="Constant">"get-location"</span> || inst<span class="Delimiter">.</span>name == <span class="Constant">"put"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L253" class="LineNr">253 </span> <span class="Comment">//: avoid raising any errors here; later layers will support overloading new</span> +<span id="L254" class="LineNr">254 </span> <span class="Comment">//: instructions with the same names (static dispatch), which could lead to</span> +<span id="L255" class="LineNr">255 </span> <span class="Comment">//: spurious errors</span> +<span id="L256" class="LineNr">256 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> < <span class="Constant">2</span><span class="Delimiter">)</span> +<span id="L257" class="LineNr">257 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// error raised elsewhere</span> +<span id="L258" class="LineNr">258 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">)))</span> +<span id="L259" class="LineNr">259 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// error raised elsewhere</span> +<span id="L260" class="LineNr">260 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>name<span class="Delimiter">.</span>find_first_not_of<span class="Delimiter">(</span><span class="Constant">"0123456789"</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L261" class="LineNr">261 </span> <span class="Comment">// since first non-address in base type must be a container, we don't have to canonize</span> +<span id="L262" class="LineNr">262 </span> <a href='010vm.cc.html#L124'>type_ordinal</a> base_type = <a href='042name.cc.html#L120'>skip_addresses</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>type<span class="Delimiter">);</span> +<span id="L263" class="LineNr">263 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>contains_key<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span class="Comment">// otherwise we'll raise an error elsewhere</span> +<span id="L264" class="LineNr">264 </span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span><a href='010vm.cc.html#L66'>set_value</a><span class="Delimiter">(</span><a href='042name.cc.html#L133'>find_element_name</a><span class="Delimiter">(</span>base_type<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>name<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">));</span> +<span id="L265" class="LineNr">265 </span> <a href='003trace.cc.html#L171'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"name"</span><span class="Delimiter">)</span> << <span class="Constant">"element "</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>name << <span class="Constant">" of type "</span> << get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">).</span>name << <span class="Constant">" is at offset "</span> << no_scientific<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>value<span class="Delimiter">)</span> << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> +<span id="L266" class="LineNr">266 </span> <span class="Delimiter">}</span> +<span id="L267" class="LineNr">267 </span> <span class="Delimiter">}</span> +<span id="L268" class="LineNr">268 </span><span class="Delimiter">}</span> +<span id="L269" class="LineNr">269 </span> +<span id="L270" class="LineNr">270 </span><span class="Delimiter">:(scenario missing_type_in_get)</span> +<span id="L271" class="LineNr">271 </span><span class="Special">% Hide_errors = true;</span> +<span id="L272" class="LineNr">272 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ +<span id="L273" class="LineNr">273 </span> get a<span class="Delimiter">,</span> <span class="Constant">x:offset</span> +<span id="L274" class="LineNr">274 </span>] +<span id="L275" class="LineNr">275 </span><span class="traceContains">+error: <a href='000organization.cc.html#L113'>main</a>: missing type for 'a' in 'get a, x:offset'</span> +<span id="L276" class="LineNr">276 </span> +<span id="L277" class="LineNr">277 </span><span class="Comment">//: this test is actually illegal so can't call run</span> +<span id="L278" class="LineNr">278 </span><span class="Delimiter">:(scenarios transform)</span> +<span id="L279" class="LineNr">279 </span><span class="Delimiter">:(scenario transform_names_handles_containers)</span> +<span id="L280" class="LineNr">280 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ +<span id="L281" class="LineNr">281 </span> <span class="Normal">a</span>:point<span class="Special"> <- </span>copy <span class="Constant">0</span>/unsafe +<span id="L282" class="LineNr">282 </span> <span class="Normal">b</span>:num<span class="Special"> <- </span>copy <span class="Constant">0</span>/unsafe +<span id="L283" class="LineNr">283 </span>] +<span id="L284" class="LineNr">284 </span><span class="traceContains">+name: assign a 1</span> +<span id="L285" class="LineNr">285 </span><span class="traceContains">+name: assign b 3</span> +<span id="L286" class="LineNr">286 </span> +<span id="L287" class="LineNr">287 </span><span class="SalientComment">//:: Support variant names for exclusive containers in 'maybe-convert'.</span> +<span id="L288" class="LineNr">288 </span> +<span id="L289" class="LineNr">289 </span><span class="Delimiter">:(scenarios run)</span> +<span id="L290" class="LineNr">290 </span><span class="Delimiter">:(scenario transform_names_handles_exclusive_containers)</span> +<span id="L291" class="LineNr">291 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ +<span id="L292" class="LineNr">292 </span> <span class="Constant">12</span>:num<span class="Special"> <- </span>copy <span class="Constant">1</span> +<span id="L293" class="LineNr">293 </span> <span class="Constant">13</span>:num<span class="Special"> <- </span>copy <span class="Constant">35</span> +<span id="L294" class="LineNr">294 </span> <span class="Constant">14</span>:num<span class="Special"> <- </span>copy <span class="Constant">36</span> +<span id="L295" class="LineNr">295 </span> <span class="Constant">20</span>:point<span class="Delimiter">,</span> <span class="Constant">22</span>:<span class="Normal">bool</span><span class="Special"> <- </span>maybe-convert <span class="Constant">12</span>:number-<span class="Normal">or</span>-point/unsafe<span class="Delimiter">,</span> <span class="Constant">p:variant</span> +<span id="L296" class="LineNr">296 </span>] +<span id="L297" class="LineNr">297 </span><span class="traceContains">+name: variant p of type number-or-point has tag 1</span> +<span id="L298" class="LineNr">298 </span><span class="traceContains">+mem: storing 1 in location 22</span> +<span id="L299" class="LineNr">299 </span><span class="traceContains">+mem: storing 35 in location 20</span> +<span id="L300" class="LineNr">300 </span><span class="traceContains">+mem: storing 36 in location 21</span> +<span id="L301" class="LineNr">301 </span> +<span id="L302" class="LineNr">302 </span><span class="Delimiter">:(before "End transform_names(inst) Special-cases")</span> +<span id="L303" class="LineNr">303 </span><span class="Comment">// convert variant names of exclusive containers</span> +<span id="L304" class="LineNr">304 </span><span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name == <span class="Constant">"maybe-convert"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L305" class="LineNr">305 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">2</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L306" class="LineNr">306 </span> <a href='003trace.cc.html#L178'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"exactly 2 ingredients expected in '"</span> << inst<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> +<span id="L307" class="LineNr">307 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L308" class="LineNr">308 </span> <span class="Delimiter">}</span> +<span id="L309" class="LineNr">309 </span> assert<span class="Delimiter">(</span>is_literal<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">)));</span> +<span id="L310" class="LineNr">310 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>name<span class="Delimiter">.</span>find_first_not_of<span class="Delimiter">(</span><span class="Constant">"0123456789"</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L311" class="LineNr">311 </span> <span class="Comment">// since first non-address in base type must be an exclusive container, we don't have to canonize</span> +<span id="L312" class="LineNr">312 </span> <a href='010vm.cc.html#L124'>type_ordinal</a> base_type = <a href='042name.cc.html#L120'>skip_addresses</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>type<span class="Delimiter">);</span> +<span id="L313" class="LineNr">313 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>contains_key<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span class="Comment">// otherwise we'll raise an error elsewhere</span> +<span id="L314" class="LineNr">314 </span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span><a href='010vm.cc.html#L66'>set_value</a><span class="Delimiter">(</span><a href='042name.cc.html#L133'>find_element_name</a><span class="Delimiter">(</span>base_type<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>name<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">));</span> +<span id="L315" class="LineNr">315 </span> <a href='003trace.cc.html#L171'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"name"</span><span class="Delimiter">)</span> << <span class="Constant">"variant "</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>name << <span class="Constant">" of type "</span> << get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">).</span>name << <span class="Constant">" has tag "</span> << no_scientific<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>value<span class="Delimiter">)</span> << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> +<span id="L316" class="LineNr">316 </span> <span class="Delimiter">}</span> +<span id="L317" class="LineNr">317 </span> <span class="Delimiter">}</span> +<span id="L318" class="LineNr">318 </span><span class="Delimiter">}</span> +<span id="L319" class="LineNr">319 </span> +<span id="L320" class="LineNr">320 </span><span class="Delimiter">:(scenario missing_type_in_maybe_convert)</span> +<span id="L321" class="LineNr">321 </span><span class="Special">% Hide_errors = true;</span> +<span id="L322" class="LineNr">322 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ +<span id="L323" class="LineNr">323 </span> maybe-convert a<span class="Delimiter">,</span> <span class="Constant">x:variant</span> +<span id="L324" class="LineNr">324 </span>] +<span id="L325" class="LineNr">325 </span><span class="traceContains">+error: <a href='000organization.cc.html#L113'>main</a>: missing type for 'a' in 'maybe-convert a, x:variant'</span> </pre> </body> </html> |