From 805d58c6aeeeba3e4989c0eed6781b3861e8fae0 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 25 Jan 2018 22:39:31 -0800 Subject: 4199 --- html/055shape_shifting_container.cc.html | 291 +++++++++++++++---------------- 1 file changed, 145 insertions(+), 146 deletions(-) (limited to 'html/055shape_shifting_container.cc.html') diff --git a/html/055shape_shifting_container.cc.html b/html/055shape_shifting_container.cc.html index b81fd8fe..bc1ec299 100644 --- a/html/055shape_shifting_container.cc.html +++ b/html/055shape_shifting_container.cc.html @@ -16,20 +16,19 @@ a { color:#eeeeee; text-decoration: none; } a:hover { text-decoration: underline; } * { 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; } .cSpecial { color: #008000; } .muData { color: #ffff00; } -.Identifier { color: #c0a020; } -.Delimiter { color: #800080; } -.traceContains { color: #008000; } -.Conceal { color: #4e4e4e; } -.Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } .Comment { color: #9090ff; } .Comment a { color:#0000ee; text-decoration:underline; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } +.traceContains { color: #008000; } --> @@ -100,7 +99,7 @@ if ('onhashchange' in window) { 34 const type_tree* get_base_type(const type_tree* t) { 35 const type_tree* result = t->atom ? t : t->left; 36 if (!result->atom) - 37 ¦ raise << "invalid type " << to_string(t) << '\n' << end(); + 37 raise << "invalid type " << to_string(t) << '\n' << end(); 38 return result; 39 } 40 @@ -145,7 +144,7 @@ if ('onhashchange' in window) { 79 def main [ 80 1:text <- new [abc] 81 # compound types for type ingredients - 82 {2: (foo number (address array character))} <- merge 34/x, 1:text/y + 82 {2: (foo number (address array character))} <- merge 34/x, 1:text/y 83 ] 84 $error: 0 85 @@ -156,7 +155,7 @@ if ('onhashchange' in window) { 90 ] 91 container bar:_a:_b [ 92 # dilated element - 93 {data: (foo _a (address _b))} + 93 {data: (foo _a (address _b))} 94 ] 95 def main [ 96 1:text <- new [abc] @@ -212,9 +211,9 @@ if ('onhashchange' in window) { 146 if (name.find(':') != string::npos) { 147 trace("parse") << "container has type ingredients; parsing" << end(); 148 if (!read_type_ingredients(name, command)) { -149 ¦ // error; skip rest of the container definition and continue -150 ¦ slurp_balanced_bracket(in); -151 ¦ return; +149 // error; skip rest of the container definition and continue +150 slurp_balanced_bracket(in); +151 return; 152 } 153 } 154 @@ -225,21 +224,21 @@ if ('onhashchange' in window) { 159 name = slurp_until(in, ':'); 160 map<string, type_ordinal> type_ingredient_names; 161 if (!slurp_type_ingredients(in, type_ingredient_names, name)) { -162 ¦ return false; +162 return false; 163 } 164 if (contains_key(Type_ordinal, name) -165 ¦ ¦ && contains_key(Type, get(Type_ordinal, name))) { -166 ¦ const type_info& previous_info = get(Type, get(Type_ordinal, name)); -167 ¦ // we've already seen this container; make sure type ingredients match -168 ¦ if (!type_ingredients_match(type_ingredient_names, previous_info.type_ingredient_names)) { -169 ¦ ¦ raise << "headers of " << command << " '" << name << "' must use identical type ingredients\n" << end(); -170 ¦ ¦ return false; -171 ¦ } -172 ¦ return true; +165 && contains_key(Type, get(Type_ordinal, name))) { +166 const type_info& previous_info = get(Type, get(Type_ordinal, name)); +167 // we've already seen this container; make sure type ingredients match +168 if (!type_ingredients_match(type_ingredient_names, previous_info.type_ingredient_names)) { +169 raise << "headers of " << command << " '" << name << "' must use identical type ingredients\n" << end(); +170 return false; +171 } +172 return true; 173 } 174 // we haven't seen this container before 175 if (!contains_key(Type_ordinal, name) || get(Type_ordinal, name) == 0) -176 ¦ put(Type_ordinal, name, Next_type_ordinal++); +176 put(Type_ordinal, name, Next_type_ordinal++); 177 type_info& info = get_or_insert(Type, get(Type_ordinal, name)); 178 info.type_ingredient_names.swap(type_ingredient_names); 179 return true; @@ -248,20 +247,20 @@ if ('onhashchange' in window) { 182 bool slurp_type_ingredients(istream& in, map<string, type_ordinal>& out, const string& container_name) { 183 int next_type_ordinal = START_TYPE_INGREDIENTS; 184 while (has_data(in)) { -185 ¦ string curr = slurp_until(in, ':'); -186 ¦ if (curr.empty()) { -187 ¦ ¦ raise << container_name << ": empty type ingredients not permitted\n" << end(); -188 ¦ ¦ return false; -189 ¦ } -190 ¦ if (!starts_with(curr, "_")) { -191 ¦ ¦ raise << container_name << ": type ingredient '" << curr << "' must begin with an underscore\n" << end(); -192 ¦ ¦ return false; -193 ¦ } -194 ¦ if (out.find(curr) != out.end()) { -195 ¦ ¦ raise << container_name << ": can't repeat type ingredient name'" << curr << "' in a single container definition\n" << end(); -196 ¦ ¦ return false; -197 ¦ } -198 ¦ put(out, curr, next_type_ordinal++); +185 string curr = slurp_until(in, ':'); +186 if (curr.empty()) { +187 raise << container_name << ": empty type ingredients not permitted\n" << end(); +188 return false; +189 } +190 if (!starts_with(curr, "_")) { +191 raise << container_name << ": type ingredient '" << curr << "' must begin with an underscore\n" << end(); +192 return false; +193 } +194 if (out.find(curr) != out.end()) { +195 raise << container_name << ": can't repeat type ingredient name'" << curr << "' in a single container definition\n" << end(); +196 return false; +197 } +198 put(out, curr, next_type_ordinal++); 199 } 200 return true; 201 } @@ -269,8 +268,8 @@ if ('onhashchange' in window) { 203 bool type_ingredients_match(const map<string, type_ordinal>& a, const map<string, type_ordinal>& b) { 204 if (SIZE(a) != SIZE(b)) return false; 205 for (map<string, type_ordinal>::const_iterator p = a.begin(); p != a.end(); ++p) { -206 ¦ if (!contains_key(b, p->first)) return false; -207 ¦ if (p->second != get(b, p->first)) return false; +206 if (!contains_key(b, p->first)) return false; +207 if (p->second != get(b, p->first)) return false; 208 } 209 return true; 210 } @@ -287,7 +286,7 @@ if ('onhashchange' in window) { 221 222 :(before "End Container Type Checks") 223 if (type->value >= START_TYPE_INGREDIENTS -224 ¦ && (type->value - START_TYPE_INGREDIENTS) < SIZE(get(Type, type->value).type_ingredient_names)) +224 && (type->value - START_TYPE_INGREDIENTS) < SIZE(get(Type, type->value).type_ingredient_names)) 225 return; 226 227 :(scenario size_of_shape_shifting_exclusive_container) @@ -374,8 +373,8 @@ if ('onhashchange' in window) { 308 ] 309 def main [ 310 1:text <- new [abc] -311 {2: (foo number (address array character))} <- merge 34/x, 1:text/y -312 3:text <- get {2: (foo number (address array character))}, y:offset +311 {2: (foo number (address array character))} <- merge 34/x, 1:text/y +312 3:text <- get {2: (foo number (address array character))}, y:offset 313 4:bool <- equal 1:text, 3:text 314 ] 315 +mem: storing 1 in location 4 @@ -408,9 +407,9 @@ if ('onhashchange' in window) { 342 343 void replace_type_ingredients(reagent& element, const type_tree* caller_type, const type_info& info, const string& location_for_error_messages) { 344 if (contains_type_ingredient(element)) { -345 ¦ if (!caller_type->right) -346 ¦ ¦ raise << "illegal type " << names_to_string(caller_type) << " seems to be missing a type ingredient or three" << location_for_error_messages << '\n' << end(); -347 ¦ replace_type_ingredients(element.type, caller_type->right, info, location_for_error_messages); +345 if (!caller_type->right) +346 raise << "illegal type " << names_to_string(caller_type) << " seems to be missing a type ingredient or three" << location_for_error_messages << '\n' << end(); +347 replace_type_ingredients(element.type, caller_type->right, info, location_for_error_messages); 348 } 349 } 350 @@ -419,27 +418,27 @@ if ('onhashchange' in window) { 353 if (!callsite_type) return; // error but it's already been raised above 354 if (!element_type) return; 355 if (!element_type->atom) { -356 ¦ if (element_type->right == NULL && is_type_ingredient(element_type->left)) { -357 ¦ ¦ int type_ingredient_index = to_type_ingredient_index(element_type->left); -358 ¦ ¦ if (corresponding(callsite_type, type_ingredient_index, is_final_type_ingredient(type_ingredient_index, container_info))->right) { -359 ¦ ¦ ¦ // replacing type ingredient at end of list, and replacement is a non-degenerate compound type -- (a b) but not (a) -360 ¦ ¦ ¦ replace_type_ingredient_at(type_ingredient_index, element_type, callsite_type, container_info, location_for_error_messages); -361 ¦ ¦ ¦ return; -362 ¦ ¦ } -363 ¦ } -364 ¦ replace_type_ingredients(element_type->left, callsite_type, container_info, location_for_error_messages); -365 ¦ replace_type_ingredients(element_type->right, callsite_type, container_info, location_for_error_messages); -366 ¦ return; +356 if (element_type->right == NULL && is_type_ingredient(element_type->left)) { +357 int type_ingredient_index = to_type_ingredient_index(element_type->left); +358 if (corresponding(callsite_type, type_ingredient_index, is_final_type_ingredient(type_ingredient_index, container_info))->right) { +359 // replacing type ingredient at end of list, and replacement is a non-degenerate compound type -- (a b) but not (a) +360 replace_type_ingredient_at(type_ingredient_index, element_type, callsite_type, container_info, location_for_error_messages); +361 return; +362 } +363 } +364 replace_type_ingredients(element_type->left, callsite_type, container_info, location_for_error_messages); +365 replace_type_ingredients(element_type->right, callsite_type, container_info, location_for_error_messages); +366 return; 367 } 368 if (is_type_ingredient(element_type)) -369 ¦ replace_type_ingredient_at(to_type_ingredient_index(element_type), element_type, callsite_type, container_info, location_for_error_messages); +369 replace_type_ingredient_at(to_type_ingredient_index(element_type), element_type, callsite_type, container_info, location_for_error_messages); 370 } 371 372 const type_tree* corresponding(const type_tree* type, int index, bool final) { 373 for (const type_tree* curr = type; curr; curr = curr->right, --index) { -374 ¦ assert_for_now(!curr->atom); -375 ¦ if (index == 0) -376 ¦ ¦ return final ? curr : curr->left; +374 assert_for_now(!curr->atom); +375 if (index == 0) +376 return final ? curr : curr->left; 377 } 378 assert_for_now(false); 379 } @@ -455,8 +454,8 @@ if ('onhashchange' in window) { 389 390 void replace_type_ingredient_at(const int type_ingredient_index, type_tree* element_type, const type_tree* callsite_type, const type_info& container_info, const string& location_for_error_messages) { 391 if (!has_nth_type(callsite_type, type_ingredient_index)) { -392 ¦ raise << "illegal type " << names_to_string(callsite_type) << " seems to be missing a type ingredient or three" << location_for_error_messages << '\n' << end(); -393 ¦ return; +392 raise << "illegal type " << names_to_string(callsite_type) << " seems to be missing a type ingredient or three" << location_for_error_messages << '\n' << end(); +393 return; 394 } 395 *element_type = *nth_type_ingredient(callsite_type, type_ingredient_index, container_info); 396 } @@ -465,10 +464,10 @@ if ('onhashchange' in window) { 399 bool final = is_final_type_ingredient(type_ingredient_index, container_info); 400 const type_tree* curr = callsite_type; 401 for (int i = 0; i < type_ingredient_index; ++i) { -402 ¦ assert(curr); -403 ¦ assert(!curr->atom); +402 assert(curr); +403 assert(!curr->atom); 404 //? cerr << "type ingredient " << i << " is " << to_string(curr->left) << '\n'; -405 ¦ curr = curr->right; +405 curr = curr->right; 406 } 407 assert(curr); 408 if (curr->atom) return curr; @@ -479,9 +478,9 @@ if ('onhashchange' in window) { 413 414 bool is_final_type_ingredient(int type_ingredient_index, const type_info& container_info) { 415 for (map<string, type_ordinal>::const_iterator p = container_info.type_ingredient_names.begin(); -416 ¦ ¦ ¦p != container_info.type_ingredient_names.end(); -417 ¦ ¦ ¦++p) { -418 ¦ if (p->second > START_TYPE_INGREDIENTS+type_ingredient_index) return false; +416 p != container_info.type_ingredient_names.end(); +417 ++p) { +418 if (p->second > START_TYPE_INGREDIENTS+type_ingredient_index) return false; 419 } 420 return true; 421 } @@ -489,9 +488,9 @@ if ('onhashchange' in window) { 423 :(before "End Unit Tests") 424 void test_replace_type_ingredients_entire() { 425 run("container foo:_elem [\n" -426 ¦ ¦ " x:_elem\n" -427 ¦ ¦ " y:num\n" -428 ¦ ¦ "]\n"); +426 " x:_elem\n" +427 " y:num\n" +428 "]\n"); 429 reagent callsite("x:foo:point"); 430 reagent element = element_type(callsite.type, 0); 431 CHECK_EQ(to_string(element), "{x: \"point\"}"); @@ -499,11 +498,11 @@ if ('onhashchange' in window) { 433 434 void test_replace_type_ingredients_tail() { 435 run("container foo:_elem [\n" -436 ¦ ¦ " x:_elem\n" -437 ¦ ¦ "]\n" -438 ¦ ¦ "container bar:_elem [\n" -439 ¦ ¦ " x:foo:_elem\n" -440 ¦ ¦ "]\n"); +436 " x:_elem\n" +437 "]\n" +438 "container bar:_elem [\n" +439 " x:foo:_elem\n" +440 "]\n"); 441 reagent callsite("x:bar:point"); 442 reagent element = element_type(callsite.type, 0); 443 CHECK_EQ(to_string(element), "{x: (\"foo\" \"point\")}"); @@ -511,44 +510,44 @@ if ('onhashchange' in window) { 445 446 void test_replace_type_ingredients_head_tail_multiple() { 447 run("container foo:_elem [\n" -448 ¦ ¦ " x:_elem\n" -449 ¦ ¦ "]\n" -450 ¦ ¦ "container bar:_elem [\n" -451 ¦ ¦ " x:foo:_elem\n" -452 ¦ ¦ "]\n"); -453 reagent callsite("x:bar:address:array:character"); +448 " x:_elem\n" +449 "]\n" +450 "container bar:_elem [\n" +451 " x:foo:_elem\n" +452 "]\n"); +453 reagent callsite("x:bar:address:array:character"); 454 reagent element = element_type(callsite.type, 0); -455 CHECK_EQ(to_string(element), "{x: (\"foo\" \"address\" \"array\" \"character\")}"); +455 CHECK_EQ(to_string(element), "{x: (\"foo\" \"address\" \"array\" \"character\")}"); 456 } 457 458 void test_replace_type_ingredients_head_middle() { 459 run("container foo:_elem [\n" -460 ¦ ¦ " x:_elem\n" -461 ¦ ¦ "]\n" -462 ¦ ¦ "container bar:_elem [\n" -463 ¦ ¦ " x:foo:_elem:num\n" -464 ¦ ¦ "]\n"); +460 " x:_elem\n" +461 "]\n" +462 "container bar:_elem [\n" +463 " x:foo:_elem:num\n" +464 "]\n"); 465 reagent callsite("x:bar:address"); 466 reagent element = element_type(callsite.type, 0); -467 CHECK_EQ(to_string(element), "{x: (\"foo\" \"address\" \"number\")}"); +467 CHECK_EQ(to_string(element), "{x: (\"foo\" \"address\" \"number\")}"); 468 } 469 470 void test_replace_last_type_ingredient_with_multiple() { 471 run("container foo:_a:_b [\n" -472 ¦ ¦ " x:_a\n" -473 ¦ ¦ " y:_b\n" -474 ¦ ¦ "]\n"); +472 " x:_a\n" +473 " y:_b\n" +474 "]\n"); 475 reagent callsite("{f: (foo number (address array character))}"); 476 reagent element1 = element_type(callsite.type, 0); 477 CHECK_EQ(to_string(element1), "{x: \"number\"}"); 478 reagent element2 = element_type(callsite.type, 1); -479 CHECK_EQ(to_string(element2), "{y: (\"address\" \"array\" \"character\")}"); +479 CHECK_EQ(to_string(element2), "{y: (\"address\" \"array\" \"character\")}"); 480 } 481 482 void test_replace_last_type_ingredient_inside_compound() { 483 run("container foo:_a:_b [\n" -484 ¦ ¦ " {x: (bar _a (address _b))}\n" -485 ¦ ¦ "]\n"); +484 " {x: (bar _a (address _b))}\n" +485 "]\n"); 486 reagent callsite("f:foo:number:array:character"); 487 reagent element = element_type(callsite.type, 0); 488 CHECK_EQ(names_to_string_without_quotes(element.type), "(bar number (address array character))"); @@ -556,41 +555,41 @@ if ('onhashchange' in window) { 490 491 void test_replace_middle_type_ingredient_with_multiple() { 492 run("container foo:_a:_b:_c [\n" -493 ¦ ¦ " x:_a\n" -494 ¦ ¦ " y:_b\n" -495 ¦ ¦ " z:_c\n" -496 ¦ ¦ "]\n"); +493 " x:_a\n" +494 " y:_b\n" +495 " z:_c\n" +496 "]\n"); 497 reagent callsite("{f: (foo number (address array character) boolean)}"); 498 reagent element1 = element_type(callsite.type, 0); 499 CHECK_EQ(to_string(element1), "{x: \"number\"}"); 500 reagent element2 = element_type(callsite.type, 1); -501 CHECK_EQ(to_string(element2), "{y: (\"address\" \"array\" \"character\")}"); +501 CHECK_EQ(to_string(element2), "{y: (\"address\" \"array\" \"character\")}"); 502 reagent element3 = element_type(callsite.type, 2); 503 CHECK_EQ(to_string(element3), "{z: \"boolean\"}"); 504 } 505 506 void test_replace_middle_type_ingredient_with_multiple2() { 507 run("container foo:_key:_value [\n" -508 ¦ ¦ " key:_key\n" -509 ¦ ¦ " value:_value\n" -510 ¦ ¦ "]\n"); +508 " key:_key\n" +509 " value:_value\n" +510 "]\n"); 511 reagent callsite("{f: (foo (address array character) number)}"); 512 reagent element = element_type(callsite.type, 0); -513 CHECK_EQ(to_string(element), "{key: (\"address\" \"array\" \"character\")}"); +513 CHECK_EQ(to_string(element), "{key: (\"address\" \"array\" \"character\")}"); 514 } 515 516 void test_replace_middle_type_ingredient_with_multiple3() { 517 run("container foo_table:_key:_value [\n" -518 ¦ ¦ " data:&:@:foo_table_row:_key:_value\n" -519 ¦ ¦ "]\n" -520 ¦ ¦ "\n" -521 ¦ ¦ "container foo_table_row:_key:_value [\n" -522 ¦ ¦ " key:_key\n" -523 ¦ ¦ " value:_value\n" -524 ¦ ¦ "]\n"); +518 " data:&:@:foo_table_row:_key:_value\n" +519 "]\n" +520 "\n" +521 "container foo_table_row:_key:_value [\n" +522 " key:_key\n" +523 " value:_value\n" +524 "]\n"); 525 reagent callsite("{f: (foo_table (address array character) number)}"); 526 reagent element = element_type(callsite.type, 0); -527 CHECK_EQ(to_string(element), "{data: (\"address\" \"array\" \"foo_table_row\" (\"address\" \"array\" \"character\") \"number\")}"); +527 CHECK_EQ(to_string(element), "{data: (\"address\" \"array\" \"foo_table_row\" (\"address\" \"array\" \"character\") \"number\")}"); 528 } 529 530 :(code) @@ -624,21 +623,21 @@ if ('onhashchange' in window) { 558 if (contains_key(Type, root->value)) { 559 type_info& info = get(Type, root->value); 560 if (info.kind == CONTAINER) { -561 ¦ compute_container_sizes(info, type, pending_metadata, location_for_error_messages); -562 ¦ return; +561 compute_container_sizes(info, type, pending_metadata, location_for_error_messages); +562 return; 563 } 564 if (info.kind == EXCLUSIVE_CONTAINER) { -565 ¦ compute_exclusive_container_sizes(info, type, pending_metadata, location_for_error_messages); -566 ¦ return; +565 compute_exclusive_container_sizes(info, type, pending_metadata, location_for_error_messages); +566 return; 567 } 568 } // otherwise error raised elsewhere 569 570 :(before "End Unit Tests") 571 void test_container_sizes_shape_shifting_container() { 572 run("container foo:_t [\n" -573 ¦ ¦ " x:num\n" -574 ¦ ¦ " y:_t\n" -575 ¦ ¦ "]\n"); +573 " x:num\n" +574 " y:_t\n" +575 "]\n"); 576 reagent r("x:foo:point"); 577 compute_container_sizes(r, ""); 578 CHECK_EQ(r.metadata.size, 3); @@ -646,9 +645,9 @@ if ('onhashchange' in window) { 580 581 void test_container_sizes_shape_shifting_exclusive_container() { 582 run("exclusive-container foo:_t [\n" -583 ¦ ¦ " x:num\n" -584 ¦ ¦ " y:_t\n" -585 ¦ ¦ "]\n"); +583 " x:num\n" +584 " y:_t\n" +585 "]\n"); 586 reagent r("x:foo:point"); 587 compute_container_sizes(r, ""); 588 CHECK_EQ(r.metadata.size, 3); @@ -659,9 +658,9 @@ if ('onhashchange' in window) { 593 594 void test_container_sizes_compound_type_ingredient() { 595 run("container foo:_t [\n" -596 ¦ ¦ " x:num\n" -597 ¦ ¦ " y:_t\n" -598 ¦ ¦ "]\n"); +596 " x:num\n" +597 " y:_t\n" +598 "]\n"); 599 reagent r("x:foo:&:point"); 600 compute_container_sizes(r, ""); 601 CHECK_EQ(r.metadata.size, 2); @@ -673,9 +672,9 @@ if ('onhashchange' in window) { 607 608 void test_container_sizes_recursive_shape_shifting_container() { 609 run("container foo:_t [\n" -610 ¦ ¦ " x:num\n" -611 ¦ ¦ " y:&:foo:_t\n" -612 ¦ ¦ "]\n"); +610 " x:num\n" +611 " y:&:foo:_t\n" +612 "]\n"); 613 reagent r2("x:foo:num"); 614 compute_container_sizes(r2, ""); 615 CHECK_EQ(r2.metadata.size, 2); @@ -690,22 +689,22 @@ if ('onhashchange' in window) { 624 return; 625 } 626 if (info.kind == EXCLUSIVE_CONTAINER) { -627 compute_exclusive_container_address_offsets(info, type, location_for_error_messages); +627 compute_exclusive_container_address_offsets(info, type, location_for_error_messages); 628 return; 629 } 630 631 :(before "End Unit Tests") 632 void test_container_address_offsets_in_shape_shifting_container() { 633 run("container foo:_t [\n" -634 ¦ ¦ " x:num\n" -635 ¦ ¦ " y:_t\n" -636 ¦ ¦ "]\n"); +634 " x:num\n" +635 " y:_t\n" +636 "]\n"); 637 reagent r("x:foo:&:num"); 638 compute_container_sizes(r, ""); 639 compute_container_address_offsets(r, ""); -640 CHECK_EQ(SIZE(r.metadata.address), 1); -641 CHECK(contains_key(r.metadata.address, set<tag_condition_info>())); -642 set<address_element_info>& offset_info = get(r.metadata.address, set<tag_condition_info>()); +640 CHECK_EQ(SIZE(r.metadata.address), 1); +641 CHECK(contains_key(r.metadata.address, set<tag_condition_info>())); +642 set<address_element_info>& offset_info = get(r.metadata.address, set<tag_condition_info>()); 643 CHECK_EQ(SIZE(offset_info), 1); 644 CHECK_EQ(offset_info.begin()->offset, 1); // 645 CHECK(offset_info.begin()->payload_type->atom); @@ -714,20 +713,20 @@ if ('onhashchange' in window) { 648 649 void test_container_address_offsets_in_nested_shape_shifting_container() { 650 run("container foo:_t [\n" -651 ¦ ¦ " x:num\n" -652 ¦ ¦ " y:_t\n" -653 ¦ ¦ "]\n" -654 ¦ ¦ "container bar:_t [\n" -655 ¦ ¦ " x:_t\n" -656 ¦ ¦ " y:foo:_t\n" -657 ¦ ¦ "]\n"); +651 " x:num\n" +652 " y:_t\n" +653 "]\n" +654 "container bar:_t [\n" +655 " x:_t\n" +656 " y:foo:_t\n" +657 "]\n"); 658 reagent r("x:bar:&:num"); 659 CLEAR_TRACE; 660 compute_container_sizes(r, ""); 661 compute_container_address_offsets(r, ""); -662 CHECK_EQ(SIZE(r.metadata.address), 1); -663 CHECK(contains_key(r.metadata.address, set<tag_condition_info>())); -664 set<address_element_info>& offset_info = get(r.metadata.address, set<tag_condition_info>()); +662 CHECK_EQ(SIZE(r.metadata.address), 1); +663 CHECK(contains_key(r.metadata.address, set<tag_condition_info>())); +664 set<address_element_info>& offset_info = get(r.metadata.address, set<tag_condition_info>()); 665 CHECK_EQ(SIZE(offset_info), 2); 666 CHECK_EQ(offset_info.begin()->offset, 0); // 667 CHECK(offset_info.begin()->payload_type->atom); @@ -744,7 +743,7 @@ if ('onhashchange' in window) { 678 ] 679 def main [ 680 local-scope -681 x:address:foo:num <- new {(foo num): type} +681 x:address:foo:num <- new {(foo num): type} 682 ] 683 # no crash 684 -- cgit 1.4.1-2-gfad0