| [13932f14] | 1 | #pragma once | 
|---|
| [3268a58] | 2 | // IWYU pragma: private, include "PassVisitor.h" | 
|---|
| [13932f14] | 3 |  | 
|---|
| [3c398b6] | 4 | #define VISIT_START( node )                                     \ | 
|---|
|  | 5 | __attribute__((unused))                                   \ | 
|---|
|  | 6 | ChildrenGuard children_guard( get_visit_children_ptr() ); \ | 
|---|
|  | 7 | __attribute__((unused))                                   \ | 
|---|
| [62423350] | 8 | guard_value_impl guard( at_cleanup_impl(pass, 0) );       \ | 
|---|
| [3c398b6] | 9 | call_previsit( node );                                    \ | 
|---|
| [6e09f211] | 10 |  | 
|---|
|  | 11 | #define VISIT_END( node )                       \ | 
|---|
|  | 12 | call_postvisit( node );                   \ | 
|---|
| [9c1600c] | 13 |  | 
|---|
| [3c398b6] | 14 | #define MUTATE_START( node )                                    \ | 
|---|
|  | 15 | __attribute__((unused))                                   \ | 
|---|
|  | 16 | ChildrenGuard children_guard( get_visit_children_ptr() ); \ | 
|---|
|  | 17 | __attribute__((unused))                                   \ | 
|---|
| [62423350] | 18 | guard_value_impl guard( at_cleanup_impl(pass, 0) );       \ | 
|---|
| [3c398b6] | 19 | call_premutate( node );                                   \ | 
|---|
| [296b2be] | 20 |  | 
|---|
|  | 21 | #define MUTATE_END( type, node )                \ | 
|---|
| [6a625de] | 22 | auto __return = call_postmutate< type * >( node ); \ | 
|---|
|  | 23 | assert( __return ); \ | 
|---|
|  | 24 | return __return; | 
|---|
| [296b2be] | 25 |  | 
|---|
|  | 26 |  | 
|---|
| [3c398b6] | 27 | #define VISIT_BODY( node )          \ | 
|---|
|  | 28 | VISIT_START( node );          \ | 
|---|
|  | 29 | if( children_guard ) {        \ | 
|---|
|  | 30 | Visitor::visit( node ); \ | 
|---|
|  | 31 | }                             \ | 
|---|
|  | 32 | VISIT_END( node );            \ | 
|---|
| [13932f14] | 33 |  | 
|---|
| [ab904dc] | 34 |  | 
|---|
| [3c398b6] | 35 | #define MUTATE_BODY( type, node )    \ | 
|---|
|  | 36 | MUTATE_START( node );          \ | 
|---|
|  | 37 | if( children_guard ) {         \ | 
|---|
|  | 38 | Mutator::mutate( node ); \ | 
|---|
|  | 39 | }                              \ | 
|---|
|  | 40 | MUTATE_END( type, node );      \ | 
|---|
| [296b2be] | 41 |  | 
|---|
| [134322e] | 42 |  | 
|---|
|  | 43 |  | 
|---|
|  | 44 | template<typename T> | 
|---|
|  | 45 | static inline bool empty( T * ptr ) { | 
|---|
|  | 46 | return !ptr || ptr->empty(); | 
|---|
|  | 47 | } | 
|---|
|  | 48 |  | 
|---|
| [6ca154b] | 49 | typedef std::list< Statement   * > StmtList_t; | 
|---|
|  | 50 | typedef std::list< Declaration * > DeclList_t; | 
|---|
|  | 51 |  | 
|---|
|  | 52 | template<typename iterator_t> | 
|---|
|  | 53 | static inline void splice( iterator_t it, DeclList_t * decls ) { | 
|---|
|  | 54 | std::transform( | 
|---|
|  | 55 | decls->begin(), | 
|---|
|  | 56 | decls->end(), | 
|---|
|  | 57 | it, | 
|---|
|  | 58 | [](Declaration * decl) -> auto { | 
|---|
| [ba3706f] | 59 | return new DeclStmt( decl ); | 
|---|
| [6ca154b] | 60 | } | 
|---|
|  | 61 | ); | 
|---|
|  | 62 | decls->clear(); | 
|---|
|  | 63 | } | 
|---|
| [134322e] | 64 |  | 
|---|
|  | 65 | template< typename pass_type > | 
|---|
| [07c178f0] | 66 | inline void acceptAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& visitor ) { | 
|---|
| [6ca154b] | 67 | DeclList_t* beforeDecls = visitor.get_beforeDecls(); | 
|---|
|  | 68 | DeclList_t* afterDecls  = visitor.get_afterDecls(); | 
|---|
| [a16764a6] | 69 | SemanticErrorException errors; | 
|---|
| [134322e] | 70 |  | 
|---|
| [675716e] | 71 | pass_visitor_stats.depth++; | 
|---|
|  | 72 | pass_visitor_stats.max->push(pass_visitor_stats.depth); | 
|---|
|  | 73 | pass_visitor_stats.avg->push(pass_visitor_stats.depth); | 
|---|
| [6ca154b] | 74 | for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) { | 
|---|
| [675716e] | 75 |  | 
|---|
|  | 76 |  | 
|---|
| [6ca154b] | 77 | // splice in new declarations after previous decl | 
|---|
| [d24d4e1] | 78 | if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); } | 
|---|
| [6ca154b] | 79 |  | 
|---|
|  | 80 | if ( i == decls.end() ) break; | 
|---|
|  | 81 |  | 
|---|
| [522363e] | 82 | try { | 
|---|
|  | 83 | // run visitor on declaration | 
|---|
| [3c398b6] | 84 | maybeAccept_impl( *i, visitor ); | 
|---|
| [a16764a6] | 85 | } catch( SemanticErrorException &e ) { | 
|---|
| [522363e] | 86 | errors.append( e ); | 
|---|
|  | 87 | } | 
|---|
| [6ca154b] | 88 |  | 
|---|
|  | 89 | // splice in new declarations before current decl | 
|---|
|  | 90 | if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); } | 
|---|
| [134322e] | 91 | } | 
|---|
| [675716e] | 92 | pass_visitor_stats.depth--; | 
|---|
| [522363e] | 93 | if ( ! errors.isEmpty() ) { | 
|---|
|  | 94 | throw errors; | 
|---|
|  | 95 | } | 
|---|
| [6ca154b] | 96 | } | 
|---|
| [134322e] | 97 |  | 
|---|
| [6ca154b] | 98 | template< typename pass_type > | 
|---|
| [07c178f0] | 99 | inline void mutateAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& mutator ) { | 
|---|
| [6ca154b] | 100 | DeclList_t* beforeDecls = mutator.get_beforeDecls(); | 
|---|
|  | 101 | DeclList_t* afterDecls  = mutator.get_afterDecls(); | 
|---|
| [a16764a6] | 102 | SemanticErrorException errors; | 
|---|
| [6ca154b] | 103 |  | 
|---|
| [675716e] | 104 | pass_visitor_stats.depth++; | 
|---|
|  | 105 | pass_visitor_stats.max->push(pass_visitor_stats.depth); | 
|---|
|  | 106 | pass_visitor_stats.avg->push(pass_visitor_stats.depth); | 
|---|
| [6ca154b] | 107 | for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) { | 
|---|
|  | 108 | // splice in new declarations after previous decl | 
|---|
| [d24d4e1] | 109 | if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); } | 
|---|
| [6ca154b] | 110 |  | 
|---|
|  | 111 | if ( i == decls.end() ) break; | 
|---|
| [522363e] | 112 | try { | 
|---|
|  | 113 | // run mutator on declaration | 
|---|
| [3c398b6] | 114 | maybeMutate_impl( *i, mutator ); | 
|---|
| [a16764a6] | 115 | } catch( SemanticErrorException &e ) { | 
|---|
| [522363e] | 116 | errors.append( e ); | 
|---|
|  | 117 | } | 
|---|
| [6ca154b] | 118 |  | 
|---|
|  | 119 | // splice in new declarations before current decl | 
|---|
|  | 120 | if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); } | 
|---|
|  | 121 | } | 
|---|
| [675716e] | 122 | pass_visitor_stats.depth--; | 
|---|
| [522363e] | 123 | if ( ! errors.isEmpty() ) { | 
|---|
|  | 124 | throw errors; | 
|---|
|  | 125 | } | 
|---|
| [134322e] | 126 | } | 
|---|
|  | 127 |  | 
|---|
| [3c398b6] | 128 | template< typename TreeType, typename pass_type > | 
|---|
|  | 129 | inline void maybeAccept_impl( TreeType * tree, PassVisitor< pass_type > & visitor ) { | 
|---|
|  | 130 | if ( ! visitor.get_visit_children() ) return; | 
|---|
|  | 131 | if ( tree ) { | 
|---|
|  | 132 | tree->accept( visitor ); | 
|---|
|  | 133 | } | 
|---|
|  | 134 | } | 
|---|
|  | 135 |  | 
|---|
|  | 136 | template< typename Container, typename pass_type > | 
|---|
|  | 137 | inline void maybeAccept_impl( Container & container, PassVisitor< pass_type > & visitor ) { | 
|---|
|  | 138 | if ( ! visitor.get_visit_children() ) return; | 
|---|
| [a16764a6] | 139 | SemanticErrorException errors; | 
|---|
| [675716e] | 140 |  | 
|---|
|  | 141 | pass_visitor_stats.depth++; | 
|---|
|  | 142 | pass_visitor_stats.max->push(pass_visitor_stats.depth); | 
|---|
|  | 143 | pass_visitor_stats.avg->push(pass_visitor_stats.depth); | 
|---|
| [e0886db] | 144 | for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) { | 
|---|
|  | 145 | try { | 
|---|
|  | 146 | if ( *i ) { | 
|---|
|  | 147 | (*i)->accept( visitor ); | 
|---|
|  | 148 | } | 
|---|
| [a16764a6] | 149 | } catch( SemanticErrorException &e ) { | 
|---|
| [e0886db] | 150 | errors.append( e ); | 
|---|
|  | 151 | } | 
|---|
|  | 152 | } | 
|---|
| [675716e] | 153 | pass_visitor_stats.depth--; | 
|---|
| [e0886db] | 154 | if ( ! errors.isEmpty() ) { | 
|---|
|  | 155 | throw errors; | 
|---|
|  | 156 | } | 
|---|
|  | 157 | } | 
|---|
|  | 158 |  | 
|---|
| [3c398b6] | 159 | template< typename TreeType, typename pass_type > | 
|---|
|  | 160 | inline void maybeMutate_impl( TreeType *& tree, PassVisitor< pass_type > & mutator ) { | 
|---|
|  | 161 | if ( ! mutator.get_visit_children() ) return; | 
|---|
|  | 162 |  | 
|---|
|  | 163 | if ( tree ) { | 
|---|
|  | 164 | tree = strict_dynamic_cast< TreeType * >( tree->acceptMutator( mutator ) ); | 
|---|
|  | 165 | } | 
|---|
|  | 166 | } | 
|---|
|  | 167 |  | 
|---|
|  | 168 | template< typename Container, typename pass_type > | 
|---|
|  | 169 | inline void maybeMutate_impl( Container & container, PassVisitor< pass_type > & mutator ) { | 
|---|
| [37e3af4] | 170 |  | 
|---|
| [3c398b6] | 171 | if ( ! mutator.get_visit_children() ) return; | 
|---|
| [a16764a6] | 172 | SemanticErrorException errors; | 
|---|
| [675716e] | 173 |  | 
|---|
|  | 174 | pass_visitor_stats.depth++; | 
|---|
|  | 175 | pass_visitor_stats.max->push(pass_visitor_stats.depth); | 
|---|
|  | 176 | pass_visitor_stats.avg->push(pass_visitor_stats.depth); | 
|---|
| [e0886db] | 177 | for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) { | 
|---|
|  | 178 | try { | 
|---|
|  | 179 | if ( *i ) { | 
|---|
|  | 180 | *i = dynamic_cast< typename Container::value_type >( (*i)->acceptMutator( mutator ) ); | 
|---|
|  | 181 | assert( *i ); | 
|---|
|  | 182 | } // if | 
|---|
| [a16764a6] | 183 | } catch( SemanticErrorException &e ) { | 
|---|
| [e0886db] | 184 | errors.append( e ); | 
|---|
|  | 185 | } // try | 
|---|
|  | 186 | } // for | 
|---|
| [675716e] | 187 | pass_visitor_stats.depth--; | 
|---|
| [e0886db] | 188 | if ( ! errors.isEmpty() ) { | 
|---|
|  | 189 | throw errors; | 
|---|
|  | 190 | } // if | 
|---|
|  | 191 | } | 
|---|
|  | 192 |  | 
|---|
| [296b2be] | 193 | template< typename pass_type > | 
|---|
| [6ca154b] | 194 | template< typename func_t > | 
|---|
|  | 195 | void PassVisitor< pass_type >::handleStatementList( std::list< Statement * > & statements, func_t func ) { | 
|---|
| [3c398b6] | 196 | if ( ! get_visit_children() ) return; | 
|---|
| [a16764a6] | 197 | SemanticErrorException errors; | 
|---|
| [296b2be] | 198 |  | 
|---|
| [2a7b3ca] | 199 | // don't want statements from outer CompoundStmts to be added to this CompoundStmt | 
|---|
|  | 200 | ValueGuardPtr< StmtList_t > oldBeforeStmts( get_beforeStmts() ); | 
|---|
|  | 201 | ValueGuardPtr< StmtList_t > oldAfterStmts ( get_afterStmts () ); | 
|---|
|  | 202 | ValueGuardPtr< DeclList_t > oldBeforeDecls( get_beforeDecls() ); | 
|---|
|  | 203 | ValueGuardPtr< DeclList_t > oldAfterDecls ( get_afterDecls () ); | 
|---|
|  | 204 |  | 
|---|
| [134322e] | 205 | StmtList_t* beforeStmts = get_beforeStmts(); | 
|---|
|  | 206 | StmtList_t* afterStmts  = get_afterStmts(); | 
|---|
| [6ca154b] | 207 | DeclList_t* beforeDecls = get_beforeDecls(); | 
|---|
|  | 208 | DeclList_t* afterDecls  = get_afterDecls(); | 
|---|
| [134322e] | 209 |  | 
|---|
| [675716e] | 210 | pass_visitor_stats.depth++; | 
|---|
|  | 211 | pass_visitor_stats.max->push(pass_visitor_stats.depth); | 
|---|
|  | 212 | pass_visitor_stats.avg->push(pass_visitor_stats.depth); | 
|---|
| [296b2be] | 213 | for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) { | 
|---|
| [6ca154b] | 214 |  | 
|---|
|  | 215 | if ( !empty( afterDecls ) ) { splice( std::inserter( statements, i ), afterDecls ); } | 
|---|
| [134322e] | 216 | if ( !empty( afterStmts ) ) { statements.splice( i, *afterStmts ); } | 
|---|
| [6ca154b] | 217 |  | 
|---|
| [296b2be] | 218 | try { | 
|---|
| [6ca154b] | 219 | func( *i ); | 
|---|
| [37e3af4] | 220 | assert( *i ); | 
|---|
| [6ca154b] | 221 | assert(( empty( beforeStmts ) && empty( afterStmts )) | 
|---|
|  | 222 | || ( empty( beforeDecls ) && empty( afterDecls )) ); | 
|---|
|  | 223 |  | 
|---|
| [a16764a6] | 224 | } catch ( SemanticErrorException &e ) { | 
|---|
| [296b2be] | 225 | errors.append( e ); | 
|---|
| [134322e] | 226 | } | 
|---|
| [6ca154b] | 227 |  | 
|---|
|  | 228 | if ( !empty( beforeDecls ) ) { splice( std::inserter( statements, i ), beforeDecls ); } | 
|---|
| [134322e] | 229 | if ( !empty( beforeStmts ) ) { statements.splice( i, *beforeStmts ); } | 
|---|
| [296b2be] | 230 | } | 
|---|
| [675716e] | 231 | pass_visitor_stats.depth--; | 
|---|
| [134322e] | 232 |  | 
|---|
| [6ca154b] | 233 | if ( !empty( afterDecls ) ) { splice( std::back_inserter( statements ), afterDecls); } | 
|---|
| [134322e] | 234 | if ( !empty( afterStmts ) ) { statements.splice( statements.end(), *afterStmts ); } | 
|---|
|  | 235 | if ( !errors.isEmpty() ) { throw errors; } | 
|---|
| [296b2be] | 236 | } | 
|---|
|  | 237 |  | 
|---|
|  | 238 | template< typename pass_type > | 
|---|
| [6ca154b] | 239 | void PassVisitor< pass_type >::visitStatementList( std::list< Statement * > & statements ) { | 
|---|
|  | 240 | handleStatementList( statements, [this]( Statement * stmt) { | 
|---|
| [3c398b6] | 241 | maybeAccept_impl( stmt, *this ); | 
|---|
| [6ca154b] | 242 | }); | 
|---|
|  | 243 | } | 
|---|
| [134322e] | 244 |  | 
|---|
| [6ca154b] | 245 | template< typename pass_type > | 
|---|
|  | 246 | void PassVisitor< pass_type >::mutateStatementList( std::list< Statement * > & statements ) { | 
|---|
|  | 247 | handleStatementList( statements, [this]( Statement *& stmt) { | 
|---|
| [3c398b6] | 248 | maybeMutate_impl( stmt, *this ); | 
|---|
| [6ca154b] | 249 | }); | 
|---|
| [134322e] | 250 | } | 
|---|
|  | 251 |  | 
|---|
| [6ca154b] | 252 |  | 
|---|
| [134322e] | 253 | template< typename pass_type > | 
|---|
| [6ca154b] | 254 | template< typename func_t > | 
|---|
|  | 255 | Statement * PassVisitor< pass_type >::handleStatement( Statement * stmt, func_t func ) { | 
|---|
| [3c398b6] | 256 | if ( ! get_visit_children() ) return stmt; | 
|---|
|  | 257 |  | 
|---|
| [134322e] | 258 | // don't want statements from outer CompoundStmts to be added to this CompoundStmt | 
|---|
| [02fdb8e] | 259 | ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type >  oldEnv( get_env_ptr() ); | 
|---|
| [6ca154b] | 260 | ValueGuardPtr< DeclList_t >          oldBeforeDecls( get_beforeDecls() ); | 
|---|
|  | 261 | ValueGuardPtr< DeclList_t >          oldAfterDecls ( get_afterDecls () ); | 
|---|
|  | 262 | ValueGuardPtr< StmtList_t >          oldBeforeStmts( get_beforeStmts() ); | 
|---|
|  | 263 | ValueGuardPtr< StmtList_t >          oldAfterStmts ( get_afterStmts () ); | 
|---|
| [296b2be] | 264 |  | 
|---|
| [6ca154b] | 265 | Statement *newStmt = func( stmt ); | 
|---|
| [134322e] | 266 |  | 
|---|
|  | 267 | StmtList_t* beforeStmts = get_beforeStmts(); | 
|---|
|  | 268 | StmtList_t* afterStmts  = get_afterStmts(); | 
|---|
| [6ca154b] | 269 | DeclList_t* beforeDecls = get_beforeDecls(); | 
|---|
|  | 270 | DeclList_t* afterDecls  = get_afterDecls(); | 
|---|
| [134322e] | 271 |  | 
|---|
| [6ca154b] | 272 | if( empty(beforeStmts) && empty(afterStmts) && empty(beforeDecls) && empty(afterDecls) ) { return newStmt; } | 
|---|
|  | 273 | assert(( empty( beforeStmts ) && empty( afterStmts )) | 
|---|
|  | 274 | || ( empty( beforeDecls ) && empty( afterDecls )) ); | 
|---|
| [134322e] | 275 |  | 
|---|
| [ba3706f] | 276 | CompoundStmt *compound = new CompoundStmt(); | 
|---|
| [6ca154b] | 277 | if( !empty(beforeDecls) ) { splice( std::back_inserter( compound->get_kids() ), beforeDecls ); } | 
|---|
| [134322e] | 278 | if( !empty(beforeStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *beforeStmts ); } | 
|---|
|  | 279 | compound->get_kids().push_back( newStmt ); | 
|---|
| [6ca154b] | 280 | if( !empty(afterDecls) ) { splice( std::back_inserter( compound->get_kids() ), afterDecls ); } | 
|---|
| [134322e] | 281 | if( !empty(afterStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *afterStmts ); } | 
|---|
|  | 282 | return compound; | 
|---|
|  | 283 | } | 
|---|
|  | 284 |  | 
|---|
|  | 285 | template< typename pass_type > | 
|---|
| [6ca154b] | 286 | Statement * PassVisitor< pass_type >::visitStatement( Statement * stmt ) { | 
|---|
|  | 287 | return handleStatement( stmt, [this]( Statement * stmt ) { | 
|---|
| [3c398b6] | 288 | maybeAccept_impl( stmt, *this ); | 
|---|
| [6ca154b] | 289 | return stmt; | 
|---|
|  | 290 | }); | 
|---|
|  | 291 | } | 
|---|
| [134322e] | 292 |  | 
|---|
| [6ca154b] | 293 | template< typename pass_type > | 
|---|
|  | 294 | Statement * PassVisitor< pass_type >::mutateStatement( Statement * stmt ) { | 
|---|
|  | 295 | return handleStatement( stmt, [this]( Statement * stmt ) { | 
|---|
| [3c398b6] | 296 | maybeMutate_impl( stmt, *this ); | 
|---|
|  | 297 | return stmt; | 
|---|
| [6ca154b] | 298 | }); | 
|---|
| [296b2be] | 299 | } | 
|---|
|  | 300 |  | 
|---|
|  | 301 | template< typename pass_type > | 
|---|
| [6ca154b] | 302 | template< typename func_t > | 
|---|
|  | 303 | Expression * PassVisitor< pass_type >::handleExpression( Expression * expr, func_t func ) { | 
|---|
| [3c398b6] | 304 | if ( ! get_visit_children() ) return expr; | 
|---|
| [296b2be] | 305 | if( !expr ) return nullptr; | 
|---|
|  | 306 |  | 
|---|
| [134322e] | 307 | auto env_ptr = get_env_ptr(); | 
|---|
|  | 308 | if ( env_ptr && expr->get_env() ) { | 
|---|
|  | 309 | *env_ptr = expr->get_env(); | 
|---|
| [296b2be] | 310 | } | 
|---|
| [6ca154b] | 311 |  | 
|---|
| [3c398b6] | 312 | // should env be moved onto the result of the mutate? | 
|---|
| [6ca154b] | 313 | return func( expr ); | 
|---|
|  | 314 | } | 
|---|
|  | 315 |  | 
|---|
|  | 316 | template< typename pass_type > | 
|---|
|  | 317 | Expression * PassVisitor< pass_type >::visitExpression( Expression * expr ) { | 
|---|
|  | 318 | return handleExpression(expr, [this]( Expression * expr ) { | 
|---|
| [3c398b6] | 319 | maybeAccept_impl( expr, *this ); | 
|---|
| [6ca154b] | 320 | return expr; | 
|---|
| [d24d4e1] | 321 | }); | 
|---|
| [296b2be] | 322 | } | 
|---|
| [ab904dc] | 323 |  | 
|---|
| [6ca154b] | 324 | template< typename pass_type > | 
|---|
|  | 325 | Expression * PassVisitor< pass_type >::mutateExpression( Expression * expr ) { | 
|---|
|  | 326 | return handleExpression(expr, [this]( Expression * expr ) { | 
|---|
| [3c398b6] | 327 | maybeMutate_impl( expr, *this ); | 
|---|
|  | 328 | return expr; | 
|---|
| [6ca154b] | 329 | }); | 
|---|
|  | 330 | } | 
|---|
| [ab904dc] | 331 |  | 
|---|
| [3c398b6] | 332 | template< typename TreeType, typename VisitorType > | 
|---|
|  | 333 | inline void indexerScopedAccept( TreeType * tree, VisitorType & visitor ) { | 
|---|
|  | 334 | if ( ! visitor.get_visit_children() ) return; | 
|---|
|  | 335 | auto guard = makeFuncGuard( | 
|---|
|  | 336 | [&visitor]() { visitor.indexerScopeEnter(); }, | 
|---|
|  | 337 | [&visitor]() { visitor.indexerScopeLeave(); } | 
|---|
|  | 338 | ); | 
|---|
|  | 339 | maybeAccept_impl( tree, visitor ); | 
|---|
|  | 340 | } | 
|---|
|  | 341 |  | 
|---|
|  | 342 | template< typename TreeType, typename MutatorType > | 
|---|
|  | 343 | inline void indexerScopedMutate( TreeType *& tree, MutatorType & mutator ) { | 
|---|
|  | 344 | if ( ! mutator.get_visit_children() ) return; | 
|---|
|  | 345 | auto guard = makeFuncGuard( | 
|---|
|  | 346 | [&mutator]() { mutator.indexerScopeEnter(); }, | 
|---|
|  | 347 | [&mutator]() { mutator.indexerScopeLeave(); } | 
|---|
|  | 348 | ); | 
|---|
|  | 349 | maybeMutate_impl( tree, mutator ); | 
|---|
|  | 350 | } | 
|---|
|  | 351 |  | 
|---|
| [296b2be] | 352 | //------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | 
|---|
| [e0886db] | 353 | //======================================================================================================================================================================== | 
|---|
|  | 354 | //======================================================================================================================================================================== | 
|---|
|  | 355 | //======================================================================================================================================================================== | 
|---|
|  | 356 | //======================================================================================================================================================================== | 
|---|
|  | 357 | //======================================================================================================================================================================== | 
|---|
|  | 358 | //------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | 
|---|
| [13932f14] | 359 |  | 
|---|
| [33a25f9] | 360 | // A NOTE ON THE ORDER OF TRAVERSAL | 
|---|
|  | 361 | // | 
|---|
|  | 362 | // Types and typedefs have their base types visited before they are added to the type table.  This is ok, since there is | 
|---|
|  | 363 | // no such thing as a recursive type or typedef. | 
|---|
|  | 364 | // | 
|---|
|  | 365 | //             typedef struct { T *x; } T; // never allowed | 
|---|
|  | 366 | // | 
|---|
|  | 367 | // for structs/unions, it is possible to have recursion, so the decl should be added as if it's incomplete to begin, the | 
|---|
|  | 368 | // members are traversed, and then the complete type should be added (assuming the type is completed by this particular | 
|---|
|  | 369 | // declaration). | 
|---|
|  | 370 | // | 
|---|
|  | 371 | //             struct T { struct T *x; }; // allowed | 
|---|
|  | 372 | // | 
|---|
|  | 373 | // It is important to add the complete type to the symbol table *after* the members/base has been traversed, since that | 
|---|
|  | 374 | // traversal may modify the definition of the type and these modifications should be visible when the symbol table is | 
|---|
|  | 375 | // queried later in this pass. | 
|---|
|  | 376 | // | 
|---|
|  | 377 | // TODO: figure out whether recursive contexts are sensible/possible/reasonable. | 
|---|
| [e0886db] | 378 |  | 
|---|
|  | 379 | //-------------------------------------------------------------------------- | 
|---|
|  | 380 | // ObjectDecl | 
|---|
| [13932f14] | 381 | template< typename pass_type > | 
|---|
| [ab904dc] | 382 | void PassVisitor< pass_type >::visit( ObjectDecl * node ) { | 
|---|
| [e0886db] | 383 | VISIT_START( node ); | 
|---|
|  | 384 |  | 
|---|
|  | 385 | indexerScopedAccept( node->type         , *this ); | 
|---|
| [3c398b6] | 386 | maybeAccept_impl   ( node->init         , *this ); | 
|---|
|  | 387 | maybeAccept_impl   ( node->bitfieldWidth, *this ); | 
|---|
|  | 388 | maybeAccept_impl   ( node->attributes   , *this ); | 
|---|
| [e0886db] | 389 |  | 
|---|
| [2cb70aa] | 390 | indexerAddId( node ); | 
|---|
| [e0886db] | 391 |  | 
|---|
|  | 392 | VISIT_END( node ); | 
|---|
|  | 393 | } | 
|---|
|  | 394 |  | 
|---|
|  | 395 | template< typename pass_type > | 
|---|
|  | 396 | DeclarationWithType * PassVisitor< pass_type >::mutate( ObjectDecl * node ) { | 
|---|
|  | 397 | MUTATE_START( node ); | 
|---|
|  | 398 |  | 
|---|
|  | 399 | indexerScopedMutate( node->type         , *this ); | 
|---|
| [3c398b6] | 400 | maybeMutate_impl   ( node->init         , *this ); | 
|---|
|  | 401 | maybeMutate_impl   ( node->bitfieldWidth, *this ); | 
|---|
|  | 402 | maybeMutate_impl   ( node->attributes   , *this ); | 
|---|
| [e0886db] | 403 |  | 
|---|
| [2cb70aa] | 404 | indexerAddId( node ); | 
|---|
| [e0886db] | 405 |  | 
|---|
|  | 406 | MUTATE_END( DeclarationWithType, node ); | 
|---|
| [13932f14] | 407 | } | 
|---|
|  | 408 |  | 
|---|
| [e0886db] | 409 | //-------------------------------------------------------------------------- | 
|---|
|  | 410 | // FunctionDecl | 
|---|
| [13932f14] | 411 | template< typename pass_type > | 
|---|
| [ab904dc] | 412 | void PassVisitor< pass_type >::visit( FunctionDecl * node ) { | 
|---|
| [e0886db] | 413 | VISIT_START( node ); | 
|---|
|  | 414 |  | 
|---|
| [2cb70aa] | 415 | indexerAddId( node ); | 
|---|
| [e0886db] | 416 |  | 
|---|
| [7aaec67] | 417 | maybeAccept_impl( node->withExprs, *this ); | 
|---|
| [e0886db] | 418 | { | 
|---|
| [2cb70aa] | 419 | // with clause introduces a level of scope (for the with expression members). | 
|---|
|  | 420 | // with clause exprs are added to the indexer before parameters so that parameters | 
|---|
|  | 421 | // shadow with exprs and not the other way around. | 
|---|
| [e0886db] | 422 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [0ac366b] | 423 | indexerAddWith( node->withExprs, node ); | 
|---|
| [7aaec67] | 424 | { | 
|---|
|  | 425 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
|  | 426 | // implicit add __func__ identifier as specified in the C manual 6.4.2.2 | 
|---|
|  | 427 | static ObjectDecl func( | 
|---|
|  | 428 | "__func__", noStorageClasses, LinkageSpec::C, nullptr, | 
|---|
|  | 429 | new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ), | 
|---|
|  | 430 | nullptr | 
|---|
|  | 431 | ); | 
|---|
|  | 432 | indexerAddId( &func ); | 
|---|
|  | 433 | maybeAccept_impl( node->type, *this ); | 
|---|
| [61d9b4b] | 434 | // function body needs to have the same scope as parameters - CompoundStmt will not enter | 
|---|
|  | 435 | // a new scope if inFunction is true | 
|---|
|  | 436 | ValueGuard< bool > oldInFunction( inFunction ); | 
|---|
|  | 437 | inFunction = true; | 
|---|
| [7aaec67] | 438 | maybeAccept_impl( node->statements, *this ); | 
|---|
|  | 439 | maybeAccept_impl( node->attributes, *this ); | 
|---|
|  | 440 | } | 
|---|
| [e0886db] | 441 | } | 
|---|
|  | 442 |  | 
|---|
|  | 443 | VISIT_END( node ); | 
|---|
|  | 444 | } | 
|---|
|  | 445 |  | 
|---|
|  | 446 | template< typename pass_type > | 
|---|
|  | 447 | DeclarationWithType * PassVisitor< pass_type >::mutate( FunctionDecl * node ) { | 
|---|
|  | 448 | MUTATE_START( node ); | 
|---|
|  | 449 |  | 
|---|
| [2cb70aa] | 450 | indexerAddId( node ); | 
|---|
| [e0886db] | 451 |  | 
|---|
|  | 452 | { | 
|---|
| [2cb70aa] | 453 | // with clause introduces a level of scope (for the with expression members). | 
|---|
|  | 454 | // with clause exprs are added to the indexer before parameters so that parameters | 
|---|
|  | 455 | // shadow with exprs and not the other way around. | 
|---|
| [e0886db] | 456 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [0ac366b] | 457 | indexerAddWith( node->withExprs, node ); | 
|---|
| [7aaec67] | 458 | { | 
|---|
|  | 459 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
|  | 460 | // implicit add __func__ identifier as specified in the C manual 6.4.2.2 | 
|---|
|  | 461 | static ObjectDecl func( | 
|---|
|  | 462 | "__func__", noStorageClasses, LinkageSpec::C, nullptr, | 
|---|
|  | 463 | new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ), | 
|---|
|  | 464 | nullptr | 
|---|
|  | 465 | ); | 
|---|
|  | 466 | indexerAddId( &func ); | 
|---|
|  | 467 | maybeMutate_impl( node->type, *this ); | 
|---|
| [61d9b4b] | 468 | // function body needs to have the same scope as parameters - CompoundStmt will not enter | 
|---|
|  | 469 | // a new scope if inFunction is true | 
|---|
|  | 470 | ValueGuard< bool > oldInFunction( inFunction ); | 
|---|
|  | 471 | inFunction = true; | 
|---|
| [7aaec67] | 472 | maybeMutate_impl( node->statements, *this ); | 
|---|
|  | 473 | maybeMutate_impl( node->attributes, *this ); | 
|---|
|  | 474 | } | 
|---|
| [e0886db] | 475 | } | 
|---|
|  | 476 |  | 
|---|
|  | 477 | MUTATE_END( DeclarationWithType, node ); | 
|---|
| [13932f14] | 478 | } | 
|---|
|  | 479 |  | 
|---|
| [e0886db] | 480 | //-------------------------------------------------------------------------- | 
|---|
|  | 481 | // StructDecl | 
|---|
| [13932f14] | 482 | template< typename pass_type > | 
|---|
| [ab904dc] | 483 | void PassVisitor< pass_type >::visit( StructDecl * node ) { | 
|---|
| [e0886db] | 484 | VISIT_START( node ); | 
|---|
|  | 485 |  | 
|---|
|  | 486 | // make up a forward declaration and add it before processing the members | 
|---|
|  | 487 | // needs to be on the heap because addStruct saves the pointer | 
|---|
|  | 488 | indexerAddStructFwd( node ); | 
|---|
|  | 489 |  | 
|---|
|  | 490 | { | 
|---|
|  | 491 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [3c398b6] | 492 | maybeAccept_impl( node->parameters, *this ); | 
|---|
|  | 493 | maybeAccept_impl( node->members   , *this ); | 
|---|
| [e0886db] | 494 | } | 
|---|
|  | 495 |  | 
|---|
|  | 496 | // this addition replaces the forward declaration | 
|---|
|  | 497 | indexerAddStruct( node ); | 
|---|
|  | 498 |  | 
|---|
|  | 499 | VISIT_END( node ); | 
|---|
|  | 500 | } | 
|---|
|  | 501 |  | 
|---|
|  | 502 | template< typename pass_type > | 
|---|
|  | 503 | Declaration * PassVisitor< pass_type >::mutate( StructDecl * node ) { | 
|---|
|  | 504 | MUTATE_START( node ); | 
|---|
|  | 505 |  | 
|---|
|  | 506 | // make up a forward declaration and add it before processing the members | 
|---|
|  | 507 | // needs to be on the heap because addStruct saves the pointer | 
|---|
|  | 508 | indexerAddStructFwd( node ); | 
|---|
|  | 509 |  | 
|---|
|  | 510 | { | 
|---|
|  | 511 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [3c398b6] | 512 | maybeMutate_impl( node->parameters, *this ); | 
|---|
|  | 513 | maybeMutate_impl( node->members   , *this ); | 
|---|
| [e0886db] | 514 | } | 
|---|
|  | 515 |  | 
|---|
|  | 516 | // this addition replaces the forward declaration | 
|---|
|  | 517 | indexerAddStruct( node ); | 
|---|
|  | 518 |  | 
|---|
|  | 519 | MUTATE_END( Declaration, node ); | 
|---|
| [13932f14] | 520 | } | 
|---|
|  | 521 |  | 
|---|
| [e0886db] | 522 | //-------------------------------------------------------------------------- | 
|---|
|  | 523 | // UnionDecl | 
|---|
| [13932f14] | 524 | template< typename pass_type > | 
|---|
| [ab904dc] | 525 | void PassVisitor< pass_type >::visit( UnionDecl * node ) { | 
|---|
| [e0886db] | 526 | VISIT_START( node ); | 
|---|
|  | 527 |  | 
|---|
|  | 528 | // make up a forward declaration and add it before processing the members | 
|---|
|  | 529 | indexerAddUnionFwd( node ); | 
|---|
|  | 530 |  | 
|---|
|  | 531 | { | 
|---|
|  | 532 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [3c398b6] | 533 | maybeAccept_impl( node->parameters, *this ); | 
|---|
|  | 534 | maybeAccept_impl( node->members   , *this ); | 
|---|
| [e0886db] | 535 | } | 
|---|
|  | 536 |  | 
|---|
|  | 537 | indexerAddUnion( node ); | 
|---|
|  | 538 |  | 
|---|
|  | 539 | VISIT_END( node ); | 
|---|
|  | 540 | } | 
|---|
|  | 541 |  | 
|---|
|  | 542 | template< typename pass_type > | 
|---|
|  | 543 | Declaration * PassVisitor< pass_type >::mutate( UnionDecl * node ) { | 
|---|
|  | 544 | MUTATE_START( node ); | 
|---|
|  | 545 |  | 
|---|
|  | 546 | // make up a forward declaration and add it before processing the members | 
|---|
|  | 547 | indexerAddUnionFwd( node ); | 
|---|
|  | 548 |  | 
|---|
|  | 549 | { | 
|---|
|  | 550 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [3c398b6] | 551 | maybeMutate_impl( node->parameters, *this ); | 
|---|
|  | 552 | maybeMutate_impl( node->members   , *this ); | 
|---|
| [e0886db] | 553 | } | 
|---|
|  | 554 |  | 
|---|
|  | 555 | indexerAddUnion( node ); | 
|---|
|  | 556 |  | 
|---|
|  | 557 | MUTATE_END( Declaration, node ); | 
|---|
| [13932f14] | 558 | } | 
|---|
|  | 559 |  | 
|---|
| [e0886db] | 560 | //-------------------------------------------------------------------------- | 
|---|
|  | 561 | // EnumDecl | 
|---|
| [13932f14] | 562 | template< typename pass_type > | 
|---|
| [ab904dc] | 563 | void PassVisitor< pass_type >::visit( EnumDecl * node ) { | 
|---|
| [e0886db] | 564 | VISIT_START( node ); | 
|---|
|  | 565 |  | 
|---|
|  | 566 | indexerAddEnum( node ); | 
|---|
|  | 567 |  | 
|---|
| [33a25f9] | 568 | // unlike structs, traits, and unions, enums inject their members into the global scope | 
|---|
| [3c398b6] | 569 | maybeAccept_impl( node->parameters, *this ); | 
|---|
|  | 570 | maybeAccept_impl( node->members   , *this ); | 
|---|
| [e0886db] | 571 |  | 
|---|
|  | 572 | VISIT_END( node ); | 
|---|
| [13932f14] | 573 | } | 
|---|
|  | 574 |  | 
|---|
| [e0886db] | 575 | template< typename pass_type > | 
|---|
|  | 576 | Declaration * PassVisitor< pass_type >::mutate( EnumDecl * node ) { | 
|---|
|  | 577 | MUTATE_START( node ); | 
|---|
|  | 578 |  | 
|---|
|  | 579 | indexerAddEnum( node ); | 
|---|
|  | 580 |  | 
|---|
| [522363e] | 581 | // unlike structs, traits, and unions, enums inject their members into the global scope | 
|---|
| [3c398b6] | 582 | maybeMutate_impl( node->parameters, *this ); | 
|---|
|  | 583 | maybeMutate_impl( node->members   , *this ); | 
|---|
| [e0886db] | 584 |  | 
|---|
|  | 585 | MUTATE_END( Declaration, node ); | 
|---|
|  | 586 | } | 
|---|
|  | 587 |  | 
|---|
|  | 588 | //-------------------------------------------------------------------------- | 
|---|
|  | 589 | // TraitDecl | 
|---|
| [13932f14] | 590 | template< typename pass_type > | 
|---|
| [ab904dc] | 591 | void PassVisitor< pass_type >::visit( TraitDecl * node ) { | 
|---|
| [e0886db] | 592 | VISIT_START( node ); | 
|---|
|  | 593 |  | 
|---|
|  | 594 | { | 
|---|
|  | 595 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [3c398b6] | 596 | maybeAccept_impl( node->parameters, *this ); | 
|---|
|  | 597 | maybeAccept_impl( node->members   , *this ); | 
|---|
| [e0886db] | 598 | } | 
|---|
|  | 599 |  | 
|---|
|  | 600 | indexerAddTrait( node ); | 
|---|
|  | 601 |  | 
|---|
|  | 602 | VISIT_END( node ); | 
|---|
| [13932f14] | 603 | } | 
|---|
|  | 604 |  | 
|---|
| [e0886db] | 605 | template< typename pass_type > | 
|---|
|  | 606 | Declaration * PassVisitor< pass_type >::mutate( TraitDecl * node ) { | 
|---|
|  | 607 | MUTATE_START( node ); | 
|---|
|  | 608 |  | 
|---|
|  | 609 | { | 
|---|
|  | 610 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [3c398b6] | 611 | maybeMutate_impl( node->parameters, *this ); | 
|---|
|  | 612 | maybeMutate_impl( node->members   , *this ); | 
|---|
| [e0886db] | 613 | } | 
|---|
|  | 614 |  | 
|---|
|  | 615 | indexerAddTrait( node ); | 
|---|
|  | 616 |  | 
|---|
|  | 617 | MUTATE_END( Declaration, node ); | 
|---|
|  | 618 | } | 
|---|
|  | 619 |  | 
|---|
|  | 620 | //-------------------------------------------------------------------------- | 
|---|
|  | 621 | // TypeDecl | 
|---|
| [13932f14] | 622 | template< typename pass_type > | 
|---|
| [ab904dc] | 623 | void PassVisitor< pass_type >::visit( TypeDecl * node ) { | 
|---|
| [e0886db] | 624 | VISIT_START( node ); | 
|---|
|  | 625 |  | 
|---|
|  | 626 | { | 
|---|
|  | 627 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [3c398b6] | 628 | maybeAccept_impl( node->parameters, *this ); | 
|---|
|  | 629 | maybeAccept_impl( node->base      , *this ); | 
|---|
| [e0886db] | 630 | } | 
|---|
|  | 631 |  | 
|---|
| [33a25f9] | 632 | // see A NOTE ON THE ORDER OF TRAVERSAL, above | 
|---|
|  | 633 | // note that assertions come after the type is added to the symtab, since they are not part of the type proper | 
|---|
|  | 634 | // and may depend on the type itself | 
|---|
| [e0886db] | 635 | indexerAddType( node ); | 
|---|
|  | 636 |  | 
|---|
| [3c398b6] | 637 | maybeAccept_impl( node->assertions, *this ); | 
|---|
| [e0886db] | 638 |  | 
|---|
|  | 639 | indexerScopedAccept( node->init, *this ); | 
|---|
|  | 640 |  | 
|---|
|  | 641 | VISIT_END( node ); | 
|---|
|  | 642 | } | 
|---|
|  | 643 |  | 
|---|
|  | 644 | template< typename pass_type > | 
|---|
| [982832e] | 645 | Declaration * PassVisitor< pass_type >::mutate( TypeDecl * node ) { | 
|---|
| [e0886db] | 646 | MUTATE_START( node ); | 
|---|
|  | 647 |  | 
|---|
|  | 648 | { | 
|---|
|  | 649 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [3c398b6] | 650 | maybeMutate_impl( node->parameters, *this ); | 
|---|
|  | 651 | maybeMutate_impl( node->base      , *this ); | 
|---|
| [e0886db] | 652 | } | 
|---|
|  | 653 |  | 
|---|
| [33a25f9] | 654 | // see A NOTE ON THE ORDER OF TRAVERSAL, above | 
|---|
|  | 655 | // note that assertions come after the type is added to the symtab, since they are not part of the type proper | 
|---|
|  | 656 | // and may depend on the type itself | 
|---|
| [e0886db] | 657 | indexerAddType( node ); | 
|---|
|  | 658 |  | 
|---|
| [3c398b6] | 659 | maybeMutate_impl( node->assertions, *this ); | 
|---|
| [e0886db] | 660 |  | 
|---|
|  | 661 | indexerScopedMutate( node->init, *this ); | 
|---|
|  | 662 |  | 
|---|
| [982832e] | 663 | MUTATE_END( Declaration, node ); | 
|---|
| [13932f14] | 664 | } | 
|---|
|  | 665 |  | 
|---|
| [e0886db] | 666 | //-------------------------------------------------------------------------- | 
|---|
|  | 667 | // TypedefDecl | 
|---|
| [13932f14] | 668 | template< typename pass_type > | 
|---|
| [ab904dc] | 669 | void PassVisitor< pass_type >::visit( TypedefDecl * node ) { | 
|---|
| [e0886db] | 670 | VISIT_START( node ); | 
|---|
|  | 671 |  | 
|---|
|  | 672 | { | 
|---|
|  | 673 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [3c398b6] | 674 | maybeAccept_impl( node->parameters, *this ); | 
|---|
|  | 675 | maybeAccept_impl( node->base      , *this ); | 
|---|
| [e0886db] | 676 | } | 
|---|
|  | 677 |  | 
|---|
|  | 678 | indexerAddType( node ); | 
|---|
|  | 679 |  | 
|---|
| [3c398b6] | 680 | maybeAccept_impl( node->assertions, *this ); | 
|---|
| [e0886db] | 681 |  | 
|---|
|  | 682 | VISIT_END( node ); | 
|---|
| [13932f14] | 683 | } | 
|---|
|  | 684 |  | 
|---|
|  | 685 | template< typename pass_type > | 
|---|
| [e0886db] | 686 | Declaration * PassVisitor< pass_type >::mutate( TypedefDecl * node ) { | 
|---|
|  | 687 | MUTATE_START( node ); | 
|---|
|  | 688 |  | 
|---|
|  | 689 | { | 
|---|
|  | 690 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [3c398b6] | 691 | maybeMutate_impl( node->parameters, *this ); | 
|---|
|  | 692 | maybeMutate_impl( node->base      , *this ); | 
|---|
| [e0886db] | 693 | } | 
|---|
|  | 694 |  | 
|---|
|  | 695 | indexerAddType( node ); | 
|---|
|  | 696 |  | 
|---|
| [3c398b6] | 697 | maybeMutate_impl( node->assertions, *this ); | 
|---|
| [e0886db] | 698 |  | 
|---|
|  | 699 | MUTATE_END( Declaration, node ); | 
|---|
| [13932f14] | 700 | } | 
|---|
|  | 701 |  | 
|---|
| [9c1600c] | 702 | //-------------------------------------------------------------------------- | 
|---|
| [e0886db] | 703 | // AsmDecl | 
|---|
| [13932f14] | 704 | template< typename pass_type > | 
|---|
| [e0886db] | 705 | void PassVisitor< pass_type >::visit( AsmDecl * node ) { | 
|---|
| [9c1600c] | 706 | VISIT_START( node ); | 
|---|
|  | 707 |  | 
|---|
| [3c398b6] | 708 | maybeAccept_impl( node->stmt, *this ); | 
|---|
| [9c1600c] | 709 |  | 
|---|
|  | 710 | VISIT_END( node ); | 
|---|
| [13932f14] | 711 | } | 
|---|
|  | 712 |  | 
|---|
| [296b2be] | 713 | template< typename pass_type > | 
|---|
| [e0886db] | 714 | AsmDecl * PassVisitor< pass_type >::mutate( AsmDecl * node ) { | 
|---|
| [296b2be] | 715 | MUTATE_START( node ); | 
|---|
|  | 716 |  | 
|---|
| [3c398b6] | 717 | maybeMutate_impl( node->stmt, *this ); | 
|---|
| [e0886db] | 718 |  | 
|---|
|  | 719 | MUTATE_END( AsmDecl, node ); | 
|---|
|  | 720 | } | 
|---|
|  | 721 |  | 
|---|
| [f6e3e34] | 722 | //-------------------------------------------------------------------------- | 
|---|
|  | 723 | // StaticAssertDecl | 
|---|
|  | 724 | template< typename pass_type > | 
|---|
|  | 725 | void PassVisitor< pass_type >::visit( StaticAssertDecl * node ) { | 
|---|
|  | 726 | VISIT_START( node ); | 
|---|
|  | 727 |  | 
|---|
| [842c3d3] | 728 | node->condition = visitExpression( node->condition ); | 
|---|
|  | 729 | maybeAccept_impl( node->message, *this ); | 
|---|
| [f6e3e34] | 730 |  | 
|---|
|  | 731 | VISIT_END( node ); | 
|---|
|  | 732 | } | 
|---|
|  | 733 |  | 
|---|
|  | 734 | template< typename pass_type > | 
|---|
|  | 735 | StaticAssertDecl * PassVisitor< pass_type >::mutate( StaticAssertDecl * node ) { | 
|---|
|  | 736 | MUTATE_START( node ); | 
|---|
|  | 737 |  | 
|---|
| [842c3d3] | 738 | node->condition = mutateExpression( node->condition ); | 
|---|
|  | 739 | maybeMutate_impl( node->message, *this ); | 
|---|
| [f6e3e34] | 740 |  | 
|---|
|  | 741 | MUTATE_END( StaticAssertDecl, node ); | 
|---|
|  | 742 | } | 
|---|
|  | 743 |  | 
|---|
| [e0886db] | 744 | //-------------------------------------------------------------------------- | 
|---|
|  | 745 | // CompoundStmt | 
|---|
|  | 746 | template< typename pass_type > | 
|---|
|  | 747 | void PassVisitor< pass_type >::visit( CompoundStmt * node ) { | 
|---|
|  | 748 | VISIT_START( node ); | 
|---|
|  | 749 | { | 
|---|
| [61d9b4b] | 750 | // do not enter a new scope if inFunction is true - needs to check old state before the assignment | 
|---|
|  | 751 | ValueGuard< bool > oldInFunction( inFunction ); | 
|---|
|  | 752 | auto guard1 = makeFuncGuard( [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeEnter(); }, [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeLeave(); } ); | 
|---|
| [e0886db] | 753 | auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } ); | 
|---|
| [61d9b4b] | 754 | inFunction = false; | 
|---|
| [e0886db] | 755 | visitStatementList( node->kids ); | 
|---|
|  | 756 | } | 
|---|
|  | 757 | VISIT_END( node ); | 
|---|
|  | 758 | } | 
|---|
| [296b2be] | 759 |  | 
|---|
| [e0886db] | 760 | template< typename pass_type > | 
|---|
|  | 761 | CompoundStmt * PassVisitor< pass_type >::mutate( CompoundStmt * node ) { | 
|---|
|  | 762 | MUTATE_START( node ); | 
|---|
|  | 763 | { | 
|---|
| [61d9b4b] | 764 | // do not enter a new scope if inFunction is true - needs to check old state before the assignment | 
|---|
|  | 765 | ValueGuard< bool > oldInFunction( inFunction ); | 
|---|
|  | 766 | auto guard1 = makeFuncGuard( [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeEnter(); }, [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeLeave(); } ); | 
|---|
| [e0886db] | 767 | auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } ); | 
|---|
| [61d9b4b] | 768 | inFunction = false; | 
|---|
| [e0886db] | 769 | mutateStatementList( node->kids ); | 
|---|
|  | 770 | } | 
|---|
| [296b2be] | 771 | MUTATE_END( CompoundStmt, node ); | 
|---|
|  | 772 | } | 
|---|
|  | 773 |  | 
|---|
| [9c1600c] | 774 | //-------------------------------------------------------------------------- | 
|---|
|  | 775 | // ExprStmt | 
|---|
| [13932f14] | 776 | template< typename pass_type > | 
|---|
| [ab904dc] | 777 | void PassVisitor< pass_type >::visit( ExprStmt * node ) { | 
|---|
| [9c1600c] | 778 | VISIT_START( node ); | 
|---|
|  | 779 |  | 
|---|
| [e0886db] | 780 | visitExpression( node->expr ); | 
|---|
| [9c1600c] | 781 |  | 
|---|
|  | 782 | VISIT_END( node ); | 
|---|
| [13932f14] | 783 | } | 
|---|
|  | 784 |  | 
|---|
| [296b2be] | 785 | template< typename pass_type > | 
|---|
|  | 786 | Statement * PassVisitor< pass_type >::mutate( ExprStmt * node ) { | 
|---|
|  | 787 | MUTATE_START( node ); | 
|---|
|  | 788 |  | 
|---|
| [e0886db] | 789 | node->expr = mutateExpression( node->expr ); | 
|---|
| [296b2be] | 790 |  | 
|---|
|  | 791 | MUTATE_END( Statement, node ); | 
|---|
|  | 792 | } | 
|---|
|  | 793 |  | 
|---|
| [6ca154b] | 794 | //-------------------------------------------------------------------------- | 
|---|
|  | 795 | // AsmStmt | 
|---|
| [13932f14] | 796 | template< typename pass_type > | 
|---|
| [ab904dc] | 797 | void PassVisitor< pass_type >::visit( AsmStmt * node ) { | 
|---|
| [bc6f918] | 798 | VISIT_START( node ) | 
|---|
|  | 799 |  | 
|---|
|  | 800 | maybeAccept_impl( node->instruction, *this ); | 
|---|
|  | 801 | maybeAccept_impl( node->output, *this ); | 
|---|
|  | 802 | maybeAccept_impl( node->input, *this ); | 
|---|
|  | 803 | maybeAccept_impl( node->clobber, *this ); | 
|---|
|  | 804 |  | 
|---|
|  | 805 | VISIT_END( node ); | 
|---|
| [13932f14] | 806 | } | 
|---|
|  | 807 |  | 
|---|
| [6ca154b] | 808 | template< typename pass_type > | 
|---|
|  | 809 | Statement * PassVisitor< pass_type >::mutate( AsmStmt * node ) { | 
|---|
| [bc6f918] | 810 | MUTATE_START( node ); | 
|---|
|  | 811 |  | 
|---|
|  | 812 | maybeMutate_impl( node->instruction, *this ); | 
|---|
|  | 813 | maybeMutate_impl( node->output, *this ); | 
|---|
|  | 814 | maybeMutate_impl( node->input, *this ); | 
|---|
|  | 815 | maybeMutate_impl( node->clobber, *this ); | 
|---|
|  | 816 |  | 
|---|
|  | 817 | MUTATE_END( Statement, node ); | 
|---|
| [6ca154b] | 818 | } | 
|---|
|  | 819 |  | 
|---|
| [cc32d83] | 820 | //-------------------------------------------------------------------------- | 
|---|
|  | 821 | // AsmStmt | 
|---|
|  | 822 | template< typename pass_type > | 
|---|
|  | 823 | void PassVisitor< pass_type >::visit( DirectiveStmt * node ) { | 
|---|
|  | 824 | VISIT_START( node ) | 
|---|
|  | 825 |  | 
|---|
|  | 826 | VISIT_END( node ); | 
|---|
|  | 827 | } | 
|---|
|  | 828 |  | 
|---|
|  | 829 | template< typename pass_type > | 
|---|
|  | 830 | Statement * PassVisitor< pass_type >::mutate( DirectiveStmt * node ) { | 
|---|
|  | 831 | MUTATE_START( node ); | 
|---|
|  | 832 |  | 
|---|
|  | 833 | MUTATE_END( Statement, node ); | 
|---|
|  | 834 | } | 
|---|
|  | 835 |  | 
|---|
| [9c1600c] | 836 | //-------------------------------------------------------------------------- | 
|---|
|  | 837 | // IfStmt | 
|---|
| [13932f14] | 838 | template< typename pass_type > | 
|---|
| [ab904dc] | 839 | void PassVisitor< pass_type >::visit( IfStmt * node ) { | 
|---|
| [4551a6e] | 840 | VISIT_START( node ); | 
|---|
| [33a25f9] | 841 | { | 
|---|
|  | 842 | // if statements introduce a level of scope (for the initialization) | 
|---|
|  | 843 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [3c398b6] | 844 | maybeAccept_impl( node->get_initialization(), *this ); | 
|---|
|  | 845 | visitExpression ( node->condition ); | 
|---|
| [33a25f9] | 846 | node->thenPart = visitStatement( node->thenPart ); | 
|---|
|  | 847 | node->elsePart = visitStatement( node->elsePart ); | 
|---|
|  | 848 | } | 
|---|
| [9c1600c] | 849 | VISIT_END( node ); | 
|---|
| [13932f14] | 850 | } | 
|---|
|  | 851 |  | 
|---|
| [296b2be] | 852 | template< typename pass_type > | 
|---|
|  | 853 | Statement * PassVisitor< pass_type >::mutate( IfStmt * node ) { | 
|---|
| [4551a6e] | 854 | MUTATE_START( node ); | 
|---|
| [e0886db] | 855 | { | 
|---|
| [33a25f9] | 856 | // if statements introduce a level of scope (for the initialization) | 
|---|
| [e0886db] | 857 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [3c398b6] | 858 | maybeMutate_impl( node->get_initialization(), *this ); | 
|---|
| [e0886db] | 859 | node->condition = mutateExpression( node->condition ); | 
|---|
|  | 860 | node->thenPart  = mutateStatement ( node->thenPart  ); | 
|---|
|  | 861 | node->elsePart  = mutateStatement ( node->elsePart  ); | 
|---|
|  | 862 | } | 
|---|
| [296b2be] | 863 | MUTATE_END( Statement, node ); | 
|---|
|  | 864 | } | 
|---|
|  | 865 |  | 
|---|
| [9c1600c] | 866 | //-------------------------------------------------------------------------- | 
|---|
|  | 867 | // WhileStmt | 
|---|
| [13932f14] | 868 | template< typename pass_type > | 
|---|
| [ab904dc] | 869 | void PassVisitor< pass_type >::visit( WhileStmt * node ) { | 
|---|
| [4551a6e] | 870 | VISIT_START( node ); | 
|---|
| [9c1600c] | 871 |  | 
|---|
| [ee3c93d] | 872 | { | 
|---|
|  | 873 | // while statements introduce a level of scope (for the initialization) | 
|---|
|  | 874 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
|  | 875 | maybeAccept_impl( node->initialization, *this ); | 
|---|
|  | 876 | visitExpression ( node->condition ); | 
|---|
|  | 877 | node->body = visitStatement( node->body ); | 
|---|
|  | 878 | } | 
|---|
| [9c1600c] | 879 |  | 
|---|
|  | 880 | VISIT_END( node ); | 
|---|
| [13932f14] | 881 | } | 
|---|
|  | 882 |  | 
|---|
| [296b2be] | 883 | template< typename pass_type > | 
|---|
|  | 884 | Statement * PassVisitor< pass_type >::mutate( WhileStmt * node ) { | 
|---|
| [4551a6e] | 885 | MUTATE_START( node ); | 
|---|
| [296b2be] | 886 |  | 
|---|
| [ee3c93d] | 887 | { | 
|---|
|  | 888 | // while statements introduce a level of scope (for the initialization) | 
|---|
|  | 889 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
|  | 890 | maybeMutate_impl( node->initialization, *this ); | 
|---|
|  | 891 | node->condition = mutateExpression( node->condition ); | 
|---|
|  | 892 | node->body      = mutateStatement ( node->body      ); | 
|---|
|  | 893 | } | 
|---|
|  | 894 |  | 
|---|
| [296b2be] | 895 |  | 
|---|
|  | 896 | MUTATE_END( Statement, node ); | 
|---|
|  | 897 | } | 
|---|
|  | 898 |  | 
|---|
| [9c1600c] | 899 | //-------------------------------------------------------------------------- | 
|---|
| [6ca154b] | 900 | // ForStmt | 
|---|
| [13932f14] | 901 | template< typename pass_type > | 
|---|
| [ab904dc] | 902 | void PassVisitor< pass_type >::visit( ForStmt * node ) { | 
|---|
| [4551a6e] | 903 | VISIT_START( node ); | 
|---|
| [e0886db] | 904 | { | 
|---|
| [33a25f9] | 905 | // for statements introduce a level of scope (for the initialization) | 
|---|
| [e0886db] | 906 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [3c398b6] | 907 | maybeAccept_impl( node->initialization, *this ); | 
|---|
| [e0886db] | 908 | visitExpression( node->condition ); | 
|---|
|  | 909 | visitExpression( node->increment ); | 
|---|
|  | 910 | node->body = visitStatement( node->body ); | 
|---|
|  | 911 | } | 
|---|
| [9c1600c] | 912 | VISIT_END( node ); | 
|---|
| [13932f14] | 913 | } | 
|---|
|  | 914 |  | 
|---|
| [296b2be] | 915 | template< typename pass_type > | 
|---|
|  | 916 | Statement * PassVisitor< pass_type >::mutate( ForStmt * node ) { | 
|---|
| [4551a6e] | 917 | MUTATE_START( node ); | 
|---|
| [e0886db] | 918 | { | 
|---|
| [33a25f9] | 919 | // for statements introduce a level of scope (for the initialization) | 
|---|
| [e0886db] | 920 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [3c398b6] | 921 | maybeMutate_impl( node->initialization, *this ); | 
|---|
| [e0886db] | 922 | node->condition = mutateExpression( node->condition ); | 
|---|
|  | 923 | node->increment = mutateExpression( node->increment ); | 
|---|
|  | 924 | node->body      = mutateStatement ( node->body      ); | 
|---|
|  | 925 | } | 
|---|
| [296b2be] | 926 | MUTATE_END( Statement, node ); | 
|---|
|  | 927 | } | 
|---|
|  | 928 |  | 
|---|
| [9c1600c] | 929 | //-------------------------------------------------------------------------- | 
|---|
|  | 930 | // SwitchStmt | 
|---|
| [13932f14] | 931 | template< typename pass_type > | 
|---|
| [ab904dc] | 932 | void PassVisitor< pass_type >::visit( SwitchStmt * node ) { | 
|---|
| [4551a6e] | 933 | VISIT_START( node ); | 
|---|
| [9c1600c] | 934 |  | 
|---|
| [e0886db] | 935 | visitExpression   ( node->condition  ); | 
|---|
|  | 936 | visitStatementList( node->statements ); | 
|---|
| [9c1600c] | 937 |  | 
|---|
|  | 938 | VISIT_END( node ); | 
|---|
| [13932f14] | 939 | } | 
|---|
|  | 940 |  | 
|---|
| [296b2be] | 941 | template< typename pass_type > | 
|---|
|  | 942 | Statement * PassVisitor< pass_type >::mutate( SwitchStmt * node ) { | 
|---|
| [4551a6e] | 943 | MUTATE_START( node ); | 
|---|
|  | 944 |  | 
|---|
| [e0886db] | 945 | node->condition = mutateExpression( node->condition ); | 
|---|
|  | 946 | mutateStatementList( node->statements ); | 
|---|
| [4551a6e] | 947 |  | 
|---|
| [296b2be] | 948 | MUTATE_END( Statement, node ); | 
|---|
|  | 949 | } | 
|---|
|  | 950 |  | 
|---|
| [9c1600c] | 951 | //-------------------------------------------------------------------------- | 
|---|
| [35df560] | 952 | // CaseStmt | 
|---|
| [13932f14] | 953 | template< typename pass_type > | 
|---|
| [ab904dc] | 954 | void PassVisitor< pass_type >::visit( CaseStmt * node ) { | 
|---|
| [4551a6e] | 955 | VISIT_START( node ); | 
|---|
|  | 956 |  | 
|---|
| [e0886db] | 957 | visitExpression   ( node->condition ); | 
|---|
|  | 958 | visitStatementList( node->stmts     ); | 
|---|
| [4551a6e] | 959 |  | 
|---|
| [9c1600c] | 960 | VISIT_END( node ); | 
|---|
| [13932f14] | 961 | } | 
|---|
|  | 962 |  | 
|---|
| [296b2be] | 963 | template< typename pass_type > | 
|---|
|  | 964 | Statement * PassVisitor< pass_type >::mutate( CaseStmt * node ) { | 
|---|
| [4551a6e] | 965 | MUTATE_START( node ); | 
|---|
|  | 966 |  | 
|---|
| [e0886db] | 967 | node->condition = mutateExpression( node->condition ); | 
|---|
|  | 968 | mutateStatementList( node->stmts ); | 
|---|
| [4551a6e] | 969 |  | 
|---|
| [296b2be] | 970 | MUTATE_END( Statement, node ); | 
|---|
|  | 971 | } | 
|---|
|  | 972 |  | 
|---|
| [6ca154b] | 973 | //-------------------------------------------------------------------------- | 
|---|
|  | 974 | // BranchStmt | 
|---|
| [13932f14] | 975 | template< typename pass_type > | 
|---|
| [ab904dc] | 976 | void PassVisitor< pass_type >::visit( BranchStmt * node ) { | 
|---|
| [33c0ce8] | 977 | VISIT_START( node ); | 
|---|
|  | 978 | VISIT_END( node ); | 
|---|
| [13932f14] | 979 | } | 
|---|
|  | 980 |  | 
|---|
| [6ca154b] | 981 | template< typename pass_type > | 
|---|
|  | 982 | Statement * PassVisitor< pass_type >::mutate( BranchStmt * node ) { | 
|---|
| [33c0ce8] | 983 | MUTATE_START( node ); | 
|---|
|  | 984 | MUTATE_END( Statement, node ); | 
|---|
| [6ca154b] | 985 | } | 
|---|
|  | 986 |  | 
|---|
| [9c1600c] | 987 | //-------------------------------------------------------------------------- | 
|---|
|  | 988 | // ReturnStmt | 
|---|
| [13932f14] | 989 | template< typename pass_type > | 
|---|
| [ab904dc] | 990 | void PassVisitor< pass_type >::visit( ReturnStmt * node ) { | 
|---|
| [9c1600c] | 991 | VISIT_START( node ); | 
|---|
|  | 992 |  | 
|---|
| [e0886db] | 993 | visitExpression( node->expr ); | 
|---|
| [9c1600c] | 994 |  | 
|---|
|  | 995 | VISIT_END( node ); | 
|---|
| [13932f14] | 996 | } | 
|---|
|  | 997 |  | 
|---|
| [296b2be] | 998 | template< typename pass_type > | 
|---|
|  | 999 | Statement * PassVisitor< pass_type >::mutate( ReturnStmt * node ) { | 
|---|
|  | 1000 | MUTATE_START( node ); | 
|---|
|  | 1001 |  | 
|---|
| [e0886db] | 1002 | node->expr = mutateExpression( node->expr ); | 
|---|
| [296b2be] | 1003 |  | 
|---|
|  | 1004 | MUTATE_END( Statement, node ); | 
|---|
|  | 1005 | } | 
|---|
|  | 1006 |  | 
|---|
| [6e09f211] | 1007 | //-------------------------------------------------------------------------- | 
|---|
|  | 1008 | // ThrowStmt | 
|---|
|  | 1009 |  | 
|---|
|  | 1010 | template< typename pass_type > | 
|---|
|  | 1011 | void PassVisitor< pass_type >::visit( ThrowStmt * node ) { | 
|---|
| [33c0ce8] | 1012 | VISIT_START( node ); | 
|---|
|  | 1013 |  | 
|---|
|  | 1014 | maybeAccept_impl( node->expr, *this ); | 
|---|
|  | 1015 | maybeAccept_impl( node->target, *this ); | 
|---|
|  | 1016 |  | 
|---|
|  | 1017 | VISIT_END( node ); | 
|---|
| [6e09f211] | 1018 | } | 
|---|
|  | 1019 |  | 
|---|
|  | 1020 | template< typename pass_type > | 
|---|
|  | 1021 | Statement * PassVisitor< pass_type >::mutate( ThrowStmt * node ) { | 
|---|
| [33c0ce8] | 1022 | MUTATE_START( node ); | 
|---|
|  | 1023 |  | 
|---|
|  | 1024 | maybeMutate_impl( node->expr, *this ); | 
|---|
|  | 1025 | maybeMutate_impl( node->target, *this ); | 
|---|
|  | 1026 |  | 
|---|
|  | 1027 | MUTATE_END( Statement, node ); | 
|---|
| [6e09f211] | 1028 | } | 
|---|
|  | 1029 |  | 
|---|
| [9c1600c] | 1030 | //-------------------------------------------------------------------------- | 
|---|
|  | 1031 | // TryStmt | 
|---|
| [13932f14] | 1032 | template< typename pass_type > | 
|---|
| [ab904dc] | 1033 | void PassVisitor< pass_type >::visit( TryStmt * node ) { | 
|---|
| [9c1600c] | 1034 | VISIT_START( node ); | 
|---|
|  | 1035 |  | 
|---|
| [3c398b6] | 1036 | maybeAccept_impl( node->block       , *this ); | 
|---|
|  | 1037 | maybeAccept_impl( node->handlers    , *this ); | 
|---|
|  | 1038 | maybeAccept_impl( node->finallyBlock, *this ); | 
|---|
| [9c1600c] | 1039 |  | 
|---|
|  | 1040 | VISIT_END( node ); | 
|---|
| [13932f14] | 1041 | } | 
|---|
|  | 1042 |  | 
|---|
| [296b2be] | 1043 | template< typename pass_type > | 
|---|
|  | 1044 | Statement * PassVisitor< pass_type >::mutate( TryStmt * node ) { | 
|---|
|  | 1045 | MUTATE_START( node ); | 
|---|
|  | 1046 |  | 
|---|
| [3c398b6] | 1047 | maybeMutate_impl( node->block       , *this ); | 
|---|
|  | 1048 | maybeMutate_impl( node->handlers    , *this ); | 
|---|
|  | 1049 | maybeMutate_impl( node->finallyBlock, *this ); | 
|---|
| [4551a6e] | 1050 |  | 
|---|
| [296b2be] | 1051 | MUTATE_END( Statement, node ); | 
|---|
|  | 1052 | } | 
|---|
|  | 1053 |  | 
|---|
| [9c1600c] | 1054 | //-------------------------------------------------------------------------- | 
|---|
|  | 1055 | // CatchStmt | 
|---|
| [13932f14] | 1056 | template< typename pass_type > | 
|---|
| [ab904dc] | 1057 | void PassVisitor< pass_type >::visit( CatchStmt * node ) { | 
|---|
| [9c1600c] | 1058 | VISIT_START( node ); | 
|---|
| [e0886db] | 1059 | { | 
|---|
| [33a25f9] | 1060 | // catch statements introduce a level of scope (for the caught exception) | 
|---|
| [e0886db] | 1061 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [3c398b6] | 1062 | maybeAccept_impl( node->decl, *this ); | 
|---|
| [e0886db] | 1063 | node->cond = visitExpression( node->cond ); | 
|---|
|  | 1064 | node->body = visitStatement ( node->body ); | 
|---|
|  | 1065 | } | 
|---|
| [9c1600c] | 1066 | VISIT_END( node ); | 
|---|
| [13932f14] | 1067 | } | 
|---|
|  | 1068 |  | 
|---|
| [296b2be] | 1069 | template< typename pass_type > | 
|---|
|  | 1070 | Statement * PassVisitor< pass_type >::mutate( CatchStmt * node ) { | 
|---|
|  | 1071 | MUTATE_START( node ); | 
|---|
| [e0886db] | 1072 | { | 
|---|
| [33a25f9] | 1073 | // catch statements introduce a level of scope (for the caught exception) | 
|---|
| [e0886db] | 1074 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [3c398b6] | 1075 | maybeMutate_impl( node->decl, *this ); | 
|---|
| [e0886db] | 1076 | node->cond = mutateExpression( node->cond ); | 
|---|
|  | 1077 | node->body = mutateStatement ( node->body ); | 
|---|
|  | 1078 | } | 
|---|
| [296b2be] | 1079 | MUTATE_END( Statement, node ); | 
|---|
|  | 1080 | } | 
|---|
|  | 1081 |  | 
|---|
| [2065609] | 1082 | //-------------------------------------------------------------------------- | 
|---|
|  | 1083 | // FinallyStmt | 
|---|
| [13932f14] | 1084 | template< typename pass_type > | 
|---|
| [ab904dc] | 1085 | void PassVisitor< pass_type >::visit( FinallyStmt * node ) { | 
|---|
| [11b7028] | 1086 | VISIT_START( node ); | 
|---|
|  | 1087 |  | 
|---|
|  | 1088 | maybeAccept_impl( node->block, *this ); | 
|---|
|  | 1089 |  | 
|---|
|  | 1090 | VISIT_END( node ); | 
|---|
| [13932f14] | 1091 | } | 
|---|
|  | 1092 |  | 
|---|
| [2065609] | 1093 | template< typename pass_type > | 
|---|
|  | 1094 | Statement * PassVisitor< pass_type >::mutate( FinallyStmt * node ) { | 
|---|
| [11b7028] | 1095 | MUTATE_START( node ); | 
|---|
|  | 1096 |  | 
|---|
|  | 1097 | maybeMutate_impl( node->block, *this ); | 
|---|
|  | 1098 |  | 
|---|
|  | 1099 | MUTATE_END( Statement, node ); | 
|---|
| [2065609] | 1100 | } | 
|---|
|  | 1101 |  | 
|---|
|  | 1102 | //-------------------------------------------------------------------------- | 
|---|
|  | 1103 | // WaitForStmt | 
|---|
|  | 1104 | template< typename pass_type > | 
|---|
|  | 1105 | void PassVisitor< pass_type >::visit( WaitForStmt * node ) { | 
|---|
| [834b892] | 1106 | VISIT_START( node ); | 
|---|
|  | 1107 |  | 
|---|
|  | 1108 | for( auto & clause : node->clauses ) { | 
|---|
|  | 1109 | maybeAccept_impl( clause.target.function, *this ); | 
|---|
|  | 1110 | maybeAccept_impl( clause.target.arguments, *this ); | 
|---|
|  | 1111 |  | 
|---|
|  | 1112 | maybeAccept_impl( clause.statement, *this ); | 
|---|
|  | 1113 | maybeAccept_impl( clause.condition, *this ); | 
|---|
|  | 1114 | } | 
|---|
|  | 1115 |  | 
|---|
|  | 1116 | maybeAccept_impl( node->timeout.time, *this ); | 
|---|
|  | 1117 | maybeAccept_impl( node->timeout.statement, *this ); | 
|---|
|  | 1118 | maybeAccept_impl( node->timeout.condition, *this ); | 
|---|
|  | 1119 | maybeAccept_impl( node->orelse.statement, *this ); | 
|---|
|  | 1120 | maybeAccept_impl( node->orelse.condition, *this ); | 
|---|
|  | 1121 |  | 
|---|
|  | 1122 | VISIT_END( node ); | 
|---|
| [2065609] | 1123 | } | 
|---|
|  | 1124 |  | 
|---|
|  | 1125 | template< typename pass_type > | 
|---|
|  | 1126 | Statement * PassVisitor< pass_type >::mutate( WaitForStmt * node ) { | 
|---|
| [834b892] | 1127 | MUTATE_START( node ); | 
|---|
|  | 1128 |  | 
|---|
|  | 1129 | for( auto & clause : node->clauses ) { | 
|---|
|  | 1130 | maybeMutate_impl( clause.target.function, *this ); | 
|---|
|  | 1131 | maybeMutate_impl( clause.target.arguments, *this ); | 
|---|
|  | 1132 |  | 
|---|
|  | 1133 | maybeMutate_impl( clause.statement, *this ); | 
|---|
|  | 1134 | maybeMutate_impl( clause.condition, *this ); | 
|---|
|  | 1135 | } | 
|---|
|  | 1136 |  | 
|---|
|  | 1137 | maybeMutate_impl( node->timeout.time, *this ); | 
|---|
|  | 1138 | maybeMutate_impl( node->timeout.statement, *this ); | 
|---|
|  | 1139 | maybeMutate_impl( node->timeout.condition, *this ); | 
|---|
|  | 1140 | maybeMutate_impl( node->orelse.statement, *this ); | 
|---|
|  | 1141 | maybeMutate_impl( node->orelse.condition, *this ); | 
|---|
|  | 1142 |  | 
|---|
|  | 1143 | MUTATE_END( Statement, node ); | 
|---|
| [2065609] | 1144 | } | 
|---|
|  | 1145 |  | 
|---|
| [d8893ca] | 1146 |  | 
|---|
|  | 1147 |  | 
|---|
| [61255ad] | 1148 | //-------------------------------------------------------------------------- | 
|---|
|  | 1149 | // NullStmt | 
|---|
|  | 1150 | template< typename pass_type > | 
|---|
|  | 1151 | void PassVisitor< pass_type >::visit( WithStmt * node ) { | 
|---|
| [d8893ca] | 1152 | VISIT_START( node ); | 
|---|
|  | 1153 | maybeAccept_impl( node->exprs, *this ); | 
|---|
|  | 1154 | { | 
|---|
|  | 1155 | // catch statements introduce a level of scope (for the caught exception) | 
|---|
|  | 1156 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [0ac366b] | 1157 | indexerAddWith( node->exprs, node ); | 
|---|
| [d8893ca] | 1158 | maybeAccept_impl( node->stmt, *this ); | 
|---|
|  | 1159 | } | 
|---|
|  | 1160 | VISIT_END( node ); | 
|---|
| [61255ad] | 1161 | } | 
|---|
|  | 1162 |  | 
|---|
|  | 1163 | template< typename pass_type > | 
|---|
|  | 1164 | Statement * PassVisitor< pass_type >::mutate( WithStmt * node ) { | 
|---|
| [d8893ca] | 1165 | MUTATE_START( node ); | 
|---|
|  | 1166 | maybeMutate_impl( node->exprs, *this ); | 
|---|
|  | 1167 | { | 
|---|
|  | 1168 | // catch statements introduce a level of scope (for the caught exception) | 
|---|
|  | 1169 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [0ac366b] | 1170 | indexerAddWith( node->exprs, node ); | 
|---|
| [d8893ca] | 1171 | maybeMutate_impl( node->stmt, *this ); | 
|---|
|  | 1172 | } | 
|---|
|  | 1173 | MUTATE_END( Statement, node ); | 
|---|
| [61255ad] | 1174 | } | 
|---|
|  | 1175 |  | 
|---|
| [2065609] | 1176 | //-------------------------------------------------------------------------- | 
|---|
|  | 1177 | // NullStmt | 
|---|
| [13932f14] | 1178 | template< typename pass_type > | 
|---|
| [ab904dc] | 1179 | void PassVisitor< pass_type >::visit( NullStmt * node ) { | 
|---|
| [5964127] | 1180 | VISIT_START( node ); | 
|---|
|  | 1181 | VISIT_END( node ); | 
|---|
| [13932f14] | 1182 | } | 
|---|
|  | 1183 |  | 
|---|
| [2065609] | 1184 | template< typename pass_type > | 
|---|
|  | 1185 | NullStmt * PassVisitor< pass_type >::mutate( NullStmt * node ) { | 
|---|
| [5964127] | 1186 | MUTATE_START( node ); | 
|---|
|  | 1187 | MUTATE_END( NullStmt, node ); | 
|---|
| [2065609] | 1188 | } | 
|---|
|  | 1189 |  | 
|---|
|  | 1190 | //-------------------------------------------------------------------------- | 
|---|
|  | 1191 | // DeclStmt | 
|---|
| [13932f14] | 1192 | template< typename pass_type > | 
|---|
| [ab904dc] | 1193 | void PassVisitor< pass_type >::visit( DeclStmt * node ) { | 
|---|
| [5964127] | 1194 | VISIT_START( node ); | 
|---|
|  | 1195 |  | 
|---|
|  | 1196 | maybeAccept_impl( node->decl, *this ); | 
|---|
|  | 1197 |  | 
|---|
|  | 1198 | VISIT_END( node ); | 
|---|
| [13932f14] | 1199 | } | 
|---|
|  | 1200 |  | 
|---|
| [2065609] | 1201 | template< typename pass_type > | 
|---|
|  | 1202 | Statement * PassVisitor< pass_type >::mutate( DeclStmt * node ) { | 
|---|
| [5964127] | 1203 | MUTATE_START( node ); | 
|---|
|  | 1204 |  | 
|---|
|  | 1205 | maybeMutate_impl( node->decl, *this ); | 
|---|
|  | 1206 |  | 
|---|
|  | 1207 | MUTATE_END( Statement, node ); | 
|---|
| [2065609] | 1208 | } | 
|---|
|  | 1209 |  | 
|---|
|  | 1210 | //-------------------------------------------------------------------------- | 
|---|
|  | 1211 | // ImplicitCtorDtorStmt | 
|---|
| [13932f14] | 1212 | template< typename pass_type > | 
|---|
| [ab904dc] | 1213 | void PassVisitor< pass_type >::visit( ImplicitCtorDtorStmt * node ) { | 
|---|
| [599fbb6] | 1214 | VISIT_START( node ); | 
|---|
|  | 1215 |  | 
|---|
|  | 1216 | maybeAccept_impl( node->callStmt, *this ); | 
|---|
|  | 1217 |  | 
|---|
|  | 1218 | VISIT_END( node ); | 
|---|
| [13932f14] | 1219 | } | 
|---|
|  | 1220 |  | 
|---|
| [2065609] | 1221 | template< typename pass_type > | 
|---|
|  | 1222 | Statement * PassVisitor< pass_type >::mutate( ImplicitCtorDtorStmt * node ) { | 
|---|
| [599fbb6] | 1223 | MUTATE_START( node ); | 
|---|
|  | 1224 |  | 
|---|
|  | 1225 | maybeMutate_impl( node->callStmt, *this ); | 
|---|
|  | 1226 |  | 
|---|
|  | 1227 | MUTATE_END( Statement, node ); | 
|---|
| [2065609] | 1228 | } | 
|---|
|  | 1229 |  | 
|---|
|  | 1230 | //-------------------------------------------------------------------------- | 
|---|
|  | 1231 | // ApplicationExpr | 
|---|
| [13932f14] | 1232 | template< typename pass_type > | 
|---|
| [ab904dc] | 1233 | void PassVisitor< pass_type >::visit( ApplicationExpr * node ) { | 
|---|
| [e0886db] | 1234 | VISIT_START( node ); | 
|---|
|  | 1235 |  | 
|---|
|  | 1236 | indexerScopedAccept( node->result  , *this ); | 
|---|
| [3c398b6] | 1237 | maybeAccept_impl        ( node->function, *this ); | 
|---|
|  | 1238 | maybeAccept_impl        ( node->args    , *this ); | 
|---|
| [e0886db] | 1239 |  | 
|---|
|  | 1240 | VISIT_END( node ); | 
|---|
| [13932f14] | 1241 | } | 
|---|
|  | 1242 |  | 
|---|
| [2065609] | 1243 | template< typename pass_type > | 
|---|
|  | 1244 | Expression * PassVisitor< pass_type >::mutate( ApplicationExpr * node ) { | 
|---|
| [e0886db] | 1245 | MUTATE_START( node ); | 
|---|
|  | 1246 |  | 
|---|
|  | 1247 | indexerScopedMutate( node->env     , *this ); | 
|---|
|  | 1248 | indexerScopedMutate( node->result  , *this ); | 
|---|
| [3c398b6] | 1249 | maybeMutate_impl   ( node->function, *this ); | 
|---|
|  | 1250 | maybeMutate_impl   ( node->args    , *this ); | 
|---|
| [e0886db] | 1251 |  | 
|---|
|  | 1252 | MUTATE_END( Expression, node ); | 
|---|
| [2065609] | 1253 | } | 
|---|
|  | 1254 |  | 
|---|
| [9c1600c] | 1255 | //-------------------------------------------------------------------------- | 
|---|
|  | 1256 | // UntypedExpr | 
|---|
| [13932f14] | 1257 | template< typename pass_type > | 
|---|
| [ab904dc] | 1258 | void PassVisitor< pass_type >::visit( UntypedExpr * node ) { | 
|---|
| [9c1600c] | 1259 | VISIT_START( node ); | 
|---|
|  | 1260 |  | 
|---|
| [3c398b6] | 1261 | // maybeAccept_impl( node->get_env(), *this ); | 
|---|
| [e0886db] | 1262 | indexerScopedAccept( node->result, *this ); | 
|---|
| [2a7b3ca] | 1263 |  | 
|---|
| [e0886db] | 1264 | for ( auto expr : node->args ) { | 
|---|
| [9c1600c] | 1265 | visitExpression( expr ); | 
|---|
|  | 1266 | } | 
|---|
|  | 1267 |  | 
|---|
|  | 1268 | VISIT_END( node ); | 
|---|
| [13932f14] | 1269 | } | 
|---|
|  | 1270 |  | 
|---|
| [296b2be] | 1271 | template< typename pass_type > | 
|---|
|  | 1272 | Expression * PassVisitor< pass_type >::mutate( UntypedExpr * node ) { | 
|---|
|  | 1273 | MUTATE_START( node ); | 
|---|
|  | 1274 |  | 
|---|
| [e0886db] | 1275 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1276 | indexerScopedMutate( node->result, *this ); | 
|---|
| [2a7b3ca] | 1277 |  | 
|---|
| [e0886db] | 1278 | for ( auto& expr : node->args ) { | 
|---|
| [296b2be] | 1279 | expr = mutateExpression( expr ); | 
|---|
|  | 1280 | } | 
|---|
|  | 1281 |  | 
|---|
|  | 1282 | MUTATE_END( Expression, node ); | 
|---|
|  | 1283 | } | 
|---|
|  | 1284 |  | 
|---|
| [e0886db] | 1285 | //-------------------------------------------------------------------------- | 
|---|
|  | 1286 | // NameExpr | 
|---|
| [13932f14] | 1287 | template< typename pass_type > | 
|---|
| [ab904dc] | 1288 | void PassVisitor< pass_type >::visit( NameExpr * node ) { | 
|---|
| [e0886db] | 1289 | VISIT_START( node ); | 
|---|
|  | 1290 |  | 
|---|
|  | 1291 | indexerScopedAccept( node->result, *this ); | 
|---|
|  | 1292 |  | 
|---|
|  | 1293 | VISIT_END( node ); | 
|---|
| [13932f14] | 1294 | } | 
|---|
|  | 1295 |  | 
|---|
|  | 1296 | template< typename pass_type > | 
|---|
| [e0886db] | 1297 | Expression * PassVisitor< pass_type >::mutate( NameExpr * node ) { | 
|---|
|  | 1298 | MUTATE_START( node ); | 
|---|
|  | 1299 |  | 
|---|
|  | 1300 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1301 | indexerScopedMutate( node->result, *this ); | 
|---|
|  | 1302 |  | 
|---|
|  | 1303 | MUTATE_END( Expression, node ); | 
|---|
| [13932f14] | 1304 | } | 
|---|
|  | 1305 |  | 
|---|
| [e0886db] | 1306 | //-------------------------------------------------------------------------- | 
|---|
|  | 1307 | // CastExpr | 
|---|
| [a5f0529] | 1308 | template< typename pass_type > | 
|---|
| [e0886db] | 1309 | void PassVisitor< pass_type >::visit( CastExpr * node ) { | 
|---|
|  | 1310 | VISIT_START( node ); | 
|---|
|  | 1311 |  | 
|---|
|  | 1312 | indexerScopedAccept( node->result, *this ); | 
|---|
| [3c398b6] | 1313 | maybeAccept_impl        ( node->arg   , *this ); | 
|---|
| [e0886db] | 1314 |  | 
|---|
|  | 1315 | VISIT_END( node ); | 
|---|
| [a5f0529] | 1316 | } | 
|---|
|  | 1317 |  | 
|---|
| [13932f14] | 1318 | template< typename pass_type > | 
|---|
| [e0886db] | 1319 | Expression * PassVisitor< pass_type >::mutate( CastExpr * node ) { | 
|---|
|  | 1320 | MUTATE_START( node ); | 
|---|
|  | 1321 |  | 
|---|
|  | 1322 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1323 | indexerScopedMutate( node->result, *this ); | 
|---|
| [3c398b6] | 1324 | maybeMutate_impl   ( node->arg   , *this ); | 
|---|
| [e0886db] | 1325 |  | 
|---|
|  | 1326 | MUTATE_END( Expression, node ); | 
|---|
| [13932f14] | 1327 | } | 
|---|
|  | 1328 |  | 
|---|
| [e0886db] | 1329 | //-------------------------------------------------------------------------- | 
|---|
| [9a705dc8] | 1330 | // KeywordCastExpr | 
|---|
|  | 1331 | template< typename pass_type > | 
|---|
|  | 1332 | void PassVisitor< pass_type >::visit( KeywordCastExpr * node ) { | 
|---|
|  | 1333 | VISIT_START( node ); | 
|---|
|  | 1334 |  | 
|---|
|  | 1335 | indexerScopedAccept( node->result, *this ); | 
|---|
|  | 1336 | maybeAccept_impl        ( node->arg   , *this ); | 
|---|
|  | 1337 |  | 
|---|
|  | 1338 | VISIT_END( node ); | 
|---|
|  | 1339 | } | 
|---|
|  | 1340 |  | 
|---|
|  | 1341 | template< typename pass_type > | 
|---|
|  | 1342 | Expression * PassVisitor< pass_type >::mutate( KeywordCastExpr * node ) { | 
|---|
|  | 1343 | MUTATE_START( node ); | 
|---|
|  | 1344 |  | 
|---|
|  | 1345 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1346 | indexerScopedMutate( node->result, *this ); | 
|---|
|  | 1347 | maybeMutate_impl   ( node->arg   , *this ); | 
|---|
|  | 1348 |  | 
|---|
|  | 1349 | MUTATE_END( Expression, node ); | 
|---|
|  | 1350 | } | 
|---|
|  | 1351 |  | 
|---|
|  | 1352 | //-------------------------------------------------------------------------- | 
|---|
| [e0886db] | 1353 | // VirtualCastExpr | 
|---|
| [13932f14] | 1354 | template< typename pass_type > | 
|---|
| [e0886db] | 1355 | void PassVisitor< pass_type >::visit( VirtualCastExpr * node ) { | 
|---|
|  | 1356 | VISIT_START( node ); | 
|---|
|  | 1357 |  | 
|---|
|  | 1358 | indexerScopedAccept( node->result, *this ); | 
|---|
| [3c398b6] | 1359 | maybeAccept_impl( node->arg, *this ); | 
|---|
| [e0886db] | 1360 |  | 
|---|
|  | 1361 | VISIT_END( node ); | 
|---|
| [13932f14] | 1362 | } | 
|---|
|  | 1363 |  | 
|---|
|  | 1364 | template< typename pass_type > | 
|---|
| [e0886db] | 1365 | Expression * PassVisitor< pass_type >::mutate( VirtualCastExpr * node ) { | 
|---|
|  | 1366 | MUTATE_START( node ); | 
|---|
|  | 1367 |  | 
|---|
|  | 1368 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1369 | indexerScopedMutate( node->result, *this ); | 
|---|
| [3c398b6] | 1370 | maybeMutate_impl   ( node->arg   , *this ); | 
|---|
| [e0886db] | 1371 |  | 
|---|
|  | 1372 | MUTATE_END( Expression, node ); | 
|---|
| [13932f14] | 1373 | } | 
|---|
|  | 1374 |  | 
|---|
| [e0886db] | 1375 | //-------------------------------------------------------------------------- | 
|---|
|  | 1376 | // AddressExpr | 
|---|
| [13932f14] | 1377 | template< typename pass_type > | 
|---|
| [e0886db] | 1378 | void PassVisitor< pass_type >::visit( AddressExpr * node ) { | 
|---|
|  | 1379 | VISIT_START( node ); | 
|---|
|  | 1380 |  | 
|---|
|  | 1381 | indexerScopedAccept( node->result, *this ); | 
|---|
| [3c398b6] | 1382 | maybeAccept_impl   ( node->arg   , *this ); | 
|---|
| [e0886db] | 1383 |  | 
|---|
|  | 1384 | VISIT_END( node ); | 
|---|
| [13932f14] | 1385 | } | 
|---|
|  | 1386 |  | 
|---|
|  | 1387 | template< typename pass_type > | 
|---|
| [e0886db] | 1388 | Expression * PassVisitor< pass_type >::mutate( AddressExpr * node ) { | 
|---|
|  | 1389 | MUTATE_START( node ); | 
|---|
|  | 1390 |  | 
|---|
|  | 1391 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1392 | indexerScopedMutate( node->result, *this ); | 
|---|
| [3c398b6] | 1393 | maybeMutate_impl   ( node->arg   , *this ); | 
|---|
| [e0886db] | 1394 |  | 
|---|
|  | 1395 | MUTATE_END( Expression, node ); | 
|---|
|  | 1396 | } | 
|---|
|  | 1397 |  | 
|---|
|  | 1398 | //-------------------------------------------------------------------------- | 
|---|
|  | 1399 | // LabelAddressExpr | 
|---|
|  | 1400 | template< typename pass_type > | 
|---|
|  | 1401 | void PassVisitor< pass_type >::visit( LabelAddressExpr * node ) { | 
|---|
|  | 1402 | VISIT_START( node ); | 
|---|
|  | 1403 |  | 
|---|
|  | 1404 | indexerScopedAccept( node->result, *this ); | 
|---|
|  | 1405 |  | 
|---|
|  | 1406 | VISIT_END( node ); | 
|---|
|  | 1407 | } | 
|---|
|  | 1408 |  | 
|---|
|  | 1409 | template< typename pass_type > | 
|---|
|  | 1410 | Expression * PassVisitor< pass_type >::mutate( LabelAddressExpr * node ) { | 
|---|
|  | 1411 | MUTATE_START( node ); | 
|---|
|  | 1412 |  | 
|---|
|  | 1413 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1414 | indexerScopedMutate( node->result, *this ); | 
|---|
|  | 1415 |  | 
|---|
|  | 1416 | MUTATE_END( Expression, node ); | 
|---|
|  | 1417 | } | 
|---|
|  | 1418 |  | 
|---|
|  | 1419 | //-------------------------------------------------------------------------- | 
|---|
|  | 1420 | // UntypedMemberExpr | 
|---|
|  | 1421 | template< typename pass_type > | 
|---|
|  | 1422 | void PassVisitor< pass_type >::visit( UntypedMemberExpr * node ) { | 
|---|
|  | 1423 | VISIT_START( node ); | 
|---|
|  | 1424 |  | 
|---|
|  | 1425 | indexerScopedAccept( node->result   , *this ); | 
|---|
| [3c398b6] | 1426 | maybeAccept_impl   ( node->aggregate, *this ); | 
|---|
|  | 1427 | maybeAccept_impl   ( node->member   , *this ); | 
|---|
| [e0886db] | 1428 |  | 
|---|
|  | 1429 | VISIT_END( node ); | 
|---|
| [13932f14] | 1430 | } | 
|---|
|  | 1431 |  | 
|---|
| [e0886db] | 1432 | template< typename pass_type > | 
|---|
|  | 1433 | Expression * PassVisitor< pass_type >::mutate( UntypedMemberExpr * node ) { | 
|---|
|  | 1434 | MUTATE_START( node ); | 
|---|
|  | 1435 |  | 
|---|
|  | 1436 | indexerScopedMutate( node->env      , *this ); | 
|---|
|  | 1437 | indexerScopedMutate( node->result   , *this ); | 
|---|
| [3c398b6] | 1438 | maybeMutate_impl   ( node->aggregate, *this ); | 
|---|
|  | 1439 | maybeMutate_impl   ( node->member   , *this ); | 
|---|
| [e0886db] | 1440 |  | 
|---|
|  | 1441 | MUTATE_END( Expression, node ); | 
|---|
|  | 1442 | } | 
|---|
|  | 1443 |  | 
|---|
|  | 1444 | //-------------------------------------------------------------------------- | 
|---|
|  | 1445 | // MemberExpr | 
|---|
|  | 1446 | template< typename pass_type > | 
|---|
|  | 1447 | void PassVisitor< pass_type >::visit( MemberExpr * node ) { | 
|---|
|  | 1448 | VISIT_START( node ); | 
|---|
|  | 1449 |  | 
|---|
|  | 1450 | indexerScopedAccept( node->result   , *this ); | 
|---|
| [3c398b6] | 1451 | maybeAccept_impl   ( node->aggregate, *this ); | 
|---|
| [e0886db] | 1452 |  | 
|---|
|  | 1453 | VISIT_END( node ); | 
|---|
|  | 1454 | } | 
|---|
|  | 1455 |  | 
|---|
|  | 1456 | template< typename pass_type > | 
|---|
|  | 1457 | Expression * PassVisitor< pass_type >::mutate( MemberExpr * node ) { | 
|---|
|  | 1458 | MUTATE_START( node ); | 
|---|
|  | 1459 |  | 
|---|
|  | 1460 | indexerScopedMutate( node->env      , *this ); | 
|---|
|  | 1461 | indexerScopedMutate( node->result   , *this ); | 
|---|
| [3c398b6] | 1462 | maybeMutate_impl   ( node->aggregate, *this ); | 
|---|
| [e0886db] | 1463 |  | 
|---|
|  | 1464 | MUTATE_END( Expression, node ); | 
|---|
|  | 1465 | } | 
|---|
|  | 1466 |  | 
|---|
|  | 1467 | //-------------------------------------------------------------------------- | 
|---|
|  | 1468 | // VariableExpr | 
|---|
|  | 1469 | template< typename pass_type > | 
|---|
|  | 1470 | void PassVisitor< pass_type >::visit( VariableExpr * node ) { | 
|---|
|  | 1471 | VISIT_START( node ); | 
|---|
|  | 1472 |  | 
|---|
|  | 1473 | indexerScopedAccept( node->result, *this ); | 
|---|
|  | 1474 |  | 
|---|
|  | 1475 | VISIT_END( node ); | 
|---|
|  | 1476 | } | 
|---|
|  | 1477 |  | 
|---|
|  | 1478 | template< typename pass_type > | 
|---|
|  | 1479 | Expression * PassVisitor< pass_type >::mutate( VariableExpr * node ) { | 
|---|
|  | 1480 | MUTATE_START( node ); | 
|---|
|  | 1481 |  | 
|---|
|  | 1482 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1483 | indexerScopedMutate( node->result, *this ); | 
|---|
|  | 1484 |  | 
|---|
|  | 1485 | MUTATE_END( Expression, node ); | 
|---|
|  | 1486 | } | 
|---|
|  | 1487 |  | 
|---|
|  | 1488 | //-------------------------------------------------------------------------- | 
|---|
|  | 1489 | // ConstantExpr | 
|---|
| [13932f14] | 1490 | template< typename pass_type > | 
|---|
| [ab904dc] | 1491 | void PassVisitor< pass_type >::visit( ConstantExpr * node ) { | 
|---|
| [e0886db] | 1492 | VISIT_START( node ); | 
|---|
|  | 1493 |  | 
|---|
|  | 1494 | indexerScopedAccept( node->result   , *this ); | 
|---|
| [3c398b6] | 1495 | maybeAccept_impl   ( &node->constant, *this ); | 
|---|
| [e0886db] | 1496 |  | 
|---|
|  | 1497 | VISIT_END( node ); | 
|---|
| [13932f14] | 1498 | } | 
|---|
|  | 1499 |  | 
|---|
| [e0886db] | 1500 | template< typename pass_type > | 
|---|
|  | 1501 | Expression * PassVisitor< pass_type >::mutate( ConstantExpr * node ) { | 
|---|
|  | 1502 | MUTATE_START( node ); | 
|---|
|  | 1503 |  | 
|---|
|  | 1504 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1505 | indexerScopedMutate( node->result, *this ); | 
|---|
| [3c398b6] | 1506 | Constant * ptr = &node->constant; | 
|---|
|  | 1507 | maybeMutate_impl( ptr, *this ); | 
|---|
|  | 1508 | node->constant = *ptr; | 
|---|
| [e0886db] | 1509 |  | 
|---|
|  | 1510 | MUTATE_END( Expression, node ); | 
|---|
|  | 1511 | } | 
|---|
|  | 1512 |  | 
|---|
|  | 1513 | //-------------------------------------------------------------------------- | 
|---|
|  | 1514 | // SizeofExpr | 
|---|
| [13932f14] | 1515 | template< typename pass_type > | 
|---|
| [ab904dc] | 1516 | void PassVisitor< pass_type >::visit( SizeofExpr * node ) { | 
|---|
| [e0886db] | 1517 | VISIT_START( node ); | 
|---|
|  | 1518 |  | 
|---|
|  | 1519 | indexerScopedAccept( node->result, *this ); | 
|---|
|  | 1520 | if ( node->get_isType() ) { | 
|---|
| [3c398b6] | 1521 | maybeAccept_impl( node->type, *this ); | 
|---|
| [e0886db] | 1522 | } else { | 
|---|
| [3c398b6] | 1523 | maybeAccept_impl( node->expr, *this ); | 
|---|
| [e0886db] | 1524 | } | 
|---|
|  | 1525 |  | 
|---|
|  | 1526 | VISIT_END( node ); | 
|---|
| [13932f14] | 1527 | } | 
|---|
|  | 1528 |  | 
|---|
| [e0886db] | 1529 | template< typename pass_type > | 
|---|
|  | 1530 | Expression * PassVisitor< pass_type >::mutate( SizeofExpr * node ) { | 
|---|
|  | 1531 | MUTATE_START( node ); | 
|---|
|  | 1532 |  | 
|---|
|  | 1533 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1534 | indexerScopedMutate( node->result, *this ); | 
|---|
|  | 1535 | if ( node->get_isType() ) { | 
|---|
| [3c398b6] | 1536 | maybeMutate_impl( node->type, *this ); | 
|---|
| [e0886db] | 1537 | } else { | 
|---|
| [3c398b6] | 1538 | maybeMutate_impl( node->expr, *this ); | 
|---|
| [e0886db] | 1539 | } | 
|---|
|  | 1540 |  | 
|---|
|  | 1541 | MUTATE_END( Expression, node ); | 
|---|
|  | 1542 | } | 
|---|
|  | 1543 |  | 
|---|
|  | 1544 | //-------------------------------------------------------------------------- | 
|---|
|  | 1545 | // AlignofExpr | 
|---|
| [13932f14] | 1546 | template< typename pass_type > | 
|---|
| [ab904dc] | 1547 | void PassVisitor< pass_type >::visit( AlignofExpr * node ) { | 
|---|
| [e0886db] | 1548 | VISIT_START( node ); | 
|---|
|  | 1549 |  | 
|---|
|  | 1550 | indexerScopedAccept( node->result, *this ); | 
|---|
|  | 1551 | if ( node->get_isType() ) { | 
|---|
| [3c398b6] | 1552 | maybeAccept_impl( node->type, *this ); | 
|---|
| [e0886db] | 1553 | } else { | 
|---|
| [3c398b6] | 1554 | maybeAccept_impl( node->expr, *this ); | 
|---|
| [e0886db] | 1555 | } | 
|---|
|  | 1556 |  | 
|---|
|  | 1557 | VISIT_END( node ); | 
|---|
| [13932f14] | 1558 | } | 
|---|
|  | 1559 |  | 
|---|
| [e0886db] | 1560 | template< typename pass_type > | 
|---|
|  | 1561 | Expression * PassVisitor< pass_type >::mutate( AlignofExpr * node ) { | 
|---|
|  | 1562 | MUTATE_START( node ); | 
|---|
|  | 1563 |  | 
|---|
|  | 1564 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1565 | indexerScopedMutate( node->result, *this ); | 
|---|
|  | 1566 | if ( node->get_isType() ) { | 
|---|
| [3c398b6] | 1567 | maybeMutate_impl( node->type, *this ); | 
|---|
| [e0886db] | 1568 | } else { | 
|---|
| [3c398b6] | 1569 | maybeMutate_impl( node->expr, *this ); | 
|---|
| [e0886db] | 1570 | } | 
|---|
|  | 1571 |  | 
|---|
|  | 1572 | MUTATE_END( Expression, node ); | 
|---|
|  | 1573 | } | 
|---|
|  | 1574 |  | 
|---|
|  | 1575 | //-------------------------------------------------------------------------- | 
|---|
|  | 1576 | // UntypedOffsetofExpr | 
|---|
| [13932f14] | 1577 | template< typename pass_type > | 
|---|
| [ab904dc] | 1578 | void PassVisitor< pass_type >::visit( UntypedOffsetofExpr * node ) { | 
|---|
| [e0886db] | 1579 | VISIT_START( node ); | 
|---|
|  | 1580 |  | 
|---|
|  | 1581 | indexerScopedAccept( node->result, *this ); | 
|---|
| [3c398b6] | 1582 | maybeAccept_impl   ( node->type  , *this ); | 
|---|
| [e0886db] | 1583 |  | 
|---|
|  | 1584 | VISIT_END( node ); | 
|---|
| [13932f14] | 1585 | } | 
|---|
|  | 1586 |  | 
|---|
| [e0886db] | 1587 | template< typename pass_type > | 
|---|
|  | 1588 | Expression * PassVisitor< pass_type >::mutate( UntypedOffsetofExpr * node ) { | 
|---|
|  | 1589 | MUTATE_START( node ); | 
|---|
|  | 1590 |  | 
|---|
|  | 1591 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1592 | indexerScopedMutate( node->result, *this ); | 
|---|
| [3c398b6] | 1593 | maybeMutate_impl   ( node->type  , *this ); | 
|---|
| [e0886db] | 1594 |  | 
|---|
|  | 1595 | MUTATE_END( Expression, node ); | 
|---|
|  | 1596 | } | 
|---|
|  | 1597 |  | 
|---|
|  | 1598 | //-------------------------------------------------------------------------- | 
|---|
|  | 1599 | // OffsetofExpr | 
|---|
| [13932f14] | 1600 | template< typename pass_type > | 
|---|
| [ab904dc] | 1601 | void PassVisitor< pass_type >::visit( OffsetofExpr * node ) { | 
|---|
| [e0886db] | 1602 | VISIT_START( node ); | 
|---|
|  | 1603 |  | 
|---|
|  | 1604 | indexerScopedAccept( node->result, *this ); | 
|---|
| [3c398b6] | 1605 | maybeAccept_impl   ( node->type  , *this ); | 
|---|
| [e0886db] | 1606 |  | 
|---|
|  | 1607 | VISIT_END( node ); | 
|---|
| [13932f14] | 1608 | } | 
|---|
|  | 1609 |  | 
|---|
| [e0886db] | 1610 | template< typename pass_type > | 
|---|
|  | 1611 | Expression * PassVisitor< pass_type >::mutate( OffsetofExpr * node ) { | 
|---|
|  | 1612 | MUTATE_START( node ); | 
|---|
|  | 1613 |  | 
|---|
|  | 1614 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1615 | indexerScopedMutate( node->result, *this ); | 
|---|
| [3c398b6] | 1616 | maybeMutate_impl   ( node->type  , *this ); | 
|---|
| [e0886db] | 1617 |  | 
|---|
|  | 1618 | MUTATE_END( Expression, node ); | 
|---|
|  | 1619 | } | 
|---|
|  | 1620 |  | 
|---|
|  | 1621 | //-------------------------------------------------------------------------- | 
|---|
|  | 1622 | // OffsetPackExpr | 
|---|
| [13932f14] | 1623 | template< typename pass_type > | 
|---|
| [ab904dc] | 1624 | void PassVisitor< pass_type >::visit( OffsetPackExpr * node ) { | 
|---|
| [e0886db] | 1625 | VISIT_START( node ); | 
|---|
|  | 1626 |  | 
|---|
|  | 1627 | indexerScopedAccept( node->result, *this ); | 
|---|
| [3c398b6] | 1628 | maybeAccept_impl   ( node->type  , *this ); | 
|---|
| [e0886db] | 1629 |  | 
|---|
|  | 1630 | VISIT_END( node ); | 
|---|
| [13932f14] | 1631 | } | 
|---|
|  | 1632 |  | 
|---|
| [e0886db] | 1633 | template< typename pass_type > | 
|---|
|  | 1634 | Expression * PassVisitor< pass_type >::mutate( OffsetPackExpr * node ) { | 
|---|
|  | 1635 | MUTATE_START( node ); | 
|---|
|  | 1636 |  | 
|---|
|  | 1637 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1638 | indexerScopedMutate( node->result, *this ); | 
|---|
| [3c398b6] | 1639 | maybeMutate_impl   ( node->type  , *this ); | 
|---|
| [e0886db] | 1640 |  | 
|---|
|  | 1641 | MUTATE_END( Expression, node ); | 
|---|
|  | 1642 | } | 
|---|
|  | 1643 |  | 
|---|
|  | 1644 | //-------------------------------------------------------------------------- | 
|---|
|  | 1645 | // AttrExpr | 
|---|
| [13932f14] | 1646 | template< typename pass_type > | 
|---|
| [ab904dc] | 1647 | void PassVisitor< pass_type >::visit( AttrExpr * node ) { | 
|---|
| [e0886db] | 1648 | VISIT_START( node ); | 
|---|
|  | 1649 |  | 
|---|
|  | 1650 | indexerScopedAccept( node->result, *this ); | 
|---|
|  | 1651 | if ( node->get_isType() ) { | 
|---|
| [3c398b6] | 1652 | maybeAccept_impl( node->type, *this ); | 
|---|
| [e0886db] | 1653 | } else { | 
|---|
| [3c398b6] | 1654 | maybeAccept_impl( node->expr, *this ); | 
|---|
| [e0886db] | 1655 | } | 
|---|
|  | 1656 |  | 
|---|
|  | 1657 | VISIT_END( node ); | 
|---|
|  | 1658 | } | 
|---|
|  | 1659 |  | 
|---|
|  | 1660 | template< typename pass_type > | 
|---|
|  | 1661 | Expression * PassVisitor< pass_type >::mutate( AttrExpr * node ) { | 
|---|
|  | 1662 | MUTATE_START( node ); | 
|---|
|  | 1663 |  | 
|---|
|  | 1664 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1665 | indexerScopedMutate( node->result, *this ); | 
|---|
|  | 1666 | if ( node->get_isType() ) { | 
|---|
| [3c398b6] | 1667 | maybeMutate_impl( node->type, *this ); | 
|---|
| [e0886db] | 1668 | } else { | 
|---|
| [3c398b6] | 1669 | maybeMutate_impl( node->expr, *this ); | 
|---|
| [e0886db] | 1670 | } | 
|---|
|  | 1671 |  | 
|---|
|  | 1672 | MUTATE_END( Expression, node ); | 
|---|
| [13932f14] | 1673 | } | 
|---|
|  | 1674 |  | 
|---|
| [e0886db] | 1675 | //-------------------------------------------------------------------------- | 
|---|
|  | 1676 | // LogicalExpr | 
|---|
| [13932f14] | 1677 | template< typename pass_type > | 
|---|
| [ab904dc] | 1678 | void PassVisitor< pass_type >::visit( LogicalExpr * node ) { | 
|---|
| [e0886db] | 1679 | VISIT_START( node ); | 
|---|
|  | 1680 |  | 
|---|
|  | 1681 | indexerScopedAccept( node->result, *this ); | 
|---|
| [3c398b6] | 1682 | maybeAccept_impl   ( node->arg1  , *this ); | 
|---|
|  | 1683 | maybeAccept_impl   ( node->arg2  , *this ); | 
|---|
| [e0886db] | 1684 |  | 
|---|
|  | 1685 | VISIT_END( node ); | 
|---|
|  | 1686 | } | 
|---|
|  | 1687 |  | 
|---|
|  | 1688 | template< typename pass_type > | 
|---|
|  | 1689 | Expression * PassVisitor< pass_type >::mutate( LogicalExpr * node ) { | 
|---|
|  | 1690 | MUTATE_START( node ); | 
|---|
|  | 1691 |  | 
|---|
|  | 1692 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1693 | indexerScopedMutate( node->result, *this ); | 
|---|
| [3c398b6] | 1694 | maybeMutate_impl   ( node->arg1  , *this ); | 
|---|
|  | 1695 | maybeMutate_impl   ( node->arg2  , *this ); | 
|---|
| [e0886db] | 1696 |  | 
|---|
|  | 1697 | MUTATE_END( Expression, node ); | 
|---|
| [13932f14] | 1698 | } | 
|---|
|  | 1699 |  | 
|---|
| [e0886db] | 1700 | //-------------------------------------------------------------------------- | 
|---|
|  | 1701 | // ConditionalExpr | 
|---|
| [13932f14] | 1702 | template< typename pass_type > | 
|---|
| [ab904dc] | 1703 | void PassVisitor< pass_type >::visit( ConditionalExpr * node ) { | 
|---|
| [e0886db] | 1704 | VISIT_START( node ); | 
|---|
|  | 1705 |  | 
|---|
|  | 1706 | indexerScopedAccept( node->result, *this ); | 
|---|
| [3c398b6] | 1707 | maybeAccept_impl        ( node->arg1  , *this ); | 
|---|
|  | 1708 | maybeAccept_impl        ( node->arg2  , *this ); | 
|---|
|  | 1709 | maybeAccept_impl        ( node->arg3  , *this ); | 
|---|
| [e0886db] | 1710 |  | 
|---|
|  | 1711 | VISIT_END( node ); | 
|---|
| [13932f14] | 1712 | } | 
|---|
|  | 1713 |  | 
|---|
| [e0886db] | 1714 | template< typename pass_type > | 
|---|
|  | 1715 | Expression * PassVisitor< pass_type >::mutate( ConditionalExpr * node ) { | 
|---|
|  | 1716 | MUTATE_START( node ); | 
|---|
|  | 1717 |  | 
|---|
|  | 1718 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1719 | indexerScopedMutate( node->result, *this ); | 
|---|
| [3c398b6] | 1720 | maybeMutate_impl   ( node->arg1  , *this ); | 
|---|
|  | 1721 | maybeMutate_impl   ( node->arg2  , *this ); | 
|---|
|  | 1722 | maybeMutate_impl   ( node->arg3  , *this ); | 
|---|
| [e0886db] | 1723 |  | 
|---|
|  | 1724 | MUTATE_END( Expression, node ); | 
|---|
|  | 1725 | } | 
|---|
|  | 1726 |  | 
|---|
|  | 1727 | //-------------------------------------------------------------------------- | 
|---|
|  | 1728 | // CommaExpr | 
|---|
| [13932f14] | 1729 | template< typename pass_type > | 
|---|
| [ab904dc] | 1730 | void PassVisitor< pass_type >::visit( CommaExpr * node ) { | 
|---|
| [e0886db] | 1731 | VISIT_START( node ); | 
|---|
|  | 1732 |  | 
|---|
|  | 1733 | indexerScopedAccept( node->result, *this ); | 
|---|
| [3c398b6] | 1734 | maybeAccept_impl   ( node->arg1  , *this ); | 
|---|
|  | 1735 | maybeAccept_impl   ( node->arg2  , *this ); | 
|---|
| [e0886db] | 1736 |  | 
|---|
|  | 1737 | VISIT_END( node ); | 
|---|
|  | 1738 | } | 
|---|
|  | 1739 |  | 
|---|
|  | 1740 | template< typename pass_type > | 
|---|
|  | 1741 | Expression * PassVisitor< pass_type >::mutate( CommaExpr * node ) { | 
|---|
|  | 1742 | MUTATE_START( node ); | 
|---|
|  | 1743 |  | 
|---|
|  | 1744 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1745 | indexerScopedMutate( node->result, *this ); | 
|---|
| [3c398b6] | 1746 | maybeMutate_impl   ( node->arg1  , *this ); | 
|---|
|  | 1747 | maybeMutate_impl   ( node->arg2  , *this ); | 
|---|
| [e0886db] | 1748 |  | 
|---|
|  | 1749 | MUTATE_END( Expression, node ); | 
|---|
| [13932f14] | 1750 | } | 
|---|
|  | 1751 |  | 
|---|
| [e0886db] | 1752 | //-------------------------------------------------------------------------- | 
|---|
|  | 1753 | // TypeExpr | 
|---|
| [13932f14] | 1754 | template< typename pass_type > | 
|---|
| [ab904dc] | 1755 | void PassVisitor< pass_type >::visit( TypeExpr * node ) { | 
|---|
| [e0886db] | 1756 | VISIT_START( node ); | 
|---|
|  | 1757 |  | 
|---|
|  | 1758 | indexerScopedAccept( node->result, *this ); | 
|---|
| [3c398b6] | 1759 | maybeAccept_impl   ( node->type, *this ); | 
|---|
| [e0886db] | 1760 |  | 
|---|
|  | 1761 | VISIT_END( node ); | 
|---|
| [13932f14] | 1762 | } | 
|---|
|  | 1763 |  | 
|---|
| [e0886db] | 1764 | template< typename pass_type > | 
|---|
|  | 1765 | Expression * PassVisitor< pass_type >::mutate( TypeExpr * node ) { | 
|---|
|  | 1766 | MUTATE_START( node ); | 
|---|
|  | 1767 |  | 
|---|
|  | 1768 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1769 | indexerScopedMutate( node->result, *this ); | 
|---|
| [3c398b6] | 1770 | maybeMutate_impl   ( node->type  , *this ); | 
|---|
| [e0886db] | 1771 |  | 
|---|
|  | 1772 | MUTATE_END( Expression, node ); | 
|---|
|  | 1773 | } | 
|---|
|  | 1774 |  | 
|---|
|  | 1775 | //-------------------------------------------------------------------------- | 
|---|
|  | 1776 | // AsmExpr | 
|---|
| [13932f14] | 1777 | template< typename pass_type > | 
|---|
| [ab904dc] | 1778 | void PassVisitor< pass_type >::visit( AsmExpr * node ) { | 
|---|
| [e0886db] | 1779 | VISIT_START( node ); | 
|---|
|  | 1780 |  | 
|---|
|  | 1781 | indexerScopedAccept( node->result    , *this ); | 
|---|
| [3c398b6] | 1782 | maybeAccept_impl   ( node->inout     , *this ); | 
|---|
|  | 1783 | maybeAccept_impl   ( node->constraint, *this ); | 
|---|
|  | 1784 | maybeAccept_impl   ( node->operand   , *this ); | 
|---|
| [e0886db] | 1785 |  | 
|---|
|  | 1786 | VISIT_END( node ); | 
|---|
| [13932f14] | 1787 | } | 
|---|
|  | 1788 |  | 
|---|
| [e0886db] | 1789 | template< typename pass_type > | 
|---|
|  | 1790 | Expression * PassVisitor< pass_type >::mutate( AsmExpr * node ) { | 
|---|
|  | 1791 | MUTATE_START( node ); | 
|---|
|  | 1792 |  | 
|---|
|  | 1793 | indexerScopedMutate( node->env       , *this ); | 
|---|
|  | 1794 | indexerScopedMutate( node->result    , *this ); | 
|---|
| [3c398b6] | 1795 | maybeMutate_impl   ( node->inout     , *this ); | 
|---|
|  | 1796 | maybeMutate_impl   ( node->constraint, *this ); | 
|---|
|  | 1797 | maybeMutate_impl   ( node->operand   , *this ); | 
|---|
| [e0886db] | 1798 |  | 
|---|
|  | 1799 | MUTATE_END( Expression, node ); | 
|---|
|  | 1800 | } | 
|---|
|  | 1801 |  | 
|---|
|  | 1802 | //-------------------------------------------------------------------------- | 
|---|
|  | 1803 | // ImplicitCopyCtorExpr | 
|---|
| [13932f14] | 1804 | template< typename pass_type > | 
|---|
| [ab904dc] | 1805 | void PassVisitor< pass_type >::visit( ImplicitCopyCtorExpr * node ) { | 
|---|
| [e0886db] | 1806 | VISIT_START( node ); | 
|---|
|  | 1807 |  | 
|---|
|  | 1808 | indexerScopedAccept( node->result     , *this ); | 
|---|
| [3c398b6] | 1809 | maybeAccept_impl   ( node->callExpr   , *this ); | 
|---|
|  | 1810 | maybeAccept_impl   ( node->tempDecls  , *this ); | 
|---|
|  | 1811 | maybeAccept_impl   ( node->returnDecls, *this ); | 
|---|
|  | 1812 | maybeAccept_impl   ( node->dtors      , *this ); | 
|---|
| [e0886db] | 1813 |  | 
|---|
|  | 1814 | VISIT_END( node ); | 
|---|
|  | 1815 | } | 
|---|
|  | 1816 |  | 
|---|
|  | 1817 | template< typename pass_type > | 
|---|
|  | 1818 | Expression * PassVisitor< pass_type >::mutate( ImplicitCopyCtorExpr * node ) { | 
|---|
|  | 1819 | MUTATE_START( node ); | 
|---|
|  | 1820 |  | 
|---|
|  | 1821 | indexerScopedMutate( node->env        , *this ); | 
|---|
|  | 1822 | indexerScopedMutate( node->result     , *this ); | 
|---|
| [3c398b6] | 1823 | maybeMutate_impl   ( node->callExpr   , *this ); | 
|---|
|  | 1824 | maybeMutate_impl   ( node->tempDecls  , *this ); | 
|---|
|  | 1825 | maybeMutate_impl   ( node->returnDecls, *this ); | 
|---|
|  | 1826 | maybeMutate_impl   ( node->dtors      , *this ); | 
|---|
| [e0886db] | 1827 |  | 
|---|
|  | 1828 | MUTATE_END( Expression, node ); | 
|---|
| [13932f14] | 1829 | } | 
|---|
|  | 1830 |  | 
|---|
| [e0886db] | 1831 | //-------------------------------------------------------------------------- | 
|---|
|  | 1832 | // ConstructorExpr | 
|---|
| [13932f14] | 1833 | template< typename pass_type > | 
|---|
| [ab904dc] | 1834 | void PassVisitor< pass_type >::visit( ConstructorExpr * node ) { | 
|---|
| [e0886db] | 1835 | VISIT_START( node ); | 
|---|
|  | 1836 |  | 
|---|
|  | 1837 | indexerScopedAccept( node->result  , *this ); | 
|---|
| [3c398b6] | 1838 | maybeAccept_impl   ( node->callExpr, *this ); | 
|---|
| [e0886db] | 1839 |  | 
|---|
|  | 1840 | VISIT_END( node ); | 
|---|
|  | 1841 | } | 
|---|
|  | 1842 |  | 
|---|
|  | 1843 | template< typename pass_type > | 
|---|
|  | 1844 | Expression * PassVisitor< pass_type >::mutate( ConstructorExpr * node ) { | 
|---|
|  | 1845 | MUTATE_START( node ); | 
|---|
|  | 1846 |  | 
|---|
|  | 1847 | indexerScopedMutate( node->env     , *this ); | 
|---|
|  | 1848 | indexerScopedMutate( node->result  , *this ); | 
|---|
| [3c398b6] | 1849 | maybeMutate_impl   ( node->callExpr, *this ); | 
|---|
| [e0886db] | 1850 |  | 
|---|
|  | 1851 | MUTATE_END( Expression, node ); | 
|---|
| [13932f14] | 1852 | } | 
|---|
|  | 1853 |  | 
|---|
| [e0886db] | 1854 | //-------------------------------------------------------------------------- | 
|---|
|  | 1855 | // CompoundLiteralExpr | 
|---|
| [13932f14] | 1856 | template< typename pass_type > | 
|---|
| [ab904dc] | 1857 | void PassVisitor< pass_type >::visit( CompoundLiteralExpr * node ) { | 
|---|
| [e0886db] | 1858 | VISIT_START( node ); | 
|---|
|  | 1859 |  | 
|---|
|  | 1860 | indexerScopedAccept( node->result     , *this ); | 
|---|
| [3c398b6] | 1861 | maybeAccept_impl   ( node->initializer, *this ); | 
|---|
| [e0886db] | 1862 |  | 
|---|
|  | 1863 | VISIT_END( node ); | 
|---|
| [13932f14] | 1864 | } | 
|---|
|  | 1865 |  | 
|---|
| [e0886db] | 1866 | template< typename pass_type > | 
|---|
|  | 1867 | Expression * PassVisitor< pass_type >::mutate( CompoundLiteralExpr * node ) { | 
|---|
|  | 1868 | MUTATE_START( node ); | 
|---|
|  | 1869 |  | 
|---|
|  | 1870 | indexerScopedMutate( node->env        , *this ); | 
|---|
|  | 1871 | indexerScopedMutate( node->result     , *this ); | 
|---|
| [3c398b6] | 1872 | maybeMutate_impl     ( node->initializer, *this ); | 
|---|
| [e0886db] | 1873 |  | 
|---|
|  | 1874 | MUTATE_END( Expression, node ); | 
|---|
|  | 1875 | } | 
|---|
|  | 1876 |  | 
|---|
|  | 1877 | //-------------------------------------------------------------------------- | 
|---|
|  | 1878 | // RangeExpr | 
|---|
| [13932f14] | 1879 | template< typename pass_type > | 
|---|
| [ab904dc] | 1880 | void PassVisitor< pass_type >::visit( RangeExpr * node ) { | 
|---|
| [e0886db] | 1881 | VISIT_START( node ); | 
|---|
|  | 1882 |  | 
|---|
|  | 1883 | indexerScopedAccept( node->result, *this ); | 
|---|
| [3c398b6] | 1884 | maybeAccept_impl   ( node->low   , *this ); | 
|---|
|  | 1885 | maybeAccept_impl   ( node->high  , *this ); | 
|---|
| [e0886db] | 1886 |  | 
|---|
|  | 1887 | VISIT_END( node ); | 
|---|
| [13932f14] | 1888 | } | 
|---|
|  | 1889 |  | 
|---|
| [e0886db] | 1890 | template< typename pass_type > | 
|---|
|  | 1891 | Expression * PassVisitor< pass_type >::mutate( RangeExpr * node ) { | 
|---|
|  | 1892 | MUTATE_START( node ); | 
|---|
|  | 1893 |  | 
|---|
|  | 1894 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1895 | indexerScopedMutate( node->result, *this ); | 
|---|
| [3c398b6] | 1896 | maybeMutate_impl   ( node->low   , *this ); | 
|---|
|  | 1897 | maybeMutate_impl   ( node->high  , *this ); | 
|---|
| [e0886db] | 1898 |  | 
|---|
|  | 1899 | MUTATE_END( Expression, node ); | 
|---|
|  | 1900 | } | 
|---|
|  | 1901 |  | 
|---|
|  | 1902 | //-------------------------------------------------------------------------- | 
|---|
|  | 1903 | // UntypedTupleExpr | 
|---|
| [13932f14] | 1904 | template< typename pass_type > | 
|---|
| [ab904dc] | 1905 | void PassVisitor< pass_type >::visit( UntypedTupleExpr * node ) { | 
|---|
| [e0886db] | 1906 | VISIT_START( node ); | 
|---|
|  | 1907 |  | 
|---|
|  | 1908 | indexerScopedAccept( node->result, *this ); | 
|---|
| [3c398b6] | 1909 | maybeAccept_impl   ( node->exprs , *this ); | 
|---|
| [e0886db] | 1910 |  | 
|---|
|  | 1911 | VISIT_END( node ); | 
|---|
|  | 1912 | } | 
|---|
|  | 1913 |  | 
|---|
|  | 1914 | template< typename pass_type > | 
|---|
|  | 1915 | Expression * PassVisitor< pass_type >::mutate( UntypedTupleExpr * node ) { | 
|---|
|  | 1916 | MUTATE_START( node ); | 
|---|
|  | 1917 |  | 
|---|
|  | 1918 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1919 | indexerScopedMutate( node->result, *this ); | 
|---|
| [3c398b6] | 1920 | maybeMutate_impl   ( node->exprs , *this ); | 
|---|
| [e0886db] | 1921 |  | 
|---|
|  | 1922 | MUTATE_END( Expression, node ); | 
|---|
|  | 1923 | } | 
|---|
|  | 1924 |  | 
|---|
|  | 1925 | //-------------------------------------------------------------------------- | 
|---|
|  | 1926 | // TupleExpr | 
|---|
|  | 1927 | template< typename pass_type > | 
|---|
|  | 1928 | void PassVisitor< pass_type >::visit( TupleExpr * node ) { | 
|---|
|  | 1929 | VISIT_START( node ); | 
|---|
|  | 1930 |  | 
|---|
|  | 1931 | indexerScopedAccept( node->result, *this ); | 
|---|
| [3c398b6] | 1932 | maybeAccept_impl   ( node->exprs , *this ); | 
|---|
| [e0886db] | 1933 |  | 
|---|
|  | 1934 | VISIT_END( node ); | 
|---|
|  | 1935 | } | 
|---|
|  | 1936 |  | 
|---|
|  | 1937 | template< typename pass_type > | 
|---|
|  | 1938 | Expression * PassVisitor< pass_type >::mutate( TupleExpr * node ) { | 
|---|
|  | 1939 | MUTATE_START( node ); | 
|---|
|  | 1940 |  | 
|---|
|  | 1941 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1942 | indexerScopedMutate( node->result, *this ); | 
|---|
| [3c398b6] | 1943 | maybeMutate_impl   ( node->exprs , *this ); | 
|---|
| [e0886db] | 1944 |  | 
|---|
|  | 1945 | MUTATE_END( Expression, node ); | 
|---|
|  | 1946 | } | 
|---|
|  | 1947 |  | 
|---|
|  | 1948 | //-------------------------------------------------------------------------- | 
|---|
|  | 1949 | // TupleIndexExpr | 
|---|
|  | 1950 | template< typename pass_type > | 
|---|
|  | 1951 | void PassVisitor< pass_type >::visit( TupleIndexExpr * node ) { | 
|---|
|  | 1952 | VISIT_START( node ); | 
|---|
|  | 1953 |  | 
|---|
|  | 1954 | indexerScopedAccept( node->result, *this ); | 
|---|
| [3c398b6] | 1955 | maybeAccept_impl   ( node->tuple , *this ); | 
|---|
| [e0886db] | 1956 |  | 
|---|
|  | 1957 | VISIT_END( node ); | 
|---|
|  | 1958 | } | 
|---|
|  | 1959 |  | 
|---|
|  | 1960 | template< typename pass_type > | 
|---|
|  | 1961 | Expression * PassVisitor< pass_type >::mutate( TupleIndexExpr * node ) { | 
|---|
|  | 1962 | MUTATE_START( node ); | 
|---|
|  | 1963 |  | 
|---|
|  | 1964 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 1965 | indexerScopedMutate( node->result, *this ); | 
|---|
| [3c398b6] | 1966 | maybeMutate_impl   ( node->tuple , *this ); | 
|---|
| [e0886db] | 1967 |  | 
|---|
|  | 1968 | MUTATE_END( Expression, node ); | 
|---|
|  | 1969 | } | 
|---|
|  | 1970 |  | 
|---|
|  | 1971 | //-------------------------------------------------------------------------- | 
|---|
|  | 1972 | // TupleAssignExpr | 
|---|
|  | 1973 | template< typename pass_type > | 
|---|
|  | 1974 | void PassVisitor< pass_type >::visit( TupleAssignExpr * node ) { | 
|---|
|  | 1975 | VISIT_START( node ); | 
|---|
|  | 1976 |  | 
|---|
|  | 1977 | indexerScopedAccept( node->result  , *this ); | 
|---|
| [3c398b6] | 1978 | maybeAccept_impl   ( node->stmtExpr, *this ); | 
|---|
| [e0886db] | 1979 |  | 
|---|
|  | 1980 | VISIT_END( node ); | 
|---|
| [13932f14] | 1981 | } | 
|---|
|  | 1982 |  | 
|---|
|  | 1983 | template< typename pass_type > | 
|---|
| [e0886db] | 1984 | Expression * PassVisitor< pass_type >::mutate( TupleAssignExpr * node ) { | 
|---|
|  | 1985 | MUTATE_START( node ); | 
|---|
| [13932f14] | 1986 |  | 
|---|
| [e0886db] | 1987 | indexerScopedMutate( node->env     , *this ); | 
|---|
|  | 1988 | indexerScopedMutate( node->result  , *this ); | 
|---|
| [3c398b6] | 1989 | maybeMutate_impl   ( node->stmtExpr, *this ); | 
|---|
| [13932f14] | 1990 |  | 
|---|
| [e0886db] | 1991 | MUTATE_END( Expression, node ); | 
|---|
| [13932f14] | 1992 | } | 
|---|
|  | 1993 |  | 
|---|
| [9c1600c] | 1994 | //-------------------------------------------------------------------------- | 
|---|
| [e0886db] | 1995 | // StmtExpr | 
|---|
| [13932f14] | 1996 | template< typename pass_type > | 
|---|
| [ab904dc] | 1997 | void PassVisitor< pass_type >::visit( StmtExpr * node ) { | 
|---|
| [9c1600c] | 1998 | VISIT_START( node ); | 
|---|
|  | 1999 |  | 
|---|
|  | 2000 | // don't want statements from outer CompoundStmts to be added to this StmtExpr | 
|---|
| [02fdb8e] | 2001 | ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type >  oldEnv( get_env_ptr() ); | 
|---|
| [9c1600c] | 2002 | ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() ); | 
|---|
|  | 2003 | ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () ); | 
|---|
|  | 2004 |  | 
|---|
| [e0886db] | 2005 | indexerScopedAccept( node->result     , *this ); | 
|---|
| [3c398b6] | 2006 | maybeAccept_impl   ( node->statements , *this ); | 
|---|
|  | 2007 | maybeAccept_impl   ( node->returnDecls, *this ); | 
|---|
|  | 2008 | maybeAccept_impl   ( node->dtors      , *this ); | 
|---|
| [9c1600c] | 2009 |  | 
|---|
|  | 2010 | VISIT_END( node ); | 
|---|
| [13932f14] | 2011 | } | 
|---|
|  | 2012 |  | 
|---|
| [296b2be] | 2013 | template< typename pass_type > | 
|---|
|  | 2014 | Expression * PassVisitor< pass_type >::mutate( StmtExpr * node ) { | 
|---|
|  | 2015 | MUTATE_START( node ); | 
|---|
| [4551a6e] | 2016 |  | 
|---|
| [296b2be] | 2017 | // don't want statements from outer CompoundStmts to be added to this StmtExpr | 
|---|
| [02fdb8e] | 2018 | ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type >  oldEnv( get_env_ptr() ); | 
|---|
| [134322e] | 2019 | ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() ); | 
|---|
|  | 2020 | ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () ); | 
|---|
| [296b2be] | 2021 |  | 
|---|
| [e0886db] | 2022 | indexerScopedMutate( node->result     , *this ); | 
|---|
| [3c398b6] | 2023 | maybeMutate_impl   ( node->statements , *this ); | 
|---|
|  | 2024 | maybeMutate_impl   ( node->returnDecls, *this ); | 
|---|
|  | 2025 | maybeMutate_impl   ( node->dtors      , *this ); | 
|---|
| [296b2be] | 2026 |  | 
|---|
|  | 2027 | MUTATE_END( Expression, node ); | 
|---|
|  | 2028 | } | 
|---|
|  | 2029 |  | 
|---|
| [e0886db] | 2030 | //-------------------------------------------------------------------------- | 
|---|
|  | 2031 | // UniqueExpr | 
|---|
| [13932f14] | 2032 | template< typename pass_type > | 
|---|
| [ab904dc] | 2033 | void PassVisitor< pass_type >::visit( UniqueExpr * node ) { | 
|---|
| [e0886db] | 2034 | VISIT_START( node ); | 
|---|
|  | 2035 |  | 
|---|
|  | 2036 | indexerScopedAccept( node->result, *this ); | 
|---|
| [3c398b6] | 2037 | maybeAccept_impl   ( node->expr  , *this ); | 
|---|
| [e0886db] | 2038 |  | 
|---|
|  | 2039 | VISIT_END( node ); | 
|---|
|  | 2040 | } | 
|---|
|  | 2041 |  | 
|---|
|  | 2042 | template< typename pass_type > | 
|---|
|  | 2043 | Expression * PassVisitor< pass_type >::mutate( UniqueExpr * node ) { | 
|---|
|  | 2044 | MUTATE_START( node ); | 
|---|
|  | 2045 |  | 
|---|
|  | 2046 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 2047 | indexerScopedMutate( node->result, *this ); | 
|---|
| [3c398b6] | 2048 | maybeMutate_impl   ( node->expr  , *this ); | 
|---|
| [e0886db] | 2049 |  | 
|---|
|  | 2050 | MUTATE_END( Expression, node ); | 
|---|
| [13932f14] | 2051 | } | 
|---|
|  | 2052 |  | 
|---|
| [73367a8] | 2053 | //-------------------------------------------------------------------------- | 
|---|
|  | 2054 | // UntypedInitExpr | 
|---|
|  | 2055 | template< typename pass_type > | 
|---|
|  | 2056 | void PassVisitor< pass_type >::visit( UntypedInitExpr * node ) { | 
|---|
|  | 2057 | VISIT_START( node ); | 
|---|
|  | 2058 |  | 
|---|
|  | 2059 | indexerScopedAccept( node->result, *this ); | 
|---|
|  | 2060 | maybeAccept_impl   ( node->expr  , *this ); | 
|---|
|  | 2061 | // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver. | 
|---|
|  | 2062 |  | 
|---|
|  | 2063 | VISIT_END( node ); | 
|---|
|  | 2064 | } | 
|---|
|  | 2065 |  | 
|---|
|  | 2066 | template< typename pass_type > | 
|---|
|  | 2067 | Expression * PassVisitor< pass_type >::mutate( UntypedInitExpr * node ) { | 
|---|
|  | 2068 | MUTATE_START( node ); | 
|---|
|  | 2069 |  | 
|---|
|  | 2070 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 2071 | indexerScopedMutate( node->result, *this ); | 
|---|
|  | 2072 | maybeMutate_impl   ( node->expr  , *this ); | 
|---|
|  | 2073 | // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver. | 
|---|
|  | 2074 |  | 
|---|
|  | 2075 | MUTATE_END( Expression, node ); | 
|---|
|  | 2076 | } | 
|---|
|  | 2077 |  | 
|---|
|  | 2078 | //-------------------------------------------------------------------------- | 
|---|
|  | 2079 | // InitExpr | 
|---|
|  | 2080 | template< typename pass_type > | 
|---|
|  | 2081 | void PassVisitor< pass_type >::visit( InitExpr * node ) { | 
|---|
|  | 2082 | VISIT_START( node ); | 
|---|
|  | 2083 |  | 
|---|
|  | 2084 | indexerScopedAccept( node->result, *this ); | 
|---|
|  | 2085 | maybeAccept_impl   ( node->expr  , *this ); | 
|---|
|  | 2086 | maybeAccept_impl   ( node->designation, *this ); | 
|---|
|  | 2087 |  | 
|---|
|  | 2088 | VISIT_END( node ); | 
|---|
|  | 2089 | } | 
|---|
|  | 2090 |  | 
|---|
|  | 2091 | template< typename pass_type > | 
|---|
|  | 2092 | Expression * PassVisitor< pass_type >::mutate( InitExpr * node ) { | 
|---|
|  | 2093 | MUTATE_START( node ); | 
|---|
|  | 2094 |  | 
|---|
|  | 2095 | indexerScopedMutate( node->env   , *this ); | 
|---|
|  | 2096 | indexerScopedMutate( node->result, *this ); | 
|---|
|  | 2097 | maybeMutate_impl   ( node->expr  , *this ); | 
|---|
|  | 2098 | maybeMutate_impl   ( node->designation, *this ); | 
|---|
|  | 2099 |  | 
|---|
|  | 2100 | MUTATE_END( Expression, node ); | 
|---|
|  | 2101 | } | 
|---|
|  | 2102 |  | 
|---|
| [44b4114] | 2103 | //-------------------------------------------------------------------------- | 
|---|
|  | 2104 | // DeletedExpr | 
|---|
|  | 2105 | template< typename pass_type > | 
|---|
|  | 2106 | void PassVisitor< pass_type >::visit( DeletedExpr * node ) { | 
|---|
|  | 2107 | VISIT_START( node ); | 
|---|
|  | 2108 |  | 
|---|
|  | 2109 | indexerScopedAccept( node->result, *this ); | 
|---|
|  | 2110 | maybeAccept_impl( node->expr, *this ); | 
|---|
|  | 2111 | // don't visit deleteStmt, because it is a pointer to somewhere else in the tree. | 
|---|
|  | 2112 |  | 
|---|
|  | 2113 | VISIT_END( node ); | 
|---|
|  | 2114 | } | 
|---|
|  | 2115 |  | 
|---|
|  | 2116 | template< typename pass_type > | 
|---|
|  | 2117 | Expression * PassVisitor< pass_type >::mutate( DeletedExpr * node ) { | 
|---|
|  | 2118 | MUTATE_START( node ); | 
|---|
|  | 2119 |  | 
|---|
|  | 2120 | indexerScopedMutate( node->env, *this ); | 
|---|
|  | 2121 | indexerScopedMutate( node->result, *this ); | 
|---|
|  | 2122 | maybeMutate_impl( node->expr, *this ); | 
|---|
|  | 2123 |  | 
|---|
|  | 2124 | MUTATE_END( Expression, node ); | 
|---|
|  | 2125 | } | 
|---|
|  | 2126 |  | 
|---|
| [0f79853] | 2127 | //-------------------------------------------------------------------------- | 
|---|
|  | 2128 | // DefaultArgExpr | 
|---|
|  | 2129 | template< typename pass_type > | 
|---|
|  | 2130 | void PassVisitor< pass_type >::visit( DefaultArgExpr * node ) { | 
|---|
|  | 2131 | VISIT_START( node ); | 
|---|
|  | 2132 |  | 
|---|
|  | 2133 | indexerScopedAccept( node->result, *this ); | 
|---|
|  | 2134 | maybeAccept_impl( node->expr, *this ); | 
|---|
|  | 2135 |  | 
|---|
|  | 2136 | VISIT_END( node ); | 
|---|
|  | 2137 | } | 
|---|
|  | 2138 |  | 
|---|
|  | 2139 | template< typename pass_type > | 
|---|
|  | 2140 | Expression * PassVisitor< pass_type >::mutate( DefaultArgExpr * node ) { | 
|---|
|  | 2141 | MUTATE_START( node ); | 
|---|
|  | 2142 |  | 
|---|
|  | 2143 | indexerScopedMutate( node->env, *this ); | 
|---|
|  | 2144 | indexerScopedMutate( node->result, *this ); | 
|---|
|  | 2145 | maybeMutate_impl( node->expr, *this ); | 
|---|
|  | 2146 |  | 
|---|
|  | 2147 | MUTATE_END( Expression, node ); | 
|---|
|  | 2148 | } | 
|---|
|  | 2149 |  | 
|---|
| [d807ca28] | 2150 | //-------------------------------------------------------------------------- | 
|---|
|  | 2151 | // GenericExpr | 
|---|
|  | 2152 | template< typename pass_type > | 
|---|
|  | 2153 | void PassVisitor< pass_type >::visit( GenericExpr * node ) { | 
|---|
|  | 2154 | VISIT_START( node ); | 
|---|
|  | 2155 |  | 
|---|
|  | 2156 | indexerScopedAccept( node->result, *this ); | 
|---|
|  | 2157 | maybeAccept_impl( node->control, *this ); | 
|---|
|  | 2158 | for ( GenericExpr::Association & assoc : node->associations ) { | 
|---|
|  | 2159 | indexerScopedAccept( assoc.type, *this ); | 
|---|
|  | 2160 | maybeAccept_impl( assoc.expr, *this ); | 
|---|
|  | 2161 | } | 
|---|
|  | 2162 |  | 
|---|
|  | 2163 | VISIT_END( node ); | 
|---|
|  | 2164 | } | 
|---|
|  | 2165 |  | 
|---|
|  | 2166 | template< typename pass_type > | 
|---|
|  | 2167 | Expression * PassVisitor< pass_type >::mutate( GenericExpr * node ) { | 
|---|
|  | 2168 | MUTATE_START( node ); | 
|---|
|  | 2169 |  | 
|---|
|  | 2170 | indexerScopedMutate( node->env, *this ); | 
|---|
|  | 2171 | indexerScopedMutate( node->result, *this ); | 
|---|
|  | 2172 | maybeMutate_impl( node->control, *this ); | 
|---|
|  | 2173 | for ( GenericExpr::Association & assoc : node->associations ) { | 
|---|
|  | 2174 | indexerScopedMutate( assoc.type, *this ); | 
|---|
|  | 2175 | maybeMutate_impl( assoc.expr, *this ); | 
|---|
|  | 2176 | } | 
|---|
|  | 2177 |  | 
|---|
|  | 2178 | MUTATE_END( Expression, node ); | 
|---|
|  | 2179 | } | 
|---|
|  | 2180 |  | 
|---|
| [17fc7a5] | 2181 | //-------------------------------------------------------------------------- | 
|---|
|  | 2182 | // VoidType | 
|---|
| [13932f14] | 2183 | template< typename pass_type > | 
|---|
| [ab904dc] | 2184 | void PassVisitor< pass_type >::visit( VoidType * node ) { | 
|---|
| [599fbb6] | 2185 | VISIT_START( node ); | 
|---|
|  | 2186 |  | 
|---|
|  | 2187 | maybeAccept_impl( node->forall, *this ); | 
|---|
|  | 2188 |  | 
|---|
|  | 2189 | VISIT_END( node ); | 
|---|
|  | 2190 | } | 
|---|
|  | 2191 |  | 
|---|
|  | 2192 | template< typename pass_type > | 
|---|
|  | 2193 | Type * PassVisitor< pass_type >::mutate( VoidType * node ) { | 
|---|
|  | 2194 | MUTATE_START( node ); | 
|---|
|  | 2195 |  | 
|---|
|  | 2196 | maybeMutate_impl( node->forall, *this ); | 
|---|
|  | 2197 |  | 
|---|
|  | 2198 | MUTATE_END( Type, node ); | 
|---|
| [13932f14] | 2199 | } | 
|---|
|  | 2200 |  | 
|---|
| [17fc7a5] | 2201 | //-------------------------------------------------------------------------- | 
|---|
|  | 2202 | // BasicType | 
|---|
| [13932f14] | 2203 | template< typename pass_type > | 
|---|
| [ab904dc] | 2204 | void PassVisitor< pass_type >::visit( BasicType * node ) { | 
|---|
| [17fc7a5] | 2205 | VISIT_START( node ); | 
|---|
|  | 2206 |  | 
|---|
|  | 2207 | maybeAccept_impl( node->forall, *this ); | 
|---|
|  | 2208 |  | 
|---|
|  | 2209 | VISIT_END( node ); | 
|---|
|  | 2210 | } | 
|---|
|  | 2211 |  | 
|---|
|  | 2212 | template< typename pass_type > | 
|---|
|  | 2213 | Type * PassVisitor< pass_type >::mutate( BasicType * node ) { | 
|---|
|  | 2214 | MUTATE_START( node ); | 
|---|
|  | 2215 |  | 
|---|
|  | 2216 | maybeMutate_impl( node->forall, *this ); | 
|---|
|  | 2217 |  | 
|---|
|  | 2218 | MUTATE_END( Type, node ); | 
|---|
| [13932f14] | 2219 | } | 
|---|
|  | 2220 |  | 
|---|
| [17fc7a5] | 2221 | //-------------------------------------------------------------------------- | 
|---|
|  | 2222 | // PointerType | 
|---|
| [13932f14] | 2223 | template< typename pass_type > | 
|---|
| [ab904dc] | 2224 | void PassVisitor< pass_type >::visit( PointerType * node ) { | 
|---|
| [17fc7a5] | 2225 | VISIT_START( node ); | 
|---|
|  | 2226 |  | 
|---|
|  | 2227 | maybeAccept_impl( node->forall, *this ); | 
|---|
| [cfaf9be] | 2228 | // xxx - should PointerType visit/mutate dimension? | 
|---|
| [17fc7a5] | 2229 | maybeAccept_impl( node->base, *this ); | 
|---|
|  | 2230 |  | 
|---|
|  | 2231 | VISIT_END( node ); | 
|---|
| [13932f14] | 2232 | } | 
|---|
|  | 2233 |  | 
|---|
| [17fc7a5] | 2234 | template< typename pass_type > | 
|---|
|  | 2235 | Type * PassVisitor< pass_type >::mutate( PointerType * node ) { | 
|---|
|  | 2236 | MUTATE_START( node ); | 
|---|
|  | 2237 |  | 
|---|
|  | 2238 | maybeMutate_impl( node->forall, *this ); | 
|---|
| [cfaf9be] | 2239 | // xxx - should PointerType visit/mutate dimension? | 
|---|
| [17fc7a5] | 2240 | maybeMutate_impl( node->base, *this ); | 
|---|
|  | 2241 |  | 
|---|
|  | 2242 | MUTATE_END( Type, node ); | 
|---|
|  | 2243 | } | 
|---|
|  | 2244 |  | 
|---|
|  | 2245 | //-------------------------------------------------------------------------- | 
|---|
|  | 2246 | // ArrayType | 
|---|
| [13932f14] | 2247 | template< typename pass_type > | 
|---|
| [ab904dc] | 2248 | void PassVisitor< pass_type >::visit( ArrayType * node ) { | 
|---|
| [17fc7a5] | 2249 | VISIT_START( node ); | 
|---|
|  | 2250 |  | 
|---|
|  | 2251 | maybeAccept_impl( node->forall, *this ); | 
|---|
|  | 2252 | maybeAccept_impl( node->dimension, *this ); | 
|---|
|  | 2253 | maybeAccept_impl( node->base, *this ); | 
|---|
|  | 2254 |  | 
|---|
|  | 2255 | VISIT_END( node ); | 
|---|
| [13932f14] | 2256 | } | 
|---|
|  | 2257 |  | 
|---|
| [17fc7a5] | 2258 | template< typename pass_type > | 
|---|
|  | 2259 | Type * PassVisitor< pass_type >::mutate( ArrayType * node ) { | 
|---|
|  | 2260 | MUTATE_START( node ); | 
|---|
|  | 2261 |  | 
|---|
|  | 2262 | maybeMutate_impl( node->forall, *this ); | 
|---|
|  | 2263 | maybeMutate_impl( node->dimension, *this ); | 
|---|
|  | 2264 | maybeMutate_impl( node->base, *this ); | 
|---|
|  | 2265 |  | 
|---|
|  | 2266 | MUTATE_END( Type, node ); | 
|---|
|  | 2267 | } | 
|---|
|  | 2268 |  | 
|---|
|  | 2269 | //-------------------------------------------------------------------------- | 
|---|
|  | 2270 | // ReferenceType | 
|---|
| [6b9b047] | 2271 | template< typename pass_type > | 
|---|
|  | 2272 | void PassVisitor< pass_type >::visit( ReferenceType * node ) { | 
|---|
| [17fc7a5] | 2273 | VISIT_START( node ); | 
|---|
|  | 2274 |  | 
|---|
|  | 2275 | maybeAccept_impl( node->forall, *this ); | 
|---|
|  | 2276 | maybeAccept_impl( node->base, *this ); | 
|---|
|  | 2277 |  | 
|---|
|  | 2278 | VISIT_END( node ); | 
|---|
|  | 2279 | } | 
|---|
|  | 2280 |  | 
|---|
|  | 2281 | template< typename pass_type > | 
|---|
|  | 2282 | Type * PassVisitor< pass_type >::mutate( ReferenceType * node ) { | 
|---|
|  | 2283 | MUTATE_START( node ); | 
|---|
|  | 2284 |  | 
|---|
|  | 2285 | maybeMutate_impl( node->forall, *this ); | 
|---|
|  | 2286 | maybeMutate_impl( node->base, *this ); | 
|---|
|  | 2287 |  | 
|---|
|  | 2288 | MUTATE_END( Type, node ); | 
|---|
| [6b9b047] | 2289 | } | 
|---|
|  | 2290 |  | 
|---|
| [c5d7701] | 2291 | //-------------------------------------------------------------------------- | 
|---|
|  | 2292 | // QualifiedType | 
|---|
|  | 2293 | template< typename pass_type > | 
|---|
|  | 2294 | void PassVisitor< pass_type >::visit( QualifiedType * node ) { | 
|---|
|  | 2295 | VISIT_START( node ); | 
|---|
|  | 2296 |  | 
|---|
|  | 2297 | maybeAccept_impl( node->forall, *this ); | 
|---|
| [c194661] | 2298 | maybeAccept_impl( node->parent, *this ); | 
|---|
|  | 2299 | maybeAccept_impl( node->child, *this ); | 
|---|
| [c5d7701] | 2300 |  | 
|---|
|  | 2301 | VISIT_END( node ); | 
|---|
|  | 2302 | } | 
|---|
|  | 2303 |  | 
|---|
|  | 2304 | template< typename pass_type > | 
|---|
|  | 2305 | Type * PassVisitor< pass_type >::mutate( QualifiedType * node ) { | 
|---|
|  | 2306 | MUTATE_START( node ); | 
|---|
|  | 2307 |  | 
|---|
|  | 2308 | maybeMutate_impl( node->forall, *this ); | 
|---|
| [c194661] | 2309 | maybeMutate_impl( node->parent, *this ); | 
|---|
|  | 2310 | maybeMutate_impl( node->child, *this ); | 
|---|
| [c5d7701] | 2311 |  | 
|---|
|  | 2312 | MUTATE_END( Type, node ); | 
|---|
|  | 2313 | } | 
|---|
|  | 2314 |  | 
|---|
| [17fc7a5] | 2315 | //-------------------------------------------------------------------------- | 
|---|
|  | 2316 | // FunctionType | 
|---|
| [13932f14] | 2317 | template< typename pass_type > | 
|---|
| [ab904dc] | 2318 | void PassVisitor< pass_type >::visit( FunctionType * node ) { | 
|---|
| [17fc7a5] | 2319 | VISIT_START( node ); | 
|---|
|  | 2320 |  | 
|---|
|  | 2321 | maybeAccept_impl( node->forall, *this ); | 
|---|
|  | 2322 | maybeAccept_impl( node->returnVals, *this ); | 
|---|
|  | 2323 | maybeAccept_impl( node->parameters, *this ); | 
|---|
|  | 2324 |  | 
|---|
|  | 2325 | VISIT_END( node ); | 
|---|
|  | 2326 | } | 
|---|
|  | 2327 |  | 
|---|
|  | 2328 | template< typename pass_type > | 
|---|
|  | 2329 | Type * PassVisitor< pass_type >::mutate( FunctionType * node ) { | 
|---|
|  | 2330 | MUTATE_START( node ); | 
|---|
|  | 2331 |  | 
|---|
|  | 2332 | maybeMutate_impl( node->forall, *this ); | 
|---|
|  | 2333 | maybeMutate_impl( node->returnVals, *this ); | 
|---|
|  | 2334 | maybeMutate_impl( node->parameters, *this ); | 
|---|
|  | 2335 |  | 
|---|
|  | 2336 | MUTATE_END( Type, node ); | 
|---|
| [13932f14] | 2337 | } | 
|---|
|  | 2338 |  | 
|---|
| [e0886db] | 2339 | //-------------------------------------------------------------------------- | 
|---|
|  | 2340 | // StructInstType | 
|---|
| [13932f14] | 2341 | template< typename pass_type > | 
|---|
| [ab904dc] | 2342 | void PassVisitor< pass_type >::visit( StructInstType * node ) { | 
|---|
| [e0886db] | 2343 | VISIT_START( node ); | 
|---|
|  | 2344 |  | 
|---|
|  | 2345 | indexerAddStruct( node->name ); | 
|---|
|  | 2346 |  | 
|---|
|  | 2347 | { | 
|---|
|  | 2348 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [3c398b6] | 2349 | maybeAccept_impl( node->forall    , *this ); | 
|---|
|  | 2350 | maybeAccept_impl( node->parameters, *this ); | 
|---|
| [e0886db] | 2351 | } | 
|---|
|  | 2352 |  | 
|---|
|  | 2353 | VISIT_END( node ); | 
|---|
|  | 2354 | } | 
|---|
|  | 2355 |  | 
|---|
|  | 2356 | template< typename pass_type > | 
|---|
|  | 2357 | Type * PassVisitor< pass_type >::mutate( StructInstType * node ) { | 
|---|
|  | 2358 | MUTATE_START( node ); | 
|---|
|  | 2359 |  | 
|---|
|  | 2360 | indexerAddStruct( node->name ); | 
|---|
|  | 2361 |  | 
|---|
|  | 2362 | { | 
|---|
|  | 2363 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [3c398b6] | 2364 | maybeMutate_impl( node->forall    , *this ); | 
|---|
|  | 2365 | maybeMutate_impl( node->parameters, *this ); | 
|---|
| [e0886db] | 2366 | } | 
|---|
|  | 2367 |  | 
|---|
|  | 2368 | MUTATE_END( Type, node ); | 
|---|
| [13932f14] | 2369 | } | 
|---|
|  | 2370 |  | 
|---|
| [e0886db] | 2371 | //-------------------------------------------------------------------------- | 
|---|
|  | 2372 | // UnionInstType | 
|---|
| [13932f14] | 2373 | template< typename pass_type > | 
|---|
| [ab904dc] | 2374 | void PassVisitor< pass_type >::visit( UnionInstType * node ) { | 
|---|
| [e0886db] | 2375 | VISIT_START( node ); | 
|---|
|  | 2376 |  | 
|---|
|  | 2377 | indexerAddStruct( node->name ); | 
|---|
|  | 2378 |  | 
|---|
|  | 2379 | { | 
|---|
|  | 2380 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [3c398b6] | 2381 | maybeAccept_impl( node->forall    , *this ); | 
|---|
|  | 2382 | maybeAccept_impl( node->parameters, *this ); | 
|---|
| [e0886db] | 2383 | } | 
|---|
|  | 2384 |  | 
|---|
|  | 2385 | VISIT_END( node ); | 
|---|
|  | 2386 | } | 
|---|
|  | 2387 |  | 
|---|
|  | 2388 | template< typename pass_type > | 
|---|
|  | 2389 | Type * PassVisitor< pass_type >::mutate( UnionInstType * node ) { | 
|---|
|  | 2390 | MUTATE_START( node ); | 
|---|
|  | 2391 |  | 
|---|
|  | 2392 | indexerAddStruct( node->name ); | 
|---|
|  | 2393 |  | 
|---|
|  | 2394 | { | 
|---|
|  | 2395 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); | 
|---|
| [3c398b6] | 2396 | maybeMutate_impl( node->forall    , *this ); | 
|---|
|  | 2397 | maybeMutate_impl( node->parameters, *this ); | 
|---|
| [e0886db] | 2398 | } | 
|---|
|  | 2399 |  | 
|---|
|  | 2400 | MUTATE_END( Type, node ); | 
|---|
| [13932f14] | 2401 | } | 
|---|
|  | 2402 |  | 
|---|
| [e0886db] | 2403 | //-------------------------------------------------------------------------- | 
|---|
|  | 2404 | // EnumInstType | 
|---|
| [13932f14] | 2405 | template< typename pass_type > | 
|---|
| [ab904dc] | 2406 | void PassVisitor< pass_type >::visit( EnumInstType * node ) { | 
|---|
| [86e84e4] | 2407 | VISIT_START( node ); | 
|---|
|  | 2408 |  | 
|---|
|  | 2409 | maybeAccept_impl( node->forall, *this ); | 
|---|
|  | 2410 | maybeAccept_impl( node->parameters, *this ); | 
|---|
|  | 2411 |  | 
|---|
|  | 2412 | VISIT_END( node ); | 
|---|
| [13932f14] | 2413 | } | 
|---|
|  | 2414 |  | 
|---|
| [e0886db] | 2415 | template< typename pass_type > | 
|---|
|  | 2416 | Type * PassVisitor< pass_type >::mutate( EnumInstType * node ) { | 
|---|
| [86e84e4] | 2417 | MUTATE_START( node ); | 
|---|
|  | 2418 |  | 
|---|
|  | 2419 | maybeMutate_impl( node->forall, *this ); | 
|---|
|  | 2420 | maybeMutate_impl( node->parameters, *this ); | 
|---|
|  | 2421 |  | 
|---|
|  | 2422 | MUTATE_END( Type, node ); | 
|---|
| [e0886db] | 2423 | } | 
|---|
|  | 2424 |  | 
|---|
|  | 2425 | //-------------------------------------------------------------------------- | 
|---|
|  | 2426 | // TraitInstType | 
|---|
| [13932f14] | 2427 | template< typename pass_type > | 
|---|
| [ab904dc] | 2428 | void PassVisitor< pass_type >::visit( TraitInstType * node ) { | 
|---|
| [e0886db] | 2429 | VISIT_START( node ); | 
|---|
|  | 2430 |  | 
|---|
| [3c398b6] | 2431 | maybeAccept_impl( node->forall    , *this ); | 
|---|
|  | 2432 | maybeAccept_impl( node->parameters, *this ); | 
|---|
| [e0886db] | 2433 |  | 
|---|
|  | 2434 | VISIT_END( node ); | 
|---|
|  | 2435 | } | 
|---|
|  | 2436 |  | 
|---|
|  | 2437 | template< typename pass_type > | 
|---|
|  | 2438 | Type * PassVisitor< pass_type >::mutate( TraitInstType * node ) { | 
|---|
|  | 2439 | MUTATE_START( node ); | 
|---|
|  | 2440 |  | 
|---|
| [3c398b6] | 2441 | maybeMutate_impl( node->forall    , *this ); | 
|---|
|  | 2442 | maybeMutate_impl( node->parameters, *this ); | 
|---|
| [e0886db] | 2443 |  | 
|---|
|  | 2444 | MUTATE_END( Type, node ); | 
|---|
| [13932f14] | 2445 | } | 
|---|
|  | 2446 |  | 
|---|
| [e0886db] | 2447 | //-------------------------------------------------------------------------- | 
|---|
|  | 2448 | // TypeInstType | 
|---|
| [13932f14] | 2449 | template< typename pass_type > | 
|---|
| [ab904dc] | 2450 | void PassVisitor< pass_type >::visit( TypeInstType * node ) { | 
|---|
| [86e84e4] | 2451 | VISIT_START( node ); | 
|---|
|  | 2452 |  | 
|---|
|  | 2453 | maybeAccept_impl( node->forall    , *this ); | 
|---|
|  | 2454 | maybeAccept_impl( node->parameters, *this ); | 
|---|
|  | 2455 |  | 
|---|
|  | 2456 | VISIT_END( node ); | 
|---|
|  | 2457 | } | 
|---|
|  | 2458 |  | 
|---|
|  | 2459 | template< typename pass_type > | 
|---|
|  | 2460 | Type * PassVisitor< pass_type >::mutate( TypeInstType * node ) { | 
|---|
|  | 2461 | MUTATE_START( node ); | 
|---|
|  | 2462 |  | 
|---|
|  | 2463 | maybeMutate_impl( node->forall    , *this ); | 
|---|
|  | 2464 | maybeMutate_impl( node->parameters, *this ); | 
|---|
|  | 2465 |  | 
|---|
|  | 2466 | MUTATE_END( Type, node ); | 
|---|
| [13932f14] | 2467 | } | 
|---|
|  | 2468 |  | 
|---|
| [a8a2b0a] | 2469 | //-------------------------------------------------------------------------- | 
|---|
|  | 2470 | // TupleType | 
|---|
| [13932f14] | 2471 | template< typename pass_type > | 
|---|
| [ab904dc] | 2472 | void PassVisitor< pass_type >::visit( TupleType * node ) { | 
|---|
| [a8a2b0a] | 2473 | VISIT_START( node ); | 
|---|
|  | 2474 |  | 
|---|
|  | 2475 | maybeAccept_impl( node->forall, *this ); | 
|---|
|  | 2476 | maybeAccept_impl( node->types, *this ); | 
|---|
|  | 2477 | maybeAccept_impl( node->members, *this ); | 
|---|
|  | 2478 |  | 
|---|
|  | 2479 | VISIT_END( node ); | 
|---|
| [13932f14] | 2480 | } | 
|---|
|  | 2481 |  | 
|---|
| [a8a2b0a] | 2482 | template< typename pass_type > | 
|---|
|  | 2483 | Type * PassVisitor< pass_type >::mutate( TupleType * node ) { | 
|---|
|  | 2484 | MUTATE_START( node ); | 
|---|
|  | 2485 |  | 
|---|
|  | 2486 | maybeMutate_impl( node->forall, *this ); | 
|---|
|  | 2487 | maybeMutate_impl( node->types, *this ); | 
|---|
|  | 2488 | maybeMutate_impl( node->members, *this ); | 
|---|
|  | 2489 |  | 
|---|
|  | 2490 | MUTATE_END( Type, node ); | 
|---|
|  | 2491 | } | 
|---|
|  | 2492 |  | 
|---|
|  | 2493 | //-------------------------------------------------------------------------- | 
|---|
|  | 2494 | // TypeofType | 
|---|
| [13932f14] | 2495 | template< typename pass_type > | 
|---|
| [ab904dc] | 2496 | void PassVisitor< pass_type >::visit( TypeofType * node ) { | 
|---|
| [a8a2b0a] | 2497 | VISIT_START( node ); | 
|---|
|  | 2498 |  | 
|---|
|  | 2499 | assert( node->expr ); | 
|---|
|  | 2500 | maybeAccept_impl( node->expr, *this ); | 
|---|
|  | 2501 |  | 
|---|
|  | 2502 | VISIT_END( node ); | 
|---|
| [13932f14] | 2503 | } | 
|---|
|  | 2504 |  | 
|---|
| [a8a2b0a] | 2505 | template< typename pass_type > | 
|---|
|  | 2506 | Type * PassVisitor< pass_type >::mutate( TypeofType * node ) { | 
|---|
|  | 2507 | MUTATE_START( node ); | 
|---|
|  | 2508 |  | 
|---|
|  | 2509 | assert( node->expr ); | 
|---|
|  | 2510 | maybeMutate_impl( node->expr, *this ); | 
|---|
|  | 2511 |  | 
|---|
|  | 2512 | MUTATE_END( Type, node ); | 
|---|
|  | 2513 | } | 
|---|
|  | 2514 |  | 
|---|
|  | 2515 | //-------------------------------------------------------------------------- | 
|---|
|  | 2516 | // AttrType | 
|---|
| [13932f14] | 2517 | template< typename pass_type > | 
|---|
| [ab904dc] | 2518 | void PassVisitor< pass_type >::visit( AttrType * node ) { | 
|---|
| [a8a2b0a] | 2519 | VISIT_START( node ); | 
|---|
|  | 2520 |  | 
|---|
|  | 2521 | if ( node->isType ) { | 
|---|
|  | 2522 | assert( node->type ); | 
|---|
|  | 2523 | maybeAccept_impl( node->type, *this ); | 
|---|
|  | 2524 | } else { | 
|---|
|  | 2525 | assert( node->expr ); | 
|---|
|  | 2526 | maybeAccept_impl( node->expr, *this ); | 
|---|
|  | 2527 | } // if | 
|---|
|  | 2528 |  | 
|---|
|  | 2529 | VISIT_END( node ); | 
|---|
| [13932f14] | 2530 | } | 
|---|
|  | 2531 |  | 
|---|
| [a8a2b0a] | 2532 | template< typename pass_type > | 
|---|
|  | 2533 | Type * PassVisitor< pass_type >::mutate( AttrType * node ) { | 
|---|
|  | 2534 | MUTATE_START( node ); | 
|---|
|  | 2535 |  | 
|---|
|  | 2536 | if ( node->isType ) { | 
|---|
|  | 2537 | assert( node->type ); | 
|---|
|  | 2538 | maybeMutate_impl( node->type, *this ); | 
|---|
|  | 2539 | } else { | 
|---|
|  | 2540 | assert( node->expr ); | 
|---|
|  | 2541 | maybeMutate_impl( node->expr, *this ); | 
|---|
|  | 2542 | } // if | 
|---|
|  | 2543 |  | 
|---|
|  | 2544 | MUTATE_END( Type, node ); | 
|---|
|  | 2545 | } | 
|---|
|  | 2546 |  | 
|---|
|  | 2547 | //-------------------------------------------------------------------------- | 
|---|
|  | 2548 | // VarArgsType | 
|---|
| [13932f14] | 2549 | template< typename pass_type > | 
|---|
| [ab904dc] | 2550 | void PassVisitor< pass_type >::visit( VarArgsType * node ) { | 
|---|
| [a8a2b0a] | 2551 | VISIT_START( node ); | 
|---|
|  | 2552 |  | 
|---|
|  | 2553 | maybeAccept_impl( node->forall, *this ); | 
|---|
|  | 2554 |  | 
|---|
|  | 2555 | VISIT_END( node ); | 
|---|
| [13932f14] | 2556 | } | 
|---|
|  | 2557 |  | 
|---|
| [a8a2b0a] | 2558 | template< typename pass_type > | 
|---|
|  | 2559 | Type * PassVisitor< pass_type >::mutate( VarArgsType * node ) { | 
|---|
|  | 2560 | MUTATE_START( node ); | 
|---|
|  | 2561 |  | 
|---|
|  | 2562 | maybeMutate_impl( node->forall, *this ); | 
|---|
|  | 2563 |  | 
|---|
|  | 2564 | MUTATE_END( Type, node ); | 
|---|
|  | 2565 | } | 
|---|
|  | 2566 |  | 
|---|
|  | 2567 | //-------------------------------------------------------------------------- | 
|---|
|  | 2568 | // ZeroType | 
|---|
| [13932f14] | 2569 | template< typename pass_type > | 
|---|
| [ab904dc] | 2570 | void PassVisitor< pass_type >::visit( ZeroType * node ) { | 
|---|
| [a8a2b0a] | 2571 | VISIT_START( node ); | 
|---|
|  | 2572 |  | 
|---|
|  | 2573 | maybeAccept_impl( node->forall, *this ); | 
|---|
|  | 2574 |  | 
|---|
|  | 2575 | VISIT_END( node ); | 
|---|
| [13932f14] | 2576 | } | 
|---|
|  | 2577 |  | 
|---|
| [a8a2b0a] | 2578 | template< typename pass_type > | 
|---|
|  | 2579 | Type * PassVisitor< pass_type >::mutate( ZeroType * node ) { | 
|---|
|  | 2580 | MUTATE_START( node ); | 
|---|
|  | 2581 |  | 
|---|
|  | 2582 | maybeMutate_impl( node->forall, *this ); | 
|---|
|  | 2583 |  | 
|---|
|  | 2584 | MUTATE_END( Type, node ); | 
|---|
|  | 2585 | } | 
|---|
|  | 2586 |  | 
|---|
|  | 2587 | //-------------------------------------------------------------------------- | 
|---|
|  | 2588 | // OneType | 
|---|
| [13932f14] | 2589 | template< typename pass_type > | 
|---|
| [ab904dc] | 2590 | void PassVisitor< pass_type >::visit( OneType * node ) { | 
|---|
| [a8a2b0a] | 2591 | VISIT_START( node ); | 
|---|
|  | 2592 |  | 
|---|
|  | 2593 | maybeAccept_impl( node->forall, *this ); | 
|---|
|  | 2594 |  | 
|---|
|  | 2595 | VISIT_END( node ); | 
|---|
| [13932f14] | 2596 | } | 
|---|
|  | 2597 |  | 
|---|
| [a8a2b0a] | 2598 | template< typename pass_type > | 
|---|
|  | 2599 | Type * PassVisitor< pass_type >::mutate( OneType * node ) { | 
|---|
|  | 2600 | MUTATE_START( node ); | 
|---|
|  | 2601 |  | 
|---|
|  | 2602 | maybeMutate_impl( node->forall, *this ); | 
|---|
|  | 2603 |  | 
|---|
|  | 2604 | MUTATE_END( Type, node ); | 
|---|
|  | 2605 | } | 
|---|
|  | 2606 |  | 
|---|
| [47498bd] | 2607 | //-------------------------------------------------------------------------- | 
|---|
|  | 2608 | // GlobalScopeType | 
|---|
|  | 2609 | template< typename pass_type > | 
|---|
|  | 2610 | void PassVisitor< pass_type >::visit( GlobalScopeType * node ) { | 
|---|
|  | 2611 | VISIT_START( node ); | 
|---|
|  | 2612 |  | 
|---|
|  | 2613 | maybeAccept_impl( node->forall, *this ); | 
|---|
|  | 2614 |  | 
|---|
|  | 2615 | VISIT_END( node ); | 
|---|
|  | 2616 | } | 
|---|
|  | 2617 |  | 
|---|
|  | 2618 | template< typename pass_type > | 
|---|
|  | 2619 | Type * PassVisitor< pass_type >::mutate( GlobalScopeType * node ) { | 
|---|
|  | 2620 | MUTATE_START( node ); | 
|---|
|  | 2621 |  | 
|---|
|  | 2622 | maybeMutate_impl( node->forall, *this ); | 
|---|
|  | 2623 |  | 
|---|
|  | 2624 | MUTATE_END( Type, node ); | 
|---|
|  | 2625 | } | 
|---|
|  | 2626 |  | 
|---|
| [a8a2b0a] | 2627 | //-------------------------------------------------------------------------- | 
|---|
|  | 2628 | // Designation | 
|---|
| [b11d8e2] | 2629 | template< typename pass_type > | 
|---|
|  | 2630 | void PassVisitor< pass_type >::visit( Designation * node ) { | 
|---|
|  | 2631 | VISIT_START( node ); | 
|---|
|  | 2632 |  | 
|---|
| [a8a2b0a] | 2633 | maybeAccept_impl( node->designators, *this ); | 
|---|
| [b11d8e2] | 2634 |  | 
|---|
|  | 2635 | VISIT_END( node ); | 
|---|
|  | 2636 | } | 
|---|
|  | 2637 |  | 
|---|
|  | 2638 | template< typename pass_type > | 
|---|
|  | 2639 | Designation * PassVisitor< pass_type >::mutate( Designation * node ) { | 
|---|
|  | 2640 | MUTATE_START( node ); | 
|---|
|  | 2641 |  | 
|---|
| [a8a2b0a] | 2642 | maybeMutate_impl( node->designators, *this ); | 
|---|
| [b11d8e2] | 2643 |  | 
|---|
|  | 2644 | MUTATE_END( Designation, node ); | 
|---|
|  | 2645 | } | 
|---|
|  | 2646 |  | 
|---|
| [9c1600c] | 2647 | //-------------------------------------------------------------------------- | 
|---|
| [e0886db] | 2648 | // SingleInit | 
|---|
| [13932f14] | 2649 | template< typename pass_type > | 
|---|
| [ab904dc] | 2650 | void PassVisitor< pass_type >::visit( SingleInit * node ) { | 
|---|
| [9c1600c] | 2651 | VISIT_START( node ); | 
|---|
|  | 2652 |  | 
|---|
| [a8a2b0a] | 2653 | visitExpression( node->value ); | 
|---|
| [9c1600c] | 2654 |  | 
|---|
|  | 2655 | VISIT_END( node ); | 
|---|
| [13932f14] | 2656 | } | 
|---|
|  | 2657 |  | 
|---|
| [296b2be] | 2658 | template< typename pass_type > | 
|---|
|  | 2659 | Initializer * PassVisitor< pass_type >::mutate( SingleInit * node ) { | 
|---|
|  | 2660 | MUTATE_START( node ); | 
|---|
|  | 2661 |  | 
|---|
| [a8a2b0a] | 2662 | node->value = mutateExpression( node->value ); | 
|---|
| [296b2be] | 2663 |  | 
|---|
|  | 2664 | MUTATE_END( Initializer, node ); | 
|---|
|  | 2665 | } | 
|---|
|  | 2666 |  | 
|---|
| [a8a2b0a] | 2667 | //-------------------------------------------------------------------------- | 
|---|
|  | 2668 | // ListInit | 
|---|
| [13932f14] | 2669 | template< typename pass_type > | 
|---|
| [ab904dc] | 2670 | void PassVisitor< pass_type >::visit( ListInit * node ) { | 
|---|
| [a8a2b0a] | 2671 | VISIT_START( node ); | 
|---|
| [13932f14] | 2672 |  | 
|---|
| [a8a2b0a] | 2673 | maybeAccept_impl( node->designations, *this ); | 
|---|
|  | 2674 | maybeAccept_impl( node->initializers, *this ); | 
|---|
| [13932f14] | 2675 |  | 
|---|
| [a8a2b0a] | 2676 | VISIT_END( node ); | 
|---|
| [13932f14] | 2677 | } | 
|---|
|  | 2678 |  | 
|---|
|  | 2679 | template< typename pass_type > | 
|---|
| [a8a2b0a] | 2680 | Initializer * PassVisitor< pass_type >::mutate( ListInit * node ) { | 
|---|
|  | 2681 | MUTATE_START( node ); | 
|---|
|  | 2682 |  | 
|---|
|  | 2683 | maybeMutate_impl( node->designations, *this ); | 
|---|
|  | 2684 | maybeMutate_impl( node->initializers, *this ); | 
|---|
|  | 2685 |  | 
|---|
|  | 2686 | MUTATE_END( Initializer, node ); | 
|---|
| [13932f14] | 2687 | } | 
|---|
| [ab904dc] | 2688 |  | 
|---|
| [a8a2b0a] | 2689 | //-------------------------------------------------------------------------- | 
|---|
|  | 2690 | // ConstructorInit | 
|---|
| [5ea7a22] | 2691 | template< typename pass_type > | 
|---|
| [a8a2b0a] | 2692 | void PassVisitor< pass_type >::visit( ConstructorInit * node ) { | 
|---|
|  | 2693 | VISIT_START( node ); | 
|---|
| [5ea7a22] | 2694 |  | 
|---|
| [a8a2b0a] | 2695 | maybeAccept_impl( node->ctor, *this ); | 
|---|
|  | 2696 | maybeAccept_impl( node->dtor, *this ); | 
|---|
|  | 2697 | maybeAccept_impl( node->init, *this ); | 
|---|
| [ab904dc] | 2698 |  | 
|---|
| [a8a2b0a] | 2699 | VISIT_END( node ); | 
|---|
| [ab904dc] | 2700 | } | 
|---|
|  | 2701 |  | 
|---|
|  | 2702 | template< typename pass_type > | 
|---|
| [a8a2b0a] | 2703 | Initializer * PassVisitor< pass_type >::mutate( ConstructorInit * node ) { | 
|---|
|  | 2704 | MUTATE_START( node ); | 
|---|
| [ab904dc] | 2705 |  | 
|---|
| [a8a2b0a] | 2706 | maybeMutate_impl( node->ctor, *this ); | 
|---|
|  | 2707 | maybeMutate_impl( node->dtor, *this ); | 
|---|
|  | 2708 | maybeMutate_impl( node->init, *this ); | 
|---|
| [ab904dc] | 2709 |  | 
|---|
| [a8a2b0a] | 2710 | MUTATE_END( Initializer, node ); | 
|---|
| [ab904dc] | 2711 | } | 
|---|
|  | 2712 |  | 
|---|
| [a8a2b0a] | 2713 | //-------------------------------------------------------------------------- | 
|---|
|  | 2714 | // Attribute | 
|---|
| [ab904dc] | 2715 | template< typename pass_type > | 
|---|
| [a8a2b0a] | 2716 | void PassVisitor< pass_type >::visit( Constant * node ) { | 
|---|
|  | 2717 | VISIT_START( node ); | 
|---|
|  | 2718 |  | 
|---|
|  | 2719 | VISIT_END( node ); | 
|---|
| [ab904dc] | 2720 | } | 
|---|
|  | 2721 |  | 
|---|
|  | 2722 | template< typename pass_type > | 
|---|
| [a8a2b0a] | 2723 | Constant * PassVisitor< pass_type >::mutate( Constant * node  )  { | 
|---|
|  | 2724 | MUTATE_START( node ); | 
|---|
|  | 2725 |  | 
|---|
|  | 2726 | MUTATE_END( Constant, node ); | 
|---|
| [ab904dc] | 2727 | } | 
|---|
|  | 2728 |  | 
|---|
| [a8a2b0a] | 2729 | //-------------------------------------------------------------------------- | 
|---|
|  | 2730 | // Attribute | 
|---|
| [ab904dc] | 2731 | template< typename pass_type > | 
|---|
| [a8a2b0a] | 2732 | void PassVisitor< pass_type >::visit( Attribute * node ) { | 
|---|
|  | 2733 | VISIT_START( node ); | 
|---|
|  | 2734 |  | 
|---|
|  | 2735 | maybeAccept_impl( node->parameters, *this ); | 
|---|
|  | 2736 |  | 
|---|
|  | 2737 | VISIT_END( node ); | 
|---|
| [4551a6e] | 2738 | } | 
|---|
| [5ea7a22] | 2739 |  | 
|---|
|  | 2740 | template< typename pass_type > | 
|---|
|  | 2741 | Attribute * PassVisitor< pass_type >::mutate( Attribute * node  )  { | 
|---|
| [a8a2b0a] | 2742 | MUTATE_START( node ); | 
|---|
|  | 2743 |  | 
|---|
|  | 2744 | maybeMutate_impl( node->parameters, *this ); | 
|---|
|  | 2745 |  | 
|---|
|  | 2746 | MUTATE_END( Attribute, node ); | 
|---|
| [5ea7a22] | 2747 | } | 
|---|
| [447c356] | 2748 |  | 
|---|
| [a8a2b0a] | 2749 | //-------------------------------------------------------------------------- | 
|---|
|  | 2750 | // TypeSubstitution | 
|---|
| [447c356] | 2751 | template< typename pass_type > | 
|---|
|  | 2752 | TypeSubstitution * PassVisitor< pass_type >::mutate( TypeSubstitution * node ) { | 
|---|
|  | 2753 | MUTATE_START( node ); | 
|---|
|  | 2754 |  | 
|---|
|  | 2755 | for ( auto & p : node->typeEnv ) { | 
|---|
|  | 2756 | indexerScopedMutate( p.second, *this ); | 
|---|
|  | 2757 | } | 
|---|
|  | 2758 | for ( auto & p : node->varEnv ) { | 
|---|
|  | 2759 | indexerScopedMutate( p.second, *this ); | 
|---|
|  | 2760 | } | 
|---|
|  | 2761 |  | 
|---|
|  | 2762 | MUTATE_END( TypeSubstitution, node ); | 
|---|
|  | 2763 | } | 
|---|