Ignore:
Timestamp:
Dec 16, 2020, 4:01:57 PM (2 years ago)
Author:
Colby Alexander Parsons <caparsons@…>
Branches:
ADT, arm-eh, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
8ba363e, c8025a21
Parents:
b3c8496 (diff), 3e5dd913 (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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Pass.impl.hpp

    rb3c8496 r53449a4  
    367367        }
    368368
    369 
    370         template< typename core_t >
    371         template< typename node_t >
    372         void ast::Pass< core_t >::mutate_forall( const node_t *& node ) {
    373                 if ( auto subs = __pass::forall::subs( core, 0 ) ) {
    374                         // tracking TypeDecl substitution, full clone
    375                         if ( node->forall.empty() ) return;
    376 
    377                         node_t * mut = __pass::mutate<core_t>( node );
    378                         mut->forall = subs->clone( node->forall, *this );
    379                         node = mut;
    380                 } else {
    381                         // not tracking TypeDecl substitution, just mutate
    382                         maybe_accept( node, &node_t::forall );
    383                 }
    384         }
    385369}
    386370
     
    504488                        __pass::symtab::addId( core, 0, func );
    505489                        VISIT(
    506                                 // parameter declarations are now directly here
     490                                // parameter declarations
    507491                                maybe_accept( node, &FunctionDecl::params );
    508492                                maybe_accept( node, &FunctionDecl::returns );
    509                                 // foralls are still in function type
    510                                 maybe_accept( node, &FunctionDecl::type );
     493                                // type params and assertions
     494                                maybe_accept( node, &FunctionDecl::type_params );
     495                                maybe_accept( node, &FunctionDecl::assertions );
    511496                                // First remember that we are now within a function.
    512497                                ValueGuard< bool > oldInFunction( inFunction );
     
    609594        VISIT({
    610595                guard_symtab guard { *this };
    611                 maybe_accept( node, &TypeDecl::params );
    612596                maybe_accept( node, &TypeDecl::base   );
    613597        })
     
    638622        VISIT({
    639623                guard_symtab guard { *this };
    640                 maybe_accept( node, &TypedefDecl::params );
    641624                maybe_accept( node, &TypedefDecl::base   );
    642625        })
     
    17601743
    17611744        VISIT({
    1762                 guard_forall_subs forall_guard { *this, node };
    1763                 mutate_forall( node );
     1745                // guard_forall_subs forall_guard { *this, node };
     1746                // mutate_forall( node );
     1747                maybe_accept( node, &FunctionType::assertions );
    17641748                maybe_accept( node, &FunctionType::returns );
    17651749                maybe_accept( node, &FunctionType::params  );
     
    17791763        VISIT({
    17801764                guard_symtab guard { *this };
    1781                 guard_forall_subs forall_guard { *this, node };
    1782                 mutate_forall( node );
    17831765                maybe_accept( node, &StructInstType::params );
    17841766        })
     
    17971779        VISIT({
    17981780                guard_symtab guard { *this };
    1799                 guard_forall_subs forall_guard { *this, node };
    1800                 mutate_forall( node );
    18011781                maybe_accept( node, &UnionInstType::params );
    18021782        })
     
    18121792
    18131793        VISIT({
    1814                 guard_forall_subs forall_guard { *this, node };
    1815                 mutate_forall( node );
    18161794                maybe_accept( node, &EnumInstType::params );
    18171795        })
     
    18271805
    18281806        VISIT({
    1829                 guard_forall_subs forall_guard { *this, node };
    1830                 mutate_forall( node );
    18311807                maybe_accept( node, &TraitInstType::params );
    18321808        })
     
    18431819        VISIT(
    18441820                {
    1845                         guard_forall_subs forall_guard { *this, node };
    1846                         mutate_forall( node );
    18471821                        maybe_accept( node, &TypeInstType::params );
    18481822                }
     
    19931967                {
    19941968                        bool mutated = false;
    1995                         std::unordered_map< std::string, ast::ptr< ast::Type > > new_map;
     1969                        std::unordered_map< ast::TypeInstType::TypeEnvKey, ast::ptr< ast::Type > > new_map;
    19961970                        for ( const auto & p : node->typeEnv ) {
    19971971                                guard_symtab guard { *this };
     
    20061980                        }
    20071981                }
    2008 
    2009                 {
    2010                         bool mutated = false;
    2011                         std::unordered_map< std::string, ast::ptr< ast::Expr > > new_map;
    2012                         for ( const auto & p : node->varEnv ) {
    2013                                 guard_symtab guard { *this };
    2014                                 auto new_node = p.second->accept( *this );
    2015                                 if (new_node != p.second) mutated = true;
    2016                                 new_map.insert({ p.first, new_node });
    2017                         }
    2018                         if (mutated) {
    2019                                 auto new_node = __pass::mutate<core_t>( node );
    2020                                 new_node->varEnv.swap( new_map );
    2021                                 node = new_node;
    2022                         }
    2023                 }
    20241982        )
    20251983
Note: See TracChangeset for help on using the changeset viewer.