Ignore:
File:
1 edited

Legend:

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

    r6a45bd78 r665f432  
    532532                        indexerAddId( &func );
    533533                        maybeAccept_impl( node->type, *this );
    534                         // First remember that we are now within a function.
     534                        // function body needs to have the same scope as parameters - CompoundStmt will not enter
     535                        // a new scope if inFunction is true
    535536                        ValueGuard< bool > oldInFunction( inFunction );
    536537                        inFunction = true;
    537                         // The function body needs to have the same scope as parameters.
    538                         // A CompoundStmt will not enter a new scope if atFunctionTop is true.
    539                         ValueGuard< bool > oldAtFunctionTop( atFunctionTop );
    540                         atFunctionTop = true;
    541538                        maybeAccept_impl( node->statements, *this );
    542539                        maybeAccept_impl( node->attributes, *this );
     
    570567                        indexerAddId( &func );
    571568                        maybeAccept_impl( node->type, *this );
    572                         // First remember that we are now within a function.
     569                        // function body needs to have the same scope as parameters - CompoundStmt will not enter
     570                        // a new scope if inFunction is true
    573571                        ValueGuard< bool > oldInFunction( inFunction );
    574572                        inFunction = true;
    575                         // The function body needs to have the same scope as parameters.
    576                         // A CompoundStmt will not enter a new scope if atFunctionTop is true.
    577                         ValueGuard< bool > oldAtFunctionTop( atFunctionTop );
    578                         atFunctionTop = true;
    579573                        maybeAccept_impl( node->statements, *this );
    580574                        maybeAccept_impl( node->attributes, *this );
     
    607601                        indexerAddId( &func );
    608602                        maybeMutate_impl( node->type, *this );
    609                         // First remember that we are now within a function.
     603                        // function body needs to have the same scope as parameters - CompoundStmt will not enter
     604                        // a new scope if inFunction is true
    610605                        ValueGuard< bool > oldInFunction( inFunction );
    611606                        inFunction = true;
    612                         // The function body needs to have the same scope as parameters.
    613                         // A CompoundStmt will not enter a new scope if atFunctionTop is true.
    614                         ValueGuard< bool > oldAtFunctionTop( atFunctionTop );
    615                         atFunctionTop = true;
    616607                        maybeMutate_impl( node->statements, *this );
    617608                        maybeMutate_impl( node->attributes, *this );
     
    835826        {
    836827                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     828                maybeAccept_impl( node->parameters, *this );
    837829                maybeAccept_impl( node->base      , *this );
    838830        }
     
    857849        {
    858850                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     851                maybeAccept_impl( node->parameters, *this );
    859852                maybeAccept_impl( node->base      , *this );
    860853        }
     
    878871        {
    879872                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     873                maybeMutate_impl( node->parameters, *this );
    880874                maybeMutate_impl( node->base      , *this );
    881875        }
     
    901895        {
    902896                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     897                maybeAccept_impl( node->parameters, *this );
    903898                maybeAccept_impl( node->base      , *this );
    904899        }
     
    917912        {
    918913                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     914                maybeAccept_impl( node->parameters, *this );
    919915                maybeAccept_impl( node->base      , *this );
    920916        }
     
    933929        {
    934930                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     931                maybeMutate_impl( node->parameters, *this );
    935932                maybeMutate_impl( node->base      , *this );
    936933        }
     
    10101007        VISIT_START( node );
    10111008        {
    1012                 // Do not enter a new scope if atFunctionTop is true, don't leave one either.
    1013                 ValueGuard< bool > oldAtFunctionTop( atFunctionTop );
    1014                 auto guard1 = makeFuncGuard( [this, go = !atFunctionTop]() { if ( go ) indexerScopeEnter(); }, [this, go = !atFunctionTop]() { if ( go ) indexerScopeLeave(); } );
     1009                // do not enter a new scope if inFunction is true - needs to check old state before the assignment
     1010                ValueGuard< bool > oldInFunction( inFunction );
     1011                auto guard1 = makeFuncGuard( [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeEnter(); }, [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeLeave(); } );
    10151012                auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
    1016                 atFunctionTop = false;
     1013                inFunction = false;
    10171014                visitStatementList( node->kids );
    10181015        }
     
    10241021        VISIT_START( node );
    10251022        {
    1026                 // Do not enter a new scope if atFunctionTop is true, don't leave one either.
    1027                 ValueGuard< bool > oldAtFunctionTop( atFunctionTop );
    1028                 auto guard1 = makeFuncGuard( [this, go = !atFunctionTop]() { if ( go ) indexerScopeEnter(); }, [this, go = !atFunctionTop]() { if ( go ) indexerScopeLeave(); } );
     1023                // do not enter a new scope if inFunction is true - needs to check old state before the assignment
     1024                ValueGuard< bool > oldInFunction( inFunction );
     1025                auto guard1 = makeFuncGuard( [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeEnter(); }, [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeLeave(); } );
    10291026                auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
    1030                 atFunctionTop = false;
     1027                inFunction = false;
    10311028                visitStatementList( node->kids );
    10321029        }
     
    10381035        MUTATE_START( node );
    10391036        {
    1040                 // Do not enter a new scope if atFunctionTop is true, don't leave one either.
    1041                 ValueGuard< bool > oldAtFunctionTop( atFunctionTop );
    1042                 auto guard1 = makeFuncGuard( [this, go = !atFunctionTop]() { if ( go ) indexerScopeEnter(); }, [this, go = !atFunctionTop]() { if ( go ) indexerScopeLeave(); } );
     1037                // do not enter a new scope if inFunction is true - needs to check old state before the assignment
     1038                ValueGuard< bool > oldInFunction( inFunction );
     1039                auto guard1 = makeFuncGuard( [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeEnter(); }, [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeLeave(); } );
    10431040                auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
    1044                 atFunctionTop = false;
     1041                inFunction = false;
    10451042                mutateStatementList( node->kids );
    10461043        }
     
    15251522
    15261523//--------------------------------------------------------------------------
    1527 // SuspendStmt
    1528 template< typename pass_type >
    1529 void PassVisitor< pass_type >::visit( SuspendStmt * node ) {
    1530         VISIT_START( node );
    1531 
    1532         maybeAccept_impl( node->then  , *this );
    1533 
    1534         VISIT_END( node );
    1535 }
    1536 
    1537 template< typename pass_type >
    1538 void PassVisitor< pass_type >::visit( const SuspendStmt * node ) {
    1539         VISIT_START( node );
    1540 
    1541         maybeAccept_impl( node->then  , *this );
    1542 
    1543         VISIT_END( node );
    1544 }
    1545 
    1546 template< typename pass_type >
    1547 Statement * PassVisitor< pass_type >::mutate( SuspendStmt * node ) {
    1548         MUTATE_START( node );
    1549 
    1550         maybeMutate_impl( node->then  , *this );
    1551 
    1552         MUTATE_END( Statement, node );
    1553 }
    1554 
    1555 //--------------------------------------------------------------------------
    15561524// WaitForStmt
    15571525template< typename pass_type >
     
    33343302        VISIT_START( node );
    33353303
    3336         indexerAddUnion( node->name );
     3304        indexerAddStruct( node->name );
    33373305
    33383306        {
     
    33493317        VISIT_START( node );
    33503318
    3351         indexerAddUnion( node->name );
     3319        indexerAddStruct( node->name );
    33523320
    33533321        {
     
    33643332        MUTATE_START( node );
    33653333
    3366         indexerAddUnion( node->name );
     3334        indexerAddStruct( node->name );
    33673335
    33683336        {
Note: See TracChangeset for help on using the changeset viewer.