Changes in src/Common/PassVisitor.impl.h [6a45bd78:665f432]
- File:
-
- 1 edited
-
src/Common/PassVisitor.impl.h (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/PassVisitor.impl.h
r6a45bd78 r665f432 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 ); … … 835 826 { 836 827 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 828 maybeAccept_impl( node->parameters, *this ); 837 829 maybeAccept_impl( node->base , *this ); 838 830 } … … 857 849 { 858 850 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 851 maybeAccept_impl( node->parameters, *this ); 859 852 maybeAccept_impl( node->base , *this ); 860 853 } … … 878 871 { 879 872 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 873 maybeMutate_impl( node->parameters, *this ); 880 874 maybeMutate_impl( node->base , *this ); 881 875 } … … 901 895 { 902 896 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 897 maybeAccept_impl( node->parameters, *this ); 903 898 maybeAccept_impl( node->base , *this ); 904 899 } … … 917 912 { 918 913 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 914 maybeAccept_impl( node->parameters, *this ); 919 915 maybeAccept_impl( node->base , *this ); 920 916 } … … 933 929 { 934 930 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 931 maybeMutate_impl( node->parameters, *this ); 935 932 maybeMutate_impl( node->base , *this ); 936 933 } … … 1010 1007 VISIT_START( node ); 1011 1008 { 1012 // Do not enter a new scope if atFunctionTop is true, don't leave one either.1013 ValueGuard< bool > old AtFunctionTop( 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(); } ); 1015 1012 auto guard2 = makeFuncGuard( [this]() { call_beginScope(); }, [this]() { call_endScope(); } ); 1016 atFunctionTop= false;1013 inFunction = false; 1017 1014 visitStatementList( node->kids ); 1018 1015 } … … 1024 1021 VISIT_START( node ); 1025 1022 { 1026 // Do not enter a new scope if atFunctionTop is true, don't leave one either.1027 ValueGuard< bool > old AtFunctionTop( 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(); } ); 1029 1026 auto guard2 = makeFuncGuard( [this]() { call_beginScope(); }, [this]() { call_endScope(); } ); 1030 atFunctionTop= false;1027 inFunction = false; 1031 1028 visitStatementList( node->kids ); 1032 1029 } … … 1038 1035 MUTATE_START( node ); 1039 1036 { 1040 // Do not enter a new scope if atFunctionTop is true, don't leave one either.1041 ValueGuard< bool > old AtFunctionTop( 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(); } ); 1043 1040 auto guard2 = makeFuncGuard( [this]() { call_beginScope(); }, [this]() { call_endScope(); } ); 1044 atFunctionTop= false;1041 inFunction = false; 1045 1042 mutateStatementList( node->kids ); 1046 1043 } … … 1525 1522 1526 1523 //-------------------------------------------------------------------------- 1527 // SuspendStmt1528 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 //--------------------------------------------------------------------------1556 1524 // WaitForStmt 1557 1525 template< typename pass_type > … … 3334 3302 VISIT_START( node ); 3335 3303 3336 indexerAdd Union( node->name );3304 indexerAddStruct( node->name ); 3337 3305 3338 3306 { … … 3349 3317 VISIT_START( node ); 3350 3318 3351 indexerAdd Union( node->name );3319 indexerAddStruct( node->name ); 3352 3320 3353 3321 { … … 3364 3332 MUTATE_START( node ); 3365 3333 3366 indexerAdd Union( node->name );3334 indexerAddStruct( node->name ); 3367 3335 3368 3336 {
Note:
See TracChangeset
for help on using the changeset viewer.