Changeset 4c925cd for src/AST/Pass.impl.hpp
- Timestamp:
- Aug 14, 2020, 11:40:04 AM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 5715d43, fa5e0112
- Parents:
- 309d814 (diff), badd22f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
src/AST/Pass.impl.hpp (modified) (116 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Pass.impl.hpp
r309d814 r4c925cd 25 25 using namespace ast; \ 26 26 /* back-up the visit children */ \ 27 __attribute__((unused)) ast::__pass::visit_children_guard guard1( ast::__pass::visit_children( pass, 0) ); \27 __attribute__((unused)) ast::__pass::visit_children_guard guard1( ast::__pass::visit_children(core, 0) ); \ 28 28 /* setup the scope for passes that want to run code at exit */ \ 29 __attribute__((unused)) ast::__pass::guard_value guard2( ast::__pass::at_cleanup (pass, 0) ); \ 29 __attribute__((unused)) ast::__pass::guard_value guard2( ast::__pass::at_cleanup (core, 0) ); \ 30 /* begin tracing memory allocation if requested by this pass */ \ 31 __pass::beginTrace( core, 0 ); \ 30 32 /* call the implementation of the previsit of this pass */ \ 31 __pass::previsit( pass, node, 0 );33 __pass::previsit( core, node, 0 ); 32 34 33 35 #define VISIT( code... ) \ … … 40 42 #define VISIT_END( type, node ) \ 41 43 /* call the implementation of the postvisit of this pass */ \ 42 auto __return = __pass::postvisit( pass, node, 0 ); \44 auto __return = __pass::postvisit( core, node, 0 ); \ 43 45 assertf(__return, "post visit should never return null"); \ 46 /* end tracing memory allocation if requested by this pass */ \ 47 __pass::endTrace( core, 0 ); \ 44 48 return __return; 45 49 … … 119 123 } 120 124 121 template< typename pass_t >125 template< typename core_t > 122 126 template< typename node_t > 123 auto ast::Pass< pass_t >::call_accept( const node_t * node )127 auto ast::Pass< core_t >::call_accept( const node_t * node ) 124 128 -> typename std::enable_if< 125 129 !std::is_base_of<ast::Expr, node_t>::value && … … 127 131 , decltype( node->accept(*this) ) 128 132 >::type 129 130 133 { 131 134 __pedantic_pass_assert( __visit_children() ); 132 __pedantic_pass_assert( expr);135 __pedantic_pass_assert( node ); 133 136 134 137 static_assert( !std::is_base_of<ast::Expr, node_t>::value, "ERROR"); … … 138 141 } 139 142 140 template< typename pass_t >141 const ast::Expr * ast::Pass< pass_t >::call_accept( const ast::Expr * expr ) {143 template< typename core_t > 144 const ast::Expr * ast::Pass< core_t >::call_accept( const ast::Expr * expr ) { 142 145 __pedantic_pass_assert( __visit_children() ); 143 146 __pedantic_pass_assert( expr ); 144 147 145 const ast::TypeSubstitution ** env_ptr = __pass::env( pass, 0);148 const ast::TypeSubstitution ** env_ptr = __pass::env( core, 0); 146 149 if ( env_ptr && expr->env ) { 147 150 *env_ptr = expr->env; … … 151 154 } 152 155 153 template< typename pass_t >154 const ast::Stmt * ast::Pass< pass_t >::call_accept( const ast::Stmt * stmt ) {156 template< typename core_t > 157 const ast::Stmt * ast::Pass< core_t >::call_accept( const ast::Stmt * stmt ) { 155 158 __pedantic_pass_assert( __visit_children() ); 156 159 __pedantic_pass_assert( stmt ); … … 160 163 161 164 // get the stmts/decls that will need to be spliced in 162 auto stmts_before = __pass::stmtsToAddBefore( pass, 0);163 auto stmts_after = __pass::stmtsToAddAfter ( pass, 0);164 auto decls_before = __pass::declsToAddBefore( pass, 0);165 auto decls_after = __pass::declsToAddAfter ( pass, 0);165 auto stmts_before = __pass::stmtsToAddBefore( core, 0); 166 auto stmts_after = __pass::stmtsToAddAfter ( core, 0); 167 auto decls_before = __pass::declsToAddBefore( core, 0); 168 auto decls_after = __pass::declsToAddAfter ( core, 0); 166 169 167 170 // These may be modified by subnode but most be restored once we exit this statemnet. 168 ValueGuardPtr< const ast::TypeSubstitution * > __old_env ( __pass::env( pass, 0) );171 ValueGuardPtr< const ast::TypeSubstitution * > __old_env ( __pass::env( core, 0) ); 169 172 ValueGuardPtr< typename std::remove_pointer< decltype(stmts_before) >::type > __old_decls_before( stmts_before ); 170 173 ValueGuardPtr< typename std::remove_pointer< decltype(stmts_after ) >::type > __old_decls_after ( stmts_after ); … … 202 205 } 203 206 204 template< typename pass_t >207 template< typename core_t > 205 208 template< template <class...> class container_t > 206 container_t< ptr<Stmt> > ast::Pass< pass_t >::call_accept( const container_t< ptr<Stmt> > & statements ) {209 container_t< ptr<Stmt> > ast::Pass< core_t >::call_accept( const container_t< ptr<Stmt> > & statements ) { 207 210 __pedantic_pass_assert( __visit_children() ); 208 211 if( statements.empty() ) return {}; … … 215 218 216 219 // get the stmts/decls that will need to be spliced in 217 auto stmts_before = __pass::stmtsToAddBefore( pass, 0);218 auto stmts_after = __pass::stmtsToAddAfter ( pass, 0);219 auto decls_before = __pass::declsToAddBefore( pass, 0);220 auto decls_after = __pass::declsToAddAfter ( pass, 0);220 auto stmts_before = __pass::stmtsToAddBefore( core, 0); 221 auto stmts_after = __pass::stmtsToAddAfter ( core, 0); 222 auto decls_before = __pass::declsToAddBefore( core, 0); 223 auto decls_after = __pass::declsToAddAfter ( core, 0); 221 224 222 225 // These may be modified by subnode but most be restored once we exit this statemnet. … … 268 271 } 269 272 270 template< typename pass_t >273 template< typename core_t > 271 274 template< template <class...> class container_t, typename node_t > 272 container_t< ast::ptr<node_t> > ast::Pass< pass_t >::call_accept( const container_t< ast::ptr<node_t> > & container ) {275 container_t< ast::ptr<node_t> > ast::Pass< core_t >::call_accept( const container_t< ast::ptr<node_t> > & container ) { 273 276 __pedantic_pass_assert( __visit_children() ); 274 277 if( container.empty() ) return {}; … … 299 302 } 300 303 301 template< typename pass_t >304 template< typename core_t > 302 305 template<typename node_t, typename parent_t, typename child_t> 303 void ast::Pass< pass_t >::maybe_accept(306 void ast::Pass< core_t >::maybe_accept( 304 307 const node_t * & parent, 305 308 child_t parent_t::*child … … 323 326 } 324 327 328 329 template< typename core_t > 330 template< typename node_t > 331 void ast::Pass< core_t >::mutate_forall( const node_t *& node ) { 332 if ( auto subs = __pass::forall::subs( core, 0 ) ) { 333 // tracking TypeDecl substitution, full clone 334 if ( node->forall.empty() ) return; 335 336 node_t * mut = mutate( node ); 337 mut->forall = subs->clone( node->forall, *this ); 338 node = mut; 339 } else { 340 // not tracking TypeDecl substitution, just mutate 341 maybe_accept( node, &node_t::forall ); 342 } 343 } 325 344 } 326 345 … … 333 352 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 334 353 335 template< typename pass_t >336 inline void ast::accept_all( std::list< ast::ptr<ast::Decl> > & decls, ast::Pass< pass_t > & visitor ) {354 template< typename core_t > 355 inline void ast::accept_all( std::list< ast::ptr<ast::Decl> > & decls, ast::Pass< core_t > & visitor ) { 337 356 // We are going to aggregate errors for all these statements 338 357 SemanticErrorException errors; … … 342 361 343 362 // get the stmts/decls that will need to be spliced in 344 auto decls_before = __pass::declsToAddBefore( visitor. pass, 0);345 auto decls_after = __pass::declsToAddAfter ( visitor. pass, 0);363 auto decls_before = __pass::declsToAddBefore( visitor.core, 0); 364 auto decls_after = __pass::declsToAddAfter ( visitor.core, 0); 346 365 347 366 // update pass statitistics … … 392 411 //-------------------------------------------------------------------------- 393 412 // ObjectDecl 394 template< typename pass_t >395 const ast::DeclWithType * ast::Pass< pass_t >::visit( const ast::ObjectDecl * node ) {413 template< typename core_t > 414 const ast::DeclWithType * ast::Pass< core_t >::visit( const ast::ObjectDecl * node ) { 396 415 VISIT_START( node ); 397 416 … … 406 425 ) 407 426 408 __pass::symtab::addId( pass, 0, node );427 __pass::symtab::addId( core, 0, node ); 409 428 410 429 VISIT_END( DeclWithType, node ); … … 413 432 //-------------------------------------------------------------------------- 414 433 // FunctionDecl 415 template< typename pass_t >416 const ast::DeclWithType * ast::Pass< pass_t >::visit( const ast::FunctionDecl * node ) {417 VISIT_START( node ); 418 419 __pass::symtab::addId( pass, 0, node );434 template< typename core_t > 435 const ast::DeclWithType * ast::Pass< core_t >::visit( const ast::FunctionDecl * node ) { 436 VISIT_START( node ); 437 438 __pass::symtab::addId( core, 0, node ); 420 439 421 440 VISIT(maybe_accept( node, &FunctionDecl::withExprs );) … … 425 444 // shadow with exprs and not the other way around. 426 445 guard_symtab guard { *this }; 427 __pass::symtab::addWith( pass, 0, node->withExprs, node );446 __pass::symtab::addWith( core, 0, node->withExprs, node ); 428 447 { 429 448 guard_symtab guard { *this }; 430 449 // implicit add __func__ identifier as specified in the C manual 6.4.2.2 431 static ast:: ObjectDecl func(432 node->location, "__func__",433 new ast::ArrayType (434 new ast::BasicType ( ast::BasicType::Char, ast::CV::Qualifiers( ast::CV::Const ) ),450 static ast::ptr< ast::ObjectDecl > func{ new ast::ObjectDecl{ 451 CodeLocation{}, "__func__", 452 new ast::ArrayType{ 453 new ast::BasicType{ ast::BasicType::Char, ast::CV::Const }, 435 454 nullptr, VariableLen, DynamicDim 436 )437 );438 __pass::symtab::addId( pass, 0, &func );455 } 456 } }; 457 __pass::symtab::addId( core, 0, func ); 439 458 VISIT( 440 459 maybe_accept( node, &FunctionDecl::type ); … … 454 473 //-------------------------------------------------------------------------- 455 474 // StructDecl 456 template< typename pass_t >457 const ast::Decl * ast::Pass< pass_t >::visit( const ast::StructDecl * node ) {475 template< typename core_t > 476 const ast::Decl * ast::Pass< core_t >::visit( const ast::StructDecl * node ) { 458 477 VISIT_START( node ); 459 478 460 479 // make up a forward declaration and add it before processing the members 461 480 // needs to be on the heap because addStruct saves the pointer 462 __pass::symtab::addStructFwd( pass, 0, node );481 __pass::symtab::addStructFwd( core, 0, node ); 463 482 464 483 VISIT({ … … 469 488 470 489 // this addition replaces the forward declaration 471 __pass::symtab::addStruct( pass, 0, node );490 __pass::symtab::addStruct( core, 0, node ); 472 491 473 492 VISIT_END( Decl, node ); … … 476 495 //-------------------------------------------------------------------------- 477 496 // UnionDecl 478 template< typename pass_t >479 const ast::Decl * ast::Pass< pass_t >::visit( const ast::UnionDecl * node ) {497 template< typename core_t > 498 const ast::Decl * ast::Pass< core_t >::visit( const ast::UnionDecl * node ) { 480 499 VISIT_START( node ); 481 500 482 501 // make up a forward declaration and add it before processing the members 483 __pass::symtab::addUnionFwd( pass, 0, node );502 __pass::symtab::addUnionFwd( core, 0, node ); 484 503 485 504 VISIT({ … … 489 508 }) 490 509 491 __pass::symtab::addUnion( pass, 0, node );510 __pass::symtab::addUnion( core, 0, node ); 492 511 493 512 VISIT_END( Decl, node ); … … 496 515 //-------------------------------------------------------------------------- 497 516 // EnumDecl 498 template< typename pass_t >499 const ast::Decl * ast::Pass< pass_t >::visit( const ast::EnumDecl * node ) {500 VISIT_START( node ); 501 502 __pass::symtab::addEnum( pass, 0, node );517 template< typename core_t > 518 const ast::Decl * ast::Pass< core_t >::visit( const ast::EnumDecl * node ) { 519 VISIT_START( node ); 520 521 __pass::symtab::addEnum( core, 0, node ); 503 522 504 523 VISIT( … … 513 532 //-------------------------------------------------------------------------- 514 533 // TraitDecl 515 template< typename pass_t >516 const ast::Decl * ast::Pass< pass_t >::visit( const ast::TraitDecl * node ) {534 template< typename core_t > 535 const ast::Decl * ast::Pass< core_t >::visit( const ast::TraitDecl * node ) { 517 536 VISIT_START( node ); 518 537 … … 523 542 }) 524 543 525 __pass::symtab::addTrait( pass, 0, node );544 __pass::symtab::addTrait( core, 0, node ); 526 545 527 546 VISIT_END( Decl, node ); … … 530 549 //-------------------------------------------------------------------------- 531 550 // TypeDecl 532 template< typename pass_t >533 const ast::Decl * ast::Pass< pass_t >::visit( const ast::TypeDecl * node ) {551 template< typename core_t > 552 const ast::Decl * ast::Pass< core_t >::visit( const ast::TypeDecl * node ) { 534 553 VISIT_START( node ); 535 554 … … 543 562 // note that assertions come after the type is added to the symtab, since they are not part of the type proper 544 563 // and may depend on the type itself 545 __pass::symtab::addType( pass, 0, node );564 __pass::symtab::addType( core, 0, node ); 546 565 547 566 VISIT( … … 559 578 //-------------------------------------------------------------------------- 560 579 // TypedefDecl 561 template< typename pass_t >562 const ast::Decl * ast::Pass< pass_t >::visit( const ast::TypedefDecl * node ) {580 template< typename core_t > 581 const ast::Decl * ast::Pass< core_t >::visit( const ast::TypedefDecl * node ) { 563 582 VISIT_START( node ); 564 583 … … 569 588 }) 570 589 571 __pass::symtab::addType( pass, 0, node );590 __pass::symtab::addType( core, 0, node ); 572 591 573 592 VISIT( maybe_accept( node, &TypedefDecl::assertions ); ) … … 578 597 //-------------------------------------------------------------------------- 579 598 // AsmDecl 580 template< typename pass_t >581 const ast::AsmDecl * ast::Pass< pass_t >::visit( const ast::AsmDecl * node ) {599 template< typename core_t > 600 const ast::AsmDecl * ast::Pass< core_t >::visit( const ast::AsmDecl * node ) { 582 601 VISIT_START( node ); 583 602 … … 591 610 //-------------------------------------------------------------------------- 592 611 // StaticAssertDecl 593 template< typename pass_t >594 const ast::StaticAssertDecl * ast::Pass< pass_t >::visit( const ast::StaticAssertDecl * node ) {612 template< typename core_t > 613 const ast::StaticAssertDecl * ast::Pass< core_t >::visit( const ast::StaticAssertDecl * node ) { 595 614 VISIT_START( node ); 596 615 … … 605 624 //-------------------------------------------------------------------------- 606 625 // CompoundStmt 607 template< typename pass_t >608 const ast::CompoundStmt * ast::Pass< pass_t >::visit( const ast::CompoundStmt * node ) {626 template< typename core_t > 627 const ast::CompoundStmt * ast::Pass< core_t >::visit( const ast::CompoundStmt * node ) { 609 628 VISIT_START( node ); 610 629 VISIT({ 611 630 // do not enter a new scope if inFunction is true - needs to check old state before the assignment 612 auto guard1 = makeFuncGuard( [this, inFunction = this->inFunction]() {613 if ( ! inFunction ) __pass::symtab::enter(pass, 0);614 }, [this, inFunction = this->inFunction]() {615 if ( ! inFunction ) __pass::symtab::leave(pass, 0);631 auto guard1 = makeFuncGuard( [this, inFunctionCpy = this->inFunction]() { 632 if ( ! inFunctionCpy ) __pass::symtab::enter(core, 0); 633 }, [this, inFunctionCpy = this->inFunction]() { 634 if ( ! inFunctionCpy ) __pass::symtab::leave(core, 0); 616 635 }); 617 636 ValueGuard< bool > guard2( inFunction ); … … 625 644 //-------------------------------------------------------------------------- 626 645 // ExprStmt 627 template< typename pass_t >628 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::ExprStmt * node ) {646 template< typename core_t > 647 const ast::Stmt * ast::Pass< core_t >::visit( const ast::ExprStmt * node ) { 629 648 VISIT_START( node ); 630 649 … … 638 657 //-------------------------------------------------------------------------- 639 658 // AsmStmt 640 template< typename pass_t >641 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::AsmStmt * node ) {659 template< typename core_t > 660 const ast::Stmt * ast::Pass< core_t >::visit( const ast::AsmStmt * node ) { 642 661 VISIT_START( node ) 643 662 … … 654 673 //-------------------------------------------------------------------------- 655 674 // DirectiveStmt 656 template< typename pass_t >657 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::DirectiveStmt * node ) {675 template< typename core_t > 676 const ast::Stmt * ast::Pass< core_t >::visit( const ast::DirectiveStmt * node ) { 658 677 VISIT_START( node ) 659 678 … … 663 682 //-------------------------------------------------------------------------- 664 683 // IfStmt 665 template< typename pass_t >666 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::IfStmt * node ) {684 template< typename core_t > 685 const ast::Stmt * ast::Pass< core_t >::visit( const ast::IfStmt * node ) { 667 686 VISIT_START( node ); 668 687 … … 681 700 //-------------------------------------------------------------------------- 682 701 // WhileStmt 683 template< typename pass_t >684 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::WhileStmt * node ) {702 template< typename core_t > 703 const ast::Stmt * ast::Pass< core_t >::visit( const ast::WhileStmt * node ) { 685 704 VISIT_START( node ); 686 705 … … 698 717 //-------------------------------------------------------------------------- 699 718 // ForStmt 700 template< typename pass_t >701 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::ForStmt * node ) {719 template< typename core_t > 720 const ast::Stmt * ast::Pass< core_t >::visit( const ast::ForStmt * node ) { 702 721 VISIT_START( node ); 703 722 … … 716 735 //-------------------------------------------------------------------------- 717 736 // SwitchStmt 718 template< typename pass_t >719 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::SwitchStmt * node ) {737 template< typename core_t > 738 const ast::Stmt * ast::Pass< core_t >::visit( const ast::SwitchStmt * node ) { 720 739 VISIT_START( node ); 721 740 … … 730 749 //-------------------------------------------------------------------------- 731 750 // CaseStmt 732 template< typename pass_t >733 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::CaseStmt * node ) {751 template< typename core_t > 752 const ast::Stmt * ast::Pass< core_t >::visit( const ast::CaseStmt * node ) { 734 753 VISIT_START( node ); 735 754 … … 744 763 //-------------------------------------------------------------------------- 745 764 // BranchStmt 746 template< typename pass_t >747 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::BranchStmt * node ) {765 template< typename core_t > 766 const ast::Stmt * ast::Pass< core_t >::visit( const ast::BranchStmt * node ) { 748 767 VISIT_START( node ); 749 768 VISIT_END( Stmt, node ); … … 752 771 //-------------------------------------------------------------------------- 753 772 // ReturnStmt 754 template< typename pass_t >755 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::ReturnStmt * node ) {773 template< typename core_t > 774 const ast::Stmt * ast::Pass< core_t >::visit( const ast::ReturnStmt * node ) { 756 775 VISIT_START( node ); 757 776 … … 765 784 //-------------------------------------------------------------------------- 766 785 // ThrowStmt 767 template< typename pass_t >768 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::ThrowStmt * node ) {786 template< typename core_t > 787 const ast::Stmt * ast::Pass< core_t >::visit( const ast::ThrowStmt * node ) { 769 788 VISIT_START( node ); 770 789 … … 779 798 //-------------------------------------------------------------------------- 780 799 // TryStmt 781 template< typename pass_t >782 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::TryStmt * node ) {800 template< typename core_t > 801 const ast::Stmt * ast::Pass< core_t >::visit( const ast::TryStmt * node ) { 783 802 VISIT_START( node ); 784 803 … … 794 813 //-------------------------------------------------------------------------- 795 814 // CatchStmt 796 template< typename pass_t >797 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::CatchStmt * node ) {815 template< typename core_t > 816 const ast::Stmt * ast::Pass< core_t >::visit( const ast::CatchStmt * node ) { 798 817 VISIT_START( node ); 799 818 … … 811 830 //-------------------------------------------------------------------------- 812 831 // FinallyStmt 813 template< typename pass_t >814 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::FinallyStmt * node ) {832 template< typename core_t > 833 const ast::Stmt * ast::Pass< core_t >::visit( const ast::FinallyStmt * node ) { 815 834 VISIT_START( node ); 816 835 … … 824 843 //-------------------------------------------------------------------------- 825 844 // FinallyStmt 826 template< typename pass_t >827 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::SuspendStmt * node ) {845 template< typename core_t > 846 const ast::Stmt * ast::Pass< core_t >::visit( const ast::SuspendStmt * node ) { 828 847 VISIT_START( node ); 829 848 … … 837 856 //-------------------------------------------------------------------------- 838 857 // WaitForStmt 839 template< typename pass_t >840 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::WaitForStmt * node ) {858 template< typename core_t > 859 const ast::Stmt * ast::Pass< core_t >::visit( const ast::WaitForStmt * node ) { 841 860 VISIT_START( node ); 842 861 // for( auto & clause : node->clauses ) { … … 906 925 //-------------------------------------------------------------------------- 907 926 // WithStmt 908 template< typename pass_t >909 const ast::Decl * ast::Pass< pass_t >::visit( const ast::WithStmt * node ) {927 template< typename core_t > 928 const ast::Decl * ast::Pass< core_t >::visit( const ast::WithStmt * node ) { 910 929 VISIT_START( node ); 911 930 … … 915 934 // catch statements introduce a level of scope (for the caught exception) 916 935 guard_symtab guard { *this }; 917 __pass::symtab::addWith( pass, 0, node->exprs, node );936 __pass::symtab::addWith( core, 0, node->exprs, node ); 918 937 maybe_accept( node, &WithStmt::stmt ); 919 938 } … … 924 943 //-------------------------------------------------------------------------- 925 944 // NullStmt 926 template< typename pass_t >927 const ast::NullStmt * ast::Pass< pass_t >::visit( const ast::NullStmt * node ) {945 template< typename core_t > 946 const ast::NullStmt * ast::Pass< core_t >::visit( const ast::NullStmt * node ) { 928 947 VISIT_START( node ); 929 948 VISIT_END( NullStmt, node ); … … 932 951 //-------------------------------------------------------------------------- 933 952 // DeclStmt 934 template< typename pass_t >935 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::DeclStmt * node ) {953 template< typename core_t > 954 const ast::Stmt * ast::Pass< core_t >::visit( const ast::DeclStmt * node ) { 936 955 VISIT_START( node ); 937 956 … … 945 964 //-------------------------------------------------------------------------- 946 965 // ImplicitCtorDtorStmt 947 template< typename pass_t >948 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::ImplicitCtorDtorStmt * node ) {966 template< typename core_t > 967 const ast::Stmt * ast::Pass< core_t >::visit( const ast::ImplicitCtorDtorStmt * node ) { 949 968 VISIT_START( node ); 950 969 951 970 // For now this isn't visited, it is unclear if this causes problem 952 971 // if all tests are known to pass, remove this code 953 //VISIT(954 //maybe_accept( node, &ImplicitCtorDtorStmt::callStmt );955 //)972 VISIT( 973 maybe_accept( node, &ImplicitCtorDtorStmt::callStmt ); 974 ) 956 975 957 976 VISIT_END( Stmt, node ); … … 960 979 //-------------------------------------------------------------------------- 961 980 // ApplicationExpr 962 template< typename pass_t >963 const ast::Expr * ast::Pass< pass_t >::visit( const ast::ApplicationExpr * node ) {981 template< typename core_t > 982 const ast::Expr * ast::Pass< core_t >::visit( const ast::ApplicationExpr * node ) { 964 983 VISIT_START( node ); 965 984 … … 978 997 //-------------------------------------------------------------------------- 979 998 // UntypedExpr 980 template< typename pass_t >981 const ast::Expr * ast::Pass< pass_t >::visit( const ast::UntypedExpr * node ) {999 template< typename core_t > 1000 const ast::Expr * ast::Pass< core_t >::visit( const ast::UntypedExpr * node ) { 982 1001 VISIT_START( node ); 983 1002 … … 996 1015 //-------------------------------------------------------------------------- 997 1016 // NameExpr 998 template< typename pass_t >999 const ast::Expr * ast::Pass< pass_t >::visit( const ast::NameExpr * node ) {1017 template< typename core_t > 1018 const ast::Expr * ast::Pass< core_t >::visit( const ast::NameExpr * node ) { 1000 1019 VISIT_START( node ); 1001 1020 … … 1010 1029 //-------------------------------------------------------------------------- 1011 1030 // CastExpr 1012 template< typename pass_t >1013 const ast::Expr * ast::Pass< pass_t >::visit( const ast::CastExpr * node ) {1031 template< typename core_t > 1032 const ast::Expr * ast::Pass< core_t >::visit( const ast::CastExpr * node ) { 1014 1033 VISIT_START( node ); 1015 1034 … … 1026 1045 //-------------------------------------------------------------------------- 1027 1046 // KeywordCastExpr 1028 template< typename pass_t >1029 const ast::Expr * ast::Pass< pass_t >::visit( const ast::KeywordCastExpr * node ) {1047 template< typename core_t > 1048 const ast::Expr * ast::Pass< core_t >::visit( const ast::KeywordCastExpr * node ) { 1030 1049 VISIT_START( node ); 1031 1050 … … 1042 1061 //-------------------------------------------------------------------------- 1043 1062 // VirtualCastExpr 1044 template< typename pass_t >1045 const ast::Expr * ast::Pass< pass_t >::visit( const ast::VirtualCastExpr * node ) {1063 template< typename core_t > 1064 const ast::Expr * ast::Pass< core_t >::visit( const ast::VirtualCastExpr * node ) { 1046 1065 VISIT_START( node ); 1047 1066 … … 1058 1077 //-------------------------------------------------------------------------- 1059 1078 // AddressExpr 1060 template< typename pass_t >1061 const ast::Expr * ast::Pass< pass_t >::visit( const ast::AddressExpr * node ) {1079 template< typename core_t > 1080 const ast::Expr * ast::Pass< core_t >::visit( const ast::AddressExpr * node ) { 1062 1081 VISIT_START( node ); 1063 1082 … … 1074 1093 //-------------------------------------------------------------------------- 1075 1094 // LabelAddressExpr 1076 template< typename pass_t >1077 const ast::Expr * ast::Pass< pass_t >::visit( const ast::LabelAddressExpr * node ) {1095 template< typename core_t > 1096 const ast::Expr * ast::Pass< core_t >::visit( const ast::LabelAddressExpr * node ) { 1078 1097 VISIT_START( node ); 1079 1098 … … 1088 1107 //-------------------------------------------------------------------------- 1089 1108 // UntypedMemberExpr 1090 template< typename pass_t >1091 const ast::Expr * ast::Pass< pass_t >::visit( const ast::UntypedMemberExpr * node ) {1109 template< typename core_t > 1110 const ast::Expr * ast::Pass< core_t >::visit( const ast::UntypedMemberExpr * node ) { 1092 1111 VISIT_START( node ); 1093 1112 … … 1105 1124 //-------------------------------------------------------------------------- 1106 1125 // MemberExpr 1107 template< typename pass_t >1108 const ast::Expr * ast::Pass< pass_t >::visit( const ast::MemberExpr * node ) {1126 template< typename core_t > 1127 const ast::Expr * ast::Pass< core_t >::visit( const ast::MemberExpr * node ) { 1109 1128 VISIT_START( node ); 1110 1129 … … 1121 1140 //-------------------------------------------------------------------------- 1122 1141 // VariableExpr 1123 template< typename pass_t >1124 const ast::Expr * ast::Pass< pass_t >::visit( const ast::VariableExpr * node ) {1142 template< typename core_t > 1143 const ast::Expr * ast::Pass< core_t >::visit( const ast::VariableExpr * node ) { 1125 1144 VISIT_START( node ); 1126 1145 … … 1135 1154 //-------------------------------------------------------------------------- 1136 1155 // ConstantExpr 1137 template< typename pass_t >1138 const ast::Expr * ast::Pass< pass_t >::visit( const ast::ConstantExpr * node ) {1156 template< typename core_t > 1157 const ast::Expr * ast::Pass< core_t >::visit( const ast::ConstantExpr * node ) { 1139 1158 VISIT_START( node ); 1140 1159 … … 1149 1168 //-------------------------------------------------------------------------- 1150 1169 // SizeofExpr 1151 template< typename pass_t >1152 const ast::Expr * ast::Pass< pass_t >::visit( const ast::SizeofExpr * node ) {1170 template< typename core_t > 1171 const ast::Expr * ast::Pass< core_t >::visit( const ast::SizeofExpr * node ) { 1153 1172 VISIT_START( node ); 1154 1173 … … 1169 1188 //-------------------------------------------------------------------------- 1170 1189 // AlignofExpr 1171 template< typename pass_t >1172 const ast::Expr * ast::Pass< pass_t >::visit( const ast::AlignofExpr * node ) {1190 template< typename core_t > 1191 const ast::Expr * ast::Pass< core_t >::visit( const ast::AlignofExpr * node ) { 1173 1192 VISIT_START( node ); 1174 1193 … … 1189 1208 //-------------------------------------------------------------------------- 1190 1209 // UntypedOffsetofExpr 1191 template< typename pass_t >1192 const ast::Expr * ast::Pass< pass_t >::visit( const ast::UntypedOffsetofExpr * node ) {1210 template< typename core_t > 1211 const ast::Expr * ast::Pass< core_t >::visit( const ast::UntypedOffsetofExpr * node ) { 1193 1212 VISIT_START( node ); 1194 1213 … … 1205 1224 //-------------------------------------------------------------------------- 1206 1225 // OffsetofExpr 1207 template< typename pass_t >1208 const ast::Expr * ast::Pass< pass_t >::visit( const ast::OffsetofExpr * node ) {1226 template< typename core_t > 1227 const ast::Expr * ast::Pass< core_t >::visit( const ast::OffsetofExpr * node ) { 1209 1228 VISIT_START( node ); 1210 1229 … … 1221 1240 //-------------------------------------------------------------------------- 1222 1241 // OffsetPackExpr 1223 template< typename pass_t >1224 const ast::Expr * ast::Pass< pass_t >::visit( const ast::OffsetPackExpr * node ) {1242 template< typename core_t > 1243 const ast::Expr * ast::Pass< core_t >::visit( const ast::OffsetPackExpr * node ) { 1225 1244 VISIT_START( node ); 1226 1245 … … 1237 1256 //-------------------------------------------------------------------------- 1238 1257 // LogicalExpr 1239 template< typename pass_t >1240 const ast::Expr * ast::Pass< pass_t >::visit( const ast::LogicalExpr * node ) {1258 template< typename core_t > 1259 const ast::Expr * ast::Pass< core_t >::visit( const ast::LogicalExpr * node ) { 1241 1260 VISIT_START( node ); 1242 1261 … … 1254 1273 //-------------------------------------------------------------------------- 1255 1274 // ConditionalExpr 1256 template< typename pass_t >1257 const ast::Expr * ast::Pass< pass_t >::visit( const ast::ConditionalExpr * node ) {1275 template< typename core_t > 1276 const ast::Expr * ast::Pass< core_t >::visit( const ast::ConditionalExpr * node ) { 1258 1277 VISIT_START( node ); 1259 1278 … … 1272 1291 //-------------------------------------------------------------------------- 1273 1292 // CommaExpr 1274 template< typename pass_t >1275 const ast::Expr * ast::Pass< pass_t >::visit( const ast::CommaExpr * node ) {1293 template< typename core_t > 1294 const ast::Expr * ast::Pass< core_t >::visit( const ast::CommaExpr * node ) { 1276 1295 VISIT_START( node ); 1277 1296 … … 1289 1308 //-------------------------------------------------------------------------- 1290 1309 // TypeExpr 1291 template< typename pass_t >1292 const ast::Expr * ast::Pass< pass_t >::visit( const ast::TypeExpr * node ) {1310 template< typename core_t > 1311 const ast::Expr * ast::Pass< core_t >::visit( const ast::TypeExpr * node ) { 1293 1312 VISIT_START( node ); 1294 1313 … … 1305 1324 //-------------------------------------------------------------------------- 1306 1325 // AsmExpr 1307 template< typename pass_t >1308 const ast::Expr * ast::Pass< pass_t >::visit( const ast::AsmExpr * node ) {1326 template< typename core_t > 1327 const ast::Expr * ast::Pass< core_t >::visit( const ast::AsmExpr * node ) { 1309 1328 VISIT_START( node ); 1310 1329 … … 1322 1341 //-------------------------------------------------------------------------- 1323 1342 // ImplicitCopyCtorExpr 1324 template< typename pass_t >1325 const ast::Expr * ast::Pass< pass_t >::visit( const ast::ImplicitCopyCtorExpr * node ) {1343 template< typename core_t > 1344 const ast::Expr * ast::Pass< core_t >::visit( const ast::ImplicitCopyCtorExpr * node ) { 1326 1345 VISIT_START( node ); 1327 1346 … … 1338 1357 //-------------------------------------------------------------------------- 1339 1358 // ConstructorExpr 1340 template< typename pass_t >1341 const ast::Expr * ast::Pass< pass_t >::visit( const ast::ConstructorExpr * node ) {1359 template< typename core_t > 1360 const ast::Expr * ast::Pass< core_t >::visit( const ast::ConstructorExpr * node ) { 1342 1361 VISIT_START( node ); 1343 1362 … … 1354 1373 //-------------------------------------------------------------------------- 1355 1374 // CompoundLiteralExpr 1356 template< typename pass_t >1357 const ast::Expr * ast::Pass< pass_t >::visit( const ast::CompoundLiteralExpr * node ) {1375 template< typename core_t > 1376 const ast::Expr * ast::Pass< core_t >::visit( const ast::CompoundLiteralExpr * node ) { 1358 1377 VISIT_START( node ); 1359 1378 … … 1370 1389 //-------------------------------------------------------------------------- 1371 1390 // RangeExpr 1372 template< typename pass_t >1373 const ast::Expr * ast::Pass< pass_t >::visit( const ast::RangeExpr * node ) {1391 template< typename core_t > 1392 const ast::Expr * ast::Pass< core_t >::visit( const ast::RangeExpr * node ) { 1374 1393 VISIT_START( node ); 1375 1394 … … 1387 1406 //-------------------------------------------------------------------------- 1388 1407 // UntypedTupleExpr 1389 template< typename pass_t >1390 const ast::Expr * ast::Pass< pass_t >::visit( const ast::UntypedTupleExpr * node ) {1408 template< typename core_t > 1409 const ast::Expr * ast::Pass< core_t >::visit( const ast::UntypedTupleExpr * node ) { 1391 1410 VISIT_START( node ); 1392 1411 … … 1403 1422 //-------------------------------------------------------------------------- 1404 1423 // TupleExpr 1405 template< typename pass_t >1406 const ast::Expr * ast::Pass< pass_t >::visit( const ast::TupleExpr * node ) {1424 template< typename core_t > 1425 const ast::Expr * ast::Pass< core_t >::visit( const ast::TupleExpr * node ) { 1407 1426 VISIT_START( node ); 1408 1427 … … 1419 1438 //-------------------------------------------------------------------------- 1420 1439 // TupleIndexExpr 1421 template< typename pass_t >1422 const ast::Expr * ast::Pass< pass_t >::visit( const ast::TupleIndexExpr * node ) {1440 template< typename core_t > 1441 const ast::Expr * ast::Pass< core_t >::visit( const ast::TupleIndexExpr * node ) { 1423 1442 VISIT_START( node ); 1424 1443 … … 1435 1454 //-------------------------------------------------------------------------- 1436 1455 // TupleAssignExpr 1437 template< typename pass_t >1438 const ast::Expr * ast::Pass< pass_t >::visit( const ast::TupleAssignExpr * node ) {1456 template< typename core_t > 1457 const ast::Expr * ast::Pass< core_t >::visit( const ast::TupleAssignExpr * node ) { 1439 1458 VISIT_START( node ); 1440 1459 … … 1451 1470 //-------------------------------------------------------------------------- 1452 1471 // StmtExpr 1453 template< typename pass_t >1454 const ast::Expr * ast::Pass< pass_t >::visit( const ast::StmtExpr * node ) {1472 template< typename core_t > 1473 const ast::Expr * ast::Pass< core_t >::visit( const ast::StmtExpr * node ) { 1455 1474 VISIT_START( node ); 1456 1475 1457 1476 VISIT(// don't want statements from outer CompoundStmts to be added to this StmtExpr 1458 1477 // get the stmts that will need to be spliced in 1459 auto stmts_before = __pass::stmtsToAddBefore( pass, 0);1460 auto stmts_after = __pass::stmtsToAddAfter ( pass, 0);1478 auto stmts_before = __pass::stmtsToAddBefore( core, 0); 1479 auto stmts_after = __pass::stmtsToAddAfter ( core, 0); 1461 1480 1462 1481 // These may be modified by subnode but most be restored once we exit this statemnet. 1463 ValueGuardPtr< const ast::TypeSubstitution * > __old_env( __pass::env( pass, 0) );1482 ValueGuardPtr< const ast::TypeSubstitution * > __old_env( __pass::env( core, 0) ); 1464 1483 ValueGuardPtr< typename std::remove_pointer< decltype(stmts_before) >::type > __old_decls_before( stmts_before ); 1465 1484 ValueGuardPtr< typename std::remove_pointer< decltype(stmts_after ) >::type > __old_decls_after ( stmts_after ); … … 1479 1498 //-------------------------------------------------------------------------- 1480 1499 // UniqueExpr 1481 template< typename pass_t >1482 const ast::Expr * ast::Pass< pass_t >::visit( const ast::UniqueExpr * node ) {1500 template< typename core_t > 1501 const ast::Expr * ast::Pass< core_t >::visit( const ast::UniqueExpr * node ) { 1483 1502 VISIT_START( node ); 1484 1503 … … 1495 1514 //-------------------------------------------------------------------------- 1496 1515 // UntypedInitExpr 1497 template< typename pass_t >1498 const ast::Expr * ast::Pass< pass_t >::visit( const ast::UntypedInitExpr * node ) {1516 template< typename core_t > 1517 const ast::Expr * ast::Pass< core_t >::visit( const ast::UntypedInitExpr * node ) { 1499 1518 VISIT_START( node ); 1500 1519 … … 1512 1531 //-------------------------------------------------------------------------- 1513 1532 // InitExpr 1514 template< typename pass_t >1515 const ast::Expr * ast::Pass< pass_t >::visit( const ast::InitExpr * node ) {1533 template< typename core_t > 1534 const ast::Expr * ast::Pass< core_t >::visit( const ast::InitExpr * node ) { 1516 1535 VISIT_START( node ); 1517 1536 … … 1529 1548 //-------------------------------------------------------------------------- 1530 1549 // DeletedExpr 1531 template< typename pass_t >1532 const ast::Expr * ast::Pass< pass_t >::visit( const ast::DeletedExpr * node ) {1550 template< typename core_t > 1551 const ast::Expr * ast::Pass< core_t >::visit( const ast::DeletedExpr * node ) { 1533 1552 VISIT_START( node ); 1534 1553 … … 1546 1565 //-------------------------------------------------------------------------- 1547 1566 // DefaultArgExpr 1548 template< typename pass_t >1549 const ast::Expr * ast::Pass< pass_t >::visit( const ast::DefaultArgExpr * node ) {1567 template< typename core_t > 1568 const ast::Expr * ast::Pass< core_t >::visit( const ast::DefaultArgExpr * node ) { 1550 1569 VISIT_START( node ); 1551 1570 … … 1562 1581 //-------------------------------------------------------------------------- 1563 1582 // GenericExpr 1564 template< typename pass_t >1565 const ast::Expr * ast::Pass< pass_t >::visit( const ast::GenericExpr * node ) {1583 template< typename core_t > 1584 const ast::Expr * ast::Pass< core_t >::visit( const ast::GenericExpr * node ) { 1566 1585 VISIT_START( node ); 1567 1586 … … 1602 1621 //-------------------------------------------------------------------------- 1603 1622 // VoidType 1604 template< typename pass_t >1605 const ast::Type * ast::Pass< pass_t >::visit( const ast::VoidType * node ) {1623 template< typename core_t > 1624 const ast::Type * ast::Pass< core_t >::visit( const ast::VoidType * node ) { 1606 1625 VISIT_START( node ); 1607 1626 … … 1611 1630 //-------------------------------------------------------------------------- 1612 1631 // BasicType 1613 template< typename pass_t >1614 const ast::Type * ast::Pass< pass_t >::visit( const ast::BasicType * node ) {1632 template< typename core_t > 1633 const ast::Type * ast::Pass< core_t >::visit( const ast::BasicType * node ) { 1615 1634 VISIT_START( node ); 1616 1635 … … 1620 1639 //-------------------------------------------------------------------------- 1621 1640 // PointerType 1622 template< typename pass_t >1623 const ast::Type * ast::Pass< pass_t >::visit( const ast::PointerType * node ) {1641 template< typename core_t > 1642 const ast::Type * ast::Pass< core_t >::visit( const ast::PointerType * node ) { 1624 1643 VISIT_START( node ); 1625 1644 … … 1634 1653 //-------------------------------------------------------------------------- 1635 1654 // ArrayType 1636 template< typename pass_t >1637 const ast::Type * ast::Pass< pass_t >::visit( const ast::ArrayType * node ) {1655 template< typename core_t > 1656 const ast::Type * ast::Pass< core_t >::visit( const ast::ArrayType * node ) { 1638 1657 VISIT_START( node ); 1639 1658 … … 1648 1667 //-------------------------------------------------------------------------- 1649 1668 // ReferenceType 1650 template< typename pass_t >1651 const ast::Type * ast::Pass< pass_t >::visit( const ast::ReferenceType * node ) {1669 template< typename core_t > 1670 const ast::Type * ast::Pass< core_t >::visit( const ast::ReferenceType * node ) { 1652 1671 VISIT_START( node ); 1653 1672 … … 1661 1680 //-------------------------------------------------------------------------- 1662 1681 // QualifiedType 1663 template< typename pass_t >1664 const ast::Type * ast::Pass< pass_t >::visit( const ast::QualifiedType * node ) {1682 template< typename core_t > 1683 const ast::Type * ast::Pass< core_t >::visit( const ast::QualifiedType * node ) { 1665 1684 VISIT_START( node ); 1666 1685 … … 1675 1694 //-------------------------------------------------------------------------- 1676 1695 // FunctionType 1677 template< typename pass_t > 1678 const ast::Type * ast::Pass< pass_t >::visit( const ast::FunctionType * node ) { 1679 VISIT_START( node ); 1680 1681 VISIT( 1682 maybe_accept( node, &FunctionType::forall ); 1696 template< typename core_t > 1697 const ast::Type * ast::Pass< core_t >::visit( const ast::FunctionType * node ) { 1698 VISIT_START( node ); 1699 1700 VISIT({ 1701 guard_forall_subs forall_guard { *this, node }; 1702 mutate_forall( node ); 1683 1703 maybe_accept( node, &FunctionType::returns ); 1684 1704 maybe_accept( node, &FunctionType::params ); 1685 )1705 }) 1686 1706 1687 1707 VISIT_END( Type, node ); … … 1690 1710 //-------------------------------------------------------------------------- 1691 1711 // StructInstType 1692 template< typename pass_t >1693 const ast::Type * ast::Pass< pass_t >::visit( const ast::StructInstType * node ) {1694 VISIT_START( node ); 1695 1696 __pass::symtab::addStruct( pass, 0, node->name );1712 template< typename core_t > 1713 const ast::Type * ast::Pass< core_t >::visit( const ast::StructInstType * node ) { 1714 VISIT_START( node ); 1715 1716 __pass::symtab::addStruct( core, 0, node->name ); 1697 1717 1698 1718 VISIT({ 1699 1719 guard_symtab guard { *this }; 1700 maybe_accept( node, &StructInstType::forall ); 1720 guard_forall_subs forall_guard { *this, node }; 1721 mutate_forall( node ); 1701 1722 maybe_accept( node, &StructInstType::params ); 1702 1723 }) … … 1707 1728 //-------------------------------------------------------------------------- 1708 1729 // UnionInstType 1709 template< typename pass_t >1710 const ast::Type * ast::Pass< pass_t >::visit( const ast::UnionInstType * node ) {1711 VISIT_START( node ); 1712 1713 __pass::symtab::add Struct( pass, 0, node->name );1714 1715 {1730 template< typename core_t > 1731 const ast::Type * ast::Pass< core_t >::visit( const ast::UnionInstType * node ) { 1732 VISIT_START( node ); 1733 1734 __pass::symtab::addUnion( core, 0, node->name ); 1735 1736 VISIT({ 1716 1737 guard_symtab guard { *this }; 1717 maybe_accept( node, &UnionInstType::forall ); 1738 guard_forall_subs forall_guard { *this, node }; 1739 mutate_forall( node ); 1718 1740 maybe_accept( node, &UnionInstType::params ); 1719 } 1741 }) 1720 1742 1721 1743 VISIT_END( Type, node ); … … 1724 1746 //-------------------------------------------------------------------------- 1725 1747 // EnumInstType 1726 template< typename pass_t > 1727 const ast::Type * ast::Pass< pass_t >::visit( const ast::EnumInstType * node ) { 1728 VISIT_START( node ); 1729 1730 VISIT( 1731 maybe_accept( node, &EnumInstType::forall ); 1748 template< typename core_t > 1749 const ast::Type * ast::Pass< core_t >::visit( const ast::EnumInstType * node ) { 1750 VISIT_START( node ); 1751 1752 VISIT({ 1753 guard_forall_subs forall_guard { *this, node }; 1754 mutate_forall( node ); 1732 1755 maybe_accept( node, &EnumInstType::params ); 1733 )1756 }) 1734 1757 1735 1758 VISIT_END( Type, node ); … … 1738 1761 //-------------------------------------------------------------------------- 1739 1762 // TraitInstType 1740 template< typename pass_t > 1741 const ast::Type * ast::Pass< pass_t >::visit( const ast::TraitInstType * node ) { 1742 VISIT_START( node ); 1743 1744 VISIT( 1745 maybe_accept( node, &TraitInstType::forall ); 1763 template< typename core_t > 1764 const ast::Type * ast::Pass< core_t >::visit( const ast::TraitInstType * node ) { 1765 VISIT_START( node ); 1766 1767 VISIT({ 1768 guard_forall_subs forall_guard { *this, node }; 1769 mutate_forall( node ); 1746 1770 maybe_accept( node, &TraitInstType::params ); 1747 )1771 }) 1748 1772 1749 1773 VISIT_END( Type, node ); … … 1752 1776 //-------------------------------------------------------------------------- 1753 1777 // TypeInstType 1754 template< typename pass_t > 1755 const ast::Type * ast::Pass< pass_t >::visit( const ast::TypeInstType * node ) { 1756 VISIT_START( node ); 1757 1758 VISIT( 1759 maybe_accept( node, &TypeInstType::forall ); 1760 maybe_accept( node, &TypeInstType::params ); 1778 template< typename core_t > 1779 const ast::Type * ast::Pass< core_t >::visit( const ast::TypeInstType * node ) { 1780 VISIT_START( node ); 1781 1782 VISIT( 1783 { 1784 guard_forall_subs forall_guard { *this, node }; 1785 mutate_forall( node ); 1786 maybe_accept( node, &TypeInstType::params ); 1787 } 1788 // ensure that base re-bound if doing substitution 1789 __pass::forall::replace( core, 0, node ); 1761 1790 ) 1762 1791 … … 1766 1795 //-------------------------------------------------------------------------- 1767 1796 // TupleType 1768 template< typename pass_t >1769 const ast::Type * ast::Pass< pass_t >::visit( const ast::TupleType * node ) {1797 template< typename core_t > 1798 const ast::Type * ast::Pass< core_t >::visit( const ast::TupleType * node ) { 1770 1799 VISIT_START( node ); 1771 1800 … … 1780 1809 //-------------------------------------------------------------------------- 1781 1810 // TypeofType 1782 template< typename pass_t >1783 const ast::Type * ast::Pass< pass_t >::visit( const ast::TypeofType * node ) {1811 template< typename core_t > 1812 const ast::Type * ast::Pass< core_t >::visit( const ast::TypeofType * node ) { 1784 1813 VISIT_START( node ); 1785 1814 … … 1793 1822 //-------------------------------------------------------------------------- 1794 1823 // VarArgsType 1795 template< typename pass_t >1796 const ast::Type * ast::Pass< pass_t >::visit( const ast::VarArgsType * node ) {1824 template< typename core_t > 1825 const ast::Type * ast::Pass< core_t >::visit( const ast::VarArgsType * node ) { 1797 1826 VISIT_START( node ); 1798 1827 … … 1802 1831 //-------------------------------------------------------------------------- 1803 1832 // ZeroType 1804 template< typename pass_t >1805 const ast::Type * ast::Pass< pass_t >::visit( const ast::ZeroType * node ) {1833 template< typename core_t > 1834 const ast::Type * ast::Pass< core_t >::visit( const ast::ZeroType * node ) { 1806 1835 VISIT_START( node ); 1807 1836 … … 1811 1840 //-------------------------------------------------------------------------- 1812 1841 // OneType 1813 template< typename pass_t >1814 const ast::Type * ast::Pass< pass_t >::visit( const ast::OneType * node ) {1842 template< typename core_t > 1843 const ast::Type * ast::Pass< core_t >::visit( const ast::OneType * node ) { 1815 1844 VISIT_START( node ); 1816 1845 … … 1820 1849 //-------------------------------------------------------------------------- 1821 1850 // GlobalScopeType 1822 template< typename pass_t >1823 const ast::Type * ast::Pass< pass_t >::visit( const ast::GlobalScopeType * node ) {1851 template< typename core_t > 1852 const ast::Type * ast::Pass< core_t >::visit( const ast::GlobalScopeType * node ) { 1824 1853 VISIT_START( node ); 1825 1854 … … 1830 1859 //-------------------------------------------------------------------------- 1831 1860 // Designation 1832 template< typename pass_t >1833 const ast::Designation * ast::Pass< pass_t >::visit( const ast::Designation * node ) {1861 template< typename core_t > 1862 const ast::Designation * ast::Pass< core_t >::visit( const ast::Designation * node ) { 1834 1863 VISIT_START( node ); 1835 1864 … … 1841 1870 //-------------------------------------------------------------------------- 1842 1871 // SingleInit 1843 template< typename pass_t >1844 const ast::Init * ast::Pass< pass_t >::visit( const ast::SingleInit * node ) {1872 template< typename core_t > 1873 const ast::Init * ast::Pass< core_t >::visit( const ast::SingleInit * node ) { 1845 1874 VISIT_START( node ); 1846 1875 … … 1854 1883 //-------------------------------------------------------------------------- 1855 1884 // ListInit 1856 template< typename pass_t >1857 const ast::Init * ast::Pass< pass_t >::visit( const ast::ListInit * node ) {1885 template< typename core_t > 1886 const ast::Init * ast::Pass< core_t >::visit( const ast::ListInit * node ) { 1858 1887 VISIT_START( node ); 1859 1888 … … 1868 1897 //-------------------------------------------------------------------------- 1869 1898 // ConstructorInit 1870 template< typename pass_t >1871 const ast::Init * ast::Pass< pass_t >::visit( const ast::ConstructorInit * node ) {1899 template< typename core_t > 1900 const ast::Init * ast::Pass< core_t >::visit( const ast::ConstructorInit * node ) { 1872 1901 VISIT_START( node ); 1873 1902 … … 1883 1912 //-------------------------------------------------------------------------- 1884 1913 // Attribute 1885 template< typename pass_t >1886 const ast::Attribute * ast::Pass< pass_t >::visit( const ast::Attribute * node ) {1914 template< typename core_t > 1915 const ast::Attribute * ast::Pass< core_t >::visit( const ast::Attribute * node ) { 1887 1916 VISIT_START( node ); 1888 1917 … … 1896 1925 //-------------------------------------------------------------------------- 1897 1926 // TypeSubstitution 1898 template< typename pass_t >1899 const ast::TypeSubstitution * ast::Pass< pass_t >::visit( const ast::TypeSubstitution * node ) {1927 template< typename core_t > 1928 const ast::TypeSubstitution * ast::Pass< core_t >::visit( const ast::TypeSubstitution * node ) { 1900 1929 VISIT_START( node ); 1901 1930 … … 1907 1936 guard_symtab guard { *this }; 1908 1937 auto new_node = p.second->accept( *this ); 1909 if (new_node != p.second) mutated = false;1938 if (new_node != p.second) mutated = true; 1910 1939 new_map.insert({ p.first, new_node }); 1911 1940 } … … 1923 1952 guard_symtab guard { *this }; 1924 1953 auto new_node = p.second->accept( *this ); 1925 if (new_node != p.second) mutated = false;1954 if (new_node != p.second) mutated = true; 1926 1955 new_map.insert({ p.first, new_node }); 1927 1956 }
Note:
See TracChangeset
for help on using the changeset viewer.