Changes in src/Common/PassVisitor.impl.h [c6c682cf:37cdd97]
- File:
-
- 1 edited
-
src/Common/PassVisitor.impl.h (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/PassVisitor.impl.h
rc6c682cf r37cdd97 532 532 indexerAddId( &func ); 533 533 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 535 536 ValueGuard< bool > oldInFunction( inFunction ); 536 537 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;541 538 maybeAccept_impl( node->statements, *this ); 542 539 maybeAccept_impl( node->attributes, *this ); … … 570 567 indexerAddId( &func ); 571 568 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 573 571 ValueGuard< bool > oldInFunction( inFunction ); 574 572 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;579 573 maybeAccept_impl( node->statements, *this ); 580 574 maybeAccept_impl( node->attributes, *this ); … … 607 601 indexerAddId( &func ); 608 602 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 610 605 ValueGuard< bool > oldInFunction( inFunction ); 611 606 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;616 607 maybeMutate_impl( node->statements, *this ); 617 608 maybeMutate_impl( node->attributes, *this ); … … 1016 1007 VISIT_START( node ); 1017 1008 { 1018 // Do not enter a new scope if atFunctionTop is true, don't leave one either.1019 ValueGuard< bool > old AtFunctionTop( 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(); } ); 1021 1012 auto guard2 = makeFuncGuard( [this]() { call_beginScope(); }, [this]() { call_endScope(); } ); 1022 atFunctionTop= false;1013 inFunction = false; 1023 1014 visitStatementList( node->kids ); 1024 1015 } … … 1030 1021 VISIT_START( node ); 1031 1022 { 1032 // Do not enter a new scope if atFunctionTop is true, don't leave one either.1033 ValueGuard< bool > old AtFunctionTop( 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(); } ); 1035 1026 auto guard2 = makeFuncGuard( [this]() { call_beginScope(); }, [this]() { call_endScope(); } ); 1036 atFunctionTop= false;1027 inFunction = false; 1037 1028 visitStatementList( node->kids ); 1038 1029 } … … 1044 1035 MUTATE_START( node ); 1045 1036 { 1046 // Do not enter a new scope if atFunctionTop is true, don't leave one either.1047 ValueGuard< bool > old AtFunctionTop( 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(); } ); 1049 1040 auto guard2 = makeFuncGuard( [this]() { call_beginScope(); }, [this]() { call_endScope(); } ); 1050 atFunctionTop= false;1041 inFunction = false; 1051 1042 mutateStatementList( node->kids ); 1052 1043 }
Note:
See TracChangeset
for help on using the changeset viewer.