Ignore:
File:
1 edited

Legend:

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

    rc6c682cf r37cdd97  
    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 );
     
    10161007        VISIT_START( node );
    10171008        {
    1018                 // Do not enter a new scope if atFunctionTop is true, don't leave one either.
    1019                 ValueGuard< bool > oldAtFunctionTop( atFunctionTop );
    1020                 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(); } );
    10211012                auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
    1022                 atFunctionTop = false;
     1013                inFunction = false;
    10231014                visitStatementList( node->kids );
    10241015        }
     
    10301021        VISIT_START( node );
    10311022        {
    1032                 // Do not enter a new scope if atFunctionTop is true, don't leave one either.
    1033                 ValueGuard< bool > oldAtFunctionTop( atFunctionTop );
    1034                 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(); } );
    10351026                auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
    1036                 atFunctionTop = false;
     1027                inFunction = false;
    10371028                visitStatementList( node->kids );
    10381029        }
     
    10441035        MUTATE_START( node );
    10451036        {
    1046                 // Do not enter a new scope if atFunctionTop is true, don't leave one either.
    1047                 ValueGuard< bool > oldAtFunctionTop( atFunctionTop );
    1048                 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(); } );
    10491040                auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
    1050                 atFunctionTop = false;
     1041                inFunction = false;
    10511042                mutateStatementList( node->kids );
    10521043        }
Note: See TracChangeset for help on using the changeset viewer.