Changes in src/AST/Pass.impl.hpp [361bf01:3e5dd913]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Pass.impl.hpp
r361bf01 r3e5dd913 367 367 } 368 368 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 clone375 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 mutate382 maybe_accept( node, &node_t::forall );383 }384 }385 369 } 386 370 … … 504 488 __pass::symtab::addId( core, 0, func ); 505 489 VISIT( 506 // parameter declarations are now directly here490 // parameter declarations 507 491 maybe_accept( node, &FunctionDecl::params ); 508 492 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 ); 511 496 // First remember that we are now within a function. 512 497 ValueGuard< bool > oldInFunction( inFunction ); … … 1758 1743 1759 1744 VISIT({ 1760 guard_forall_subs forall_guard { *this, node }; 1761 mutate_forall( node ); 1745 // guard_forall_subs forall_guard { *this, node }; 1746 // mutate_forall( node ); 1747 maybe_accept( node, &FunctionType::assertions ); 1762 1748 maybe_accept( node, &FunctionType::returns ); 1763 1749 maybe_accept( node, &FunctionType::params ); … … 1981 1967 { 1982 1968 bool mutated = false; 1983 std::unordered_map< std::string, ast::ptr< ast::Type > > new_map;1969 std::unordered_map< ast::TypeInstType::TypeEnvKey, ast::ptr< ast::Type > > new_map; 1984 1970 for ( const auto & p : node->typeEnv ) { 1985 1971 guard_symtab guard { *this }; … … 1994 1980 } 1995 1981 } 1996 1997 {1998 bool mutated = false;1999 std::unordered_map< std::string, ast::ptr< ast::Expr > > new_map;2000 for ( const auto & p : node->varEnv ) {2001 guard_symtab guard { *this };2002 auto new_node = p.second->accept( *this );2003 if (new_node != p.second) mutated = true;2004 new_map.insert({ p.first, new_node });2005 }2006 if (mutated) {2007 auto new_node = __pass::mutate<core_t>( node );2008 new_node->varEnv.swap( new_map );2009 node = new_node;2010 }2011 }2012 1982 ) 2013 1983
Note: See TracChangeset
for help on using the changeset viewer.