Changes in src/AST/Pass.impl.hpp [b0abc8a0:112fe04]
- File:
-
- 1 edited
-
src/AST/Pass.impl.hpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Pass.impl.hpp
rb0abc8a0 r112fe04 841 841 for( const auto & clause : node->clauses ) { 842 842 843 constExpr * func = clause.target.func ? clause.target.func->accept(*this) : nullptr;843 Expr * func = clause.target.func ? clause.target.func->accept(*this) : nullptr; 844 844 if(func != clause.target.func) mutated = true; 845 845 … … 852 852 } 853 853 854 constStmt * stmt = clause.stmt ? clause.stmt->accept(*this) : nullptr;854 Stmt * stmt = clause.stmt ? clause.stmt->accept(*this) : nullptr; 855 855 if(stmt != clause.stmt) mutated = true; 856 856 857 constExpr * cond = clause.cond ? clause.cond->accept(*this) : nullptr;857 Expr * cond = clause.cond ? clause.cond->accept(*this) : nullptr; 858 858 if(cond != clause.cond) mutated = true; 859 859 … … 1567 1567 bool mutated = false; 1568 1568 for( const auto & assoc : node->associations ) { 1569 constType * type = nullptr;1569 Type * type = nullptr; 1570 1570 if( assoc.type ) { 1571 1571 guard_indexer guard { *this }; … … 1573 1573 if( type != assoc.type ) mutated = true; 1574 1574 } 1575 constExpr * expr = nullptr;1575 Expr * expr = nullptr; 1576 1576 if( assoc.expr ) { 1577 1577 expr = assoc.expr->accept( *this ); … … 1685 1685 VISIT_START( node ); 1686 1686 1687 __pass::indexer::addStruct( pass, 0, node->name);1687 __pass::indexer::addStruct( node->name, 0, pass ); 1688 1688 1689 1689 VISIT({ … … 1702 1702 VISIT_START( node ); 1703 1703 1704 __pass::indexer::addStruct( pass, 0, node->name);1704 __pass::indexer::addStruct( node->name, 0, pass ); 1705 1705 1706 1706 { … … 1885 1885 } 1886 1886 1887 // --------------------------------------------------------------------------1888 // TypeSubstitution1889 template< typename pass_t >1890 const ast::TypeSubstitution * ast::Pass< pass_t >::visit( const ast::TypeSubstitution * node ) {1891 VISIT_START( node );1892 1893 VISIT(1894 {1895 bool mutated = false;1896 std::unordered_map< std::string, ast::ptr< ast::Type > > new_map;1897 for ( const auto & p : node->typeEnv ) {1898 guard_indexer guard { *this };1899 auto new_node = p.second->accept( *this );1900 if (new_node != p.second) mutated = false;1901 new_map.insert({ p.first, new_node });1902 }1903 if (mutated) {1904 auto new_node = mutate( node );1905 new_node->typeEnv.swap( new_map );1906 node = new_node;1907 }1908 }1909 1910 {1911 bool mutated = false;1912 std::unordered_map< std::string, ast::ptr< ast::Expr > > new_map;1913 for ( const auto & p : node->varEnv ) {1914 guard_indexer guard { *this };1915 auto new_node = p.second->accept( *this );1916 if (new_node != p.second) mutated = false;1917 new_map.insert({ p.first, new_node });1918 }1919 if (mutated) {1920 auto new_node = mutate( node );1921 new_node->varEnv.swap( new_map );1922 node = new_node;1923 }1924 }1925 )1926 1927 VISIT_END( TypeSubstitution, node );1928 }1887 // //-------------------------------------------------------------------------- 1888 // // TypeSubstitution 1889 // template< typename pass_t > 1890 // const ast::TypeSubstitution * ast::Pass< pass_t >::visit( const ast::TypeSubstitution * node ) { 1891 // VISIT_START( node ); 1892 1893 // VISIT( 1894 // { 1895 // bool mutated = false; 1896 // std::unordered_map< std::string, ast::ptr< ast::Type > > new_map; 1897 // for ( const auto & p : node->typeEnv ) { 1898 // guard_indexer guard { *this }; 1899 // auto new_node = p.second->accept( *this ); 1900 // if (new_node != p.second) mutated = false; 1901 // new_map.insert({ p.first, new_node }); 1902 // } 1903 // if (mutated) { 1904 // auto new_node = mutate( node ); 1905 // new_node->typeEnv.swap( new_map ); 1906 // node = new_node; 1907 // } 1908 // } 1909 1910 // { 1911 // bool mutated = false; 1912 // std::unordered_map< std::string, ast::ptr< ast::Expr > > new_map; 1913 // for ( const auto & p : node->varEnv ) { 1914 // guard_indexer guard { *this }; 1915 // auto new_node = p.second->accept( *this ); 1916 // if (new_node != p.second) mutated = false; 1917 // new_map.insert({ p.first, new_node }); 1918 // } 1919 // if (mutated) { 1920 // auto new_node = mutate( node ); 1921 // new_node->varEnv.swap( new_map ); 1922 // node = new_node; 1923 // } 1924 // } 1925 // ) 1926 1927 // VISIT_END( TypeSubstitution, node ); 1928 // } 1929 1929 1930 1930 #undef VISIT_START
Note:
See TracChangeset
for help on using the changeset viewer.