Changeset a8a2b0a for src/Common


Ignore:
Timestamp:
Mar 1, 2018, 4:58:03 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
2ec65ad
Parents:
babeeda
git-author:
Rob Schluntz <rschlunt@…> (03/01/18 15:17:24)
git-committer:
Rob Schluntz <rschlunt@…> (03/01/18 16:58:03)
Message:

Expand VISIT/MUTATE_BODY for remaining node types

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/PassVisitor.impl.h

    rbabeeda ra8a2b0a  
    22772277}
    22782278
    2279 
     2279//--------------------------------------------------------------------------
     2280// TupleType
    22802281template< typename pass_type >
    22812282void PassVisitor< pass_type >::visit( TupleType * node ) {
    2282         VISIT_BODY( node );
    2283 }
    2284 
     2283        VISIT_START( node );
     2284
     2285        maybeAccept_impl( node->forall, *this );
     2286        maybeAccept_impl( node->types, *this );
     2287        maybeAccept_impl( node->members, *this );
     2288
     2289        VISIT_END( node );
     2290}
     2291
     2292template< typename pass_type >
     2293Type * PassVisitor< pass_type >::mutate( TupleType * node ) {
     2294        MUTATE_START( node );
     2295
     2296        maybeMutate_impl( node->forall, *this );
     2297        maybeMutate_impl( node->types, *this );
     2298        maybeMutate_impl( node->members, *this );
     2299
     2300        MUTATE_END( Type, node );
     2301}
     2302
     2303//--------------------------------------------------------------------------
     2304// TypeofType
    22852305template< typename pass_type >
    22862306void PassVisitor< pass_type >::visit( TypeofType * node ) {
    2287         VISIT_BODY( node );
    2288 }
    2289 
     2307        VISIT_START( node );
     2308
     2309        assert( node->expr );
     2310        maybeAccept_impl( node->expr, *this );
     2311
     2312        VISIT_END( node );
     2313}
     2314
     2315template< typename pass_type >
     2316Type * PassVisitor< pass_type >::mutate( TypeofType * node ) {
     2317        MUTATE_START( node );
     2318
     2319        assert( node->expr );
     2320        maybeMutate_impl( node->expr, *this );
     2321
     2322        MUTATE_END( Type, node );
     2323}
     2324
     2325//--------------------------------------------------------------------------
     2326// AttrType
    22902327template< typename pass_type >
    22912328void PassVisitor< pass_type >::visit( AttrType * node ) {
    2292         VISIT_BODY( node );
    2293 }
    2294 
     2329        VISIT_START( node );
     2330
     2331        if ( node->isType ) {
     2332                assert( node->type );
     2333                maybeAccept_impl( node->type, *this );
     2334        } else {
     2335                assert( node->expr );
     2336                maybeAccept_impl( node->expr, *this );
     2337        } // if
     2338
     2339        VISIT_END( node );
     2340}
     2341
     2342template< typename pass_type >
     2343Type * PassVisitor< pass_type >::mutate( AttrType * node ) {
     2344        MUTATE_START( node );
     2345
     2346        if ( node->isType ) {
     2347                assert( node->type );
     2348                maybeMutate_impl( node->type, *this );
     2349        } else {
     2350                assert( node->expr );
     2351                maybeMutate_impl( node->expr, *this );
     2352        } // if
     2353
     2354        MUTATE_END( Type, node );
     2355}
     2356
     2357//--------------------------------------------------------------------------
     2358// VarArgsType
    22952359template< typename pass_type >
    22962360void PassVisitor< pass_type >::visit( VarArgsType * node ) {
    2297         VISIT_BODY( node );
    2298 }
    2299 
     2361        VISIT_START( node );
     2362
     2363        maybeAccept_impl( node->forall, *this );
     2364
     2365        VISIT_END( node );
     2366}
     2367
     2368template< typename pass_type >
     2369Type * PassVisitor< pass_type >::mutate( VarArgsType * node ) {
     2370        MUTATE_START( node );
     2371
     2372        maybeMutate_impl( node->forall, *this );
     2373
     2374        MUTATE_END( Type, node );
     2375}
     2376
     2377//--------------------------------------------------------------------------
     2378// ZeroType
    23002379template< typename pass_type >
    23012380void PassVisitor< pass_type >::visit( ZeroType * node ) {
    2302         VISIT_BODY( node );
    2303 }
    2304 
     2381        VISIT_START( node );
     2382
     2383        maybeAccept_impl( node->forall, *this );
     2384
     2385        VISIT_END( node );
     2386}
     2387
     2388template< typename pass_type >
     2389Type * PassVisitor< pass_type >::mutate( ZeroType * node ) {
     2390        MUTATE_START( node );
     2391
     2392        maybeMutate_impl( node->forall, *this );
     2393
     2394        MUTATE_END( Type, node );
     2395}
     2396
     2397//--------------------------------------------------------------------------
     2398// OneType
    23052399template< typename pass_type >
    23062400void PassVisitor< pass_type >::visit( OneType * node ) {
    2307         VISIT_BODY( node );
    2308 }
    2309 
     2401        VISIT_START( node );
     2402
     2403        maybeAccept_impl( node->forall, *this );
     2404
     2405        VISIT_END( node );
     2406}
     2407
     2408template< typename pass_type >
     2409Type * PassVisitor< pass_type >::mutate( OneType * node ) {
     2410        MUTATE_START( node );
     2411
     2412        maybeMutate_impl( node->forall, *this );
     2413
     2414        MUTATE_END( Type, node );
     2415}
     2416
     2417//--------------------------------------------------------------------------
     2418// Designation
    23102419template< typename pass_type >
    23112420void PassVisitor< pass_type >::visit( Designation * node ) {
    23122421        VISIT_START( node );
    23132422
    2314         maybeAccept_impl( node->get_designators(), *this );
     2423        maybeAccept_impl( node->designators, *this );
    23152424
    23162425        VISIT_END( node );
     
    23212430        MUTATE_START( node );
    23222431
    2323         maybeMutate_impl( node->get_designators(), *this );
     2432        maybeMutate_impl( node->designators, *this );
    23242433
    23252434        MUTATE_END( Designation, node );
     
    23322441        VISIT_START( node );
    23332442
    2334         visitExpression( node->get_value() );
     2443        visitExpression( node->value );
    23352444
    23362445        VISIT_END( node );
     
    23412450        MUTATE_START( node );
    23422451
    2343         node->set_value( mutateExpression( node->get_value() ) );
     2452        node->value = mutateExpression( node->value );
    23442453
    23452454        MUTATE_END( Initializer, node );
    23462455}
    23472456
     2457//--------------------------------------------------------------------------
     2458// ListInit
    23482459template< typename pass_type >
    23492460void PassVisitor< pass_type >::visit( ListInit * node ) {
    2350         VISIT_BODY( node );
    2351 }
    2352 
     2461        VISIT_START( node );
     2462
     2463        maybeAccept_impl( node->designations, *this );
     2464        maybeAccept_impl( node->initializers, *this );
     2465
     2466        VISIT_END( node );
     2467}
     2468
     2469template< typename pass_type >
     2470Initializer * PassVisitor< pass_type >::mutate( ListInit * node ) {
     2471        MUTATE_START( node );
     2472
     2473        maybeMutate_impl( node->designations, *this );
     2474        maybeMutate_impl( node->initializers, *this );
     2475
     2476        MUTATE_END( Initializer, node );
     2477}
     2478
     2479//--------------------------------------------------------------------------
     2480// ConstructorInit
    23532481template< typename pass_type >
    23542482void PassVisitor< pass_type >::visit( ConstructorInit * node ) {
    2355         VISIT_BODY( node );
    2356 }
    2357 
     2483        VISIT_START( node );
     2484
     2485        maybeAccept_impl( node->ctor, *this );
     2486        maybeAccept_impl( node->dtor, *this );
     2487        maybeAccept_impl( node->init, *this );
     2488
     2489        VISIT_END( node );
     2490}
     2491
     2492template< typename pass_type >
     2493Initializer * PassVisitor< pass_type >::mutate( ConstructorInit * node ) {
     2494        MUTATE_START( node );
     2495
     2496        maybeMutate_impl( node->ctor, *this );
     2497        maybeMutate_impl( node->dtor, *this );
     2498        maybeMutate_impl( node->init, *this );
     2499
     2500        MUTATE_END( Initializer, node );
     2501}
     2502
     2503//--------------------------------------------------------------------------
     2504// Subrange
    23582505template< typename pass_type >
    23592506void PassVisitor< pass_type >::visit( Subrange * node ) {
    2360         VISIT_BODY( node );
    2361 }
    2362 
     2507        VISIT_START( node );
     2508
     2509        VISIT_END( node );
     2510}
     2511
     2512template< typename pass_type >
     2513Subrange * PassVisitor< pass_type >::mutate( Subrange * node  )  {
     2514        MUTATE_START( node );
     2515
     2516        MUTATE_END( Subrange, node );
     2517}
     2518
     2519//--------------------------------------------------------------------------
     2520// Attribute
    23632521template< typename pass_type >
    23642522void PassVisitor< pass_type >::visit( Constant * node ) {
    2365         VISIT_BODY( node );
    2366 }
    2367 
     2523        VISIT_START( node );
     2524
     2525        VISIT_END( node );
     2526}
     2527
     2528template< typename pass_type >
     2529Constant * PassVisitor< pass_type >::mutate( Constant * node  )  {
     2530        MUTATE_START( node );
     2531
     2532        MUTATE_END( Constant, node );
     2533}
     2534
     2535//--------------------------------------------------------------------------
     2536// Attribute
    23682537template< typename pass_type >
    23692538void PassVisitor< pass_type >::visit( Attribute * node ) {
    2370         VISIT_BODY( node );
    2371 }
    2372 
    2373 //---------------------------------------------------------------------------------------------------------------
    2374 
    2375 template< typename pass_type >
    2376 Type * PassVisitor< pass_type >::mutate( TupleType * node ) {
    2377         MUTATE_BODY( Type, node );
    2378 }
    2379 
    2380 template< typename pass_type >
    2381 Type * PassVisitor< pass_type >::mutate( TypeofType * node ) {
    2382         MUTATE_BODY( Type, node );
    2383 }
    2384 
    2385 template< typename pass_type >
    2386 Type * PassVisitor< pass_type >::mutate( AttrType * node ) {
    2387         MUTATE_BODY( Type, node );
    2388 }
    2389 
    2390 template< typename pass_type >
    2391 Type * PassVisitor< pass_type >::mutate( VarArgsType * node ) {
    2392         MUTATE_BODY( Type, node );
    2393 }
    2394 
    2395 template< typename pass_type >
    2396 Type * PassVisitor< pass_type >::mutate( ZeroType * node ) {
    2397         MUTATE_BODY( Type, node );
    2398 }
    2399 
    2400 template< typename pass_type >
    2401 Type * PassVisitor< pass_type >::mutate( OneType * node ) {
    2402         MUTATE_BODY( Type, node );
    2403 }
    2404 
    2405 template< typename pass_type >
    2406 Initializer * PassVisitor< pass_type >::mutate( ListInit * node ) {
    2407         MUTATE_BODY( Initializer, node );
    2408 }
    2409 
    2410 template< typename pass_type >
    2411 Initializer * PassVisitor< pass_type >::mutate( ConstructorInit * node ) {
    2412         MUTATE_BODY( Initializer, node );
    2413 }
    2414 
    2415 template< typename pass_type >
    2416 Subrange * PassVisitor< pass_type >::mutate( Subrange * node  )  {
    2417         MUTATE_BODY( Subrange, node );
    2418 }
    2419 
    2420 template< typename pass_type >
    2421 Constant * PassVisitor< pass_type >::mutate( Constant * node  )  {
    2422         MUTATE_BODY( Constant, node );
     2539        VISIT_START( node );
     2540
     2541        maybeAccept_impl( node->parameters, *this );
     2542
     2543        VISIT_END( node );
    24232544}
    24242545
    24252546template< typename pass_type >
    24262547Attribute * PassVisitor< pass_type >::mutate( Attribute * node  )  {
    2427         MUTATE_BODY( Attribute, node );
    2428 }
    2429 
     2548        MUTATE_START( node );
     2549
     2550        maybeMutate_impl( node->parameters, *this );
     2551
     2552        MUTATE_END( Attribute, node );
     2553}
     2554
     2555//--------------------------------------------------------------------------
     2556// TypeSubstitution
    24302557template< typename pass_type >
    24312558TypeSubstitution * PassVisitor< pass_type >::mutate( TypeSubstitution * node ) {
Note: See TracChangeset for help on using the changeset viewer.