Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Pass.impl.hpp

    r489bacf r0e42794  
    398398        VISIT(
    399399                {
    400                         guard_indexer guard { *this };
     400                        guard_symtab guard { *this };
    401401                        maybe_accept( node, &ObjectDecl::type );
    402402                }
     
    406406        )
    407407
    408         __pass::indexer::addId( pass, 0, node );
     408        __pass::symtab::addId( pass, 0, node );
    409409
    410410        VISIT_END( DeclWithType, node );
     
    417417        VISIT_START( node );
    418418
    419         __pass::indexer::addId( pass, 0, node );
     419        __pass::symtab::addId( pass, 0, node );
    420420
    421421        VISIT(maybe_accept( node, &FunctionDecl::withExprs );)
    422422        {
    423423                // with clause introduces a level of scope (for the with expression members).
    424                 // with clause exprs are added to the indexer before parameters so that parameters
     424                // with clause exprs are added to the symbol table before parameters so that parameters
    425425                // shadow with exprs and not the other way around.
    426                 guard_indexer guard { *this };
    427                 __pass::indexer::addWith( pass, 0, node->withExprs, node );
     426                guard_symtab guard { *this };
     427                __pass::symtab::addWith( pass, 0, node->withExprs, node );
    428428                {
    429                         guard_indexer guard { *this };
     429                        guard_symtab guard { *this };
    430430                        // implicit add __func__ identifier as specified in the C manual 6.4.2.2
    431431                        static ast::ObjectDecl func(
     
    436436                                )
    437437                        );
    438                         __pass::indexer::addId( pass, 0, &func );
     438                        __pass::symtab::addId( pass, 0, &func );
    439439                        VISIT(
    440440                                maybe_accept( node, &FunctionDecl::type );
     
    460460        // make up a forward declaration and add it before processing the members
    461461        // needs to be on the heap because addStruct saves the pointer
    462         __pass::indexer::addStructFwd( pass, 0, node );
    463 
    464         VISIT({
    465                 guard_indexer guard { * this };
     462        __pass::symtab::addStructFwd( pass, 0, node );
     463
     464        VISIT({
     465                guard_symtab guard { * this };
    466466                maybe_accept( node, &StructDecl::params  );
    467467                maybe_accept( node, &StructDecl::members );
     
    469469
    470470        // this addition replaces the forward declaration
    471         __pass::indexer::addStruct( pass, 0, node );
     471        __pass::symtab::addStruct( pass, 0, node );
    472472
    473473        VISIT_END( Decl, node );
     
    481481
    482482        // make up a forward declaration and add it before processing the members
    483         __pass::indexer::addUnionFwd( pass, 0, node );
    484 
    485         VISIT({
    486                 guard_indexer guard { * this };
     483        __pass::symtab::addUnionFwd( pass, 0, node );
     484
     485        VISIT({
     486                guard_symtab guard { * this };
    487487                maybe_accept( node, &UnionDecl::params  );
    488488                maybe_accept( node, &UnionDecl::members );
    489489        })
    490490
    491         __pass::indexer::addUnion( pass, 0, node );
     491        __pass::symtab::addUnion( pass, 0, node );
    492492
    493493        VISIT_END( Decl, node );
     
    500500        VISIT_START( node );
    501501
    502         __pass::indexer::addEnum( pass, 0, node );
     502        __pass::symtab::addEnum( pass, 0, node );
    503503
    504504        VISIT(
     
    518518
    519519        VISIT({
    520                 guard_indexer guard { *this };
     520                guard_symtab guard { *this };
    521521                maybe_accept( node, &TraitDecl::params  );
    522522                maybe_accept( node, &TraitDecl::members );
    523523        })
    524524
    525         __pass::indexer::addTrait( pass, 0, node );
     525        __pass::symtab::addTrait( pass, 0, node );
    526526
    527527        VISIT_END( Decl, node );
     
    535535
    536536        VISIT({
    537                 guard_indexer guard { *this };
     537                guard_symtab guard { *this };
    538538                maybe_accept( node, &TypeDecl::params );
    539539                maybe_accept( node, &TypeDecl::base   );
     
    543543        // note that assertions come after the type is added to the symtab, since they are not part of the type proper
    544544        // and may depend on the type itself
    545         __pass::indexer::addType( pass, 0, node );
     545        __pass::symtab::addType( pass, 0, node );
    546546
    547547        VISIT(
     
    549549
    550550                {
    551                         guard_indexer guard { *this };
     551                        guard_symtab guard { *this };
    552552                        maybe_accept( node, &TypeDecl::init );
    553553                }
     
    564564
    565565        VISIT({
    566                 guard_indexer guard { *this };
     566                guard_symtab guard { *this };
    567567                maybe_accept( node, &TypedefDecl::params );
    568568                maybe_accept( node, &TypedefDecl::base   );
    569569        })
    570570
    571         __pass::indexer::addType( pass, 0, node );
     571        __pass::symtab::addType( pass, 0, node );
    572572
    573573        VISIT( maybe_accept( node, &TypedefDecl::assertions ); )
     
    611611                // do not enter a new scope if inFunction is true - needs to check old state before the assignment
    612612                auto guard1 = makeFuncGuard( [this, inFunction = this->inFunction]() {
    613                         if ( ! inFunction ) __pass::indexer::enter(pass, 0);
     613                        if ( ! inFunction ) __pass::symtab::enter(pass, 0);
    614614                }, [this, inFunction = this->inFunction]() {
    615                         if ( ! inFunction ) __pass::indexer::leave(pass, 0);
     615                        if ( ! inFunction ) __pass::symtab::leave(pass, 0);
    616616                });
    617617                ValueGuard< bool > guard2( inFunction );
     
    669669        VISIT({
    670670                // if statements introduce a level of scope (for the initialization)
    671                 guard_indexer guard { *this };
     671                guard_symtab guard { *this };
    672672                maybe_accept( node, &IfStmt::inits    );
    673673                maybe_accept( node, &IfStmt::cond     );
     
    687687        VISIT({
    688688                // while statements introduce a level of scope (for the initialization)
    689                 guard_indexer guard { *this };
     689                guard_symtab guard { *this };
    690690                maybe_accept( node, &WhileStmt::inits );
    691691                maybe_accept( node, &WhileStmt::cond  );
     
    704704        VISIT({
    705705                // for statements introduce a level of scope (for the initialization)
    706                 guard_indexer guard { *this };
     706                guard_symtab guard { *this };
    707707                maybe_accept( node, &ForStmt::inits );
    708708                maybe_accept( node, &ForStmt::cond  );
     
    800800        VISIT({
    801801                // catch statements introduce a level of scope (for the caught exception)
    802                 guard_indexer guard { *this };
     802                guard_symtab guard { *this };
    803803                maybe_accept( node, &CatchStmt::decl );
    804804                maybe_accept( node, &CatchStmt::cond );
     
    901901                {
    902902                        // catch statements introduce a level of scope (for the caught exception)
    903                         guard_indexer guard { *this };
    904                         __pass::indexer::addWith( pass, 0, node->exprs, node );
     903                        guard_symtab guard { *this };
     904                        __pass::symtab::addWith( pass, 0, node->exprs, node );
    905905                        maybe_accept( node, &WithStmt::stmt );
    906906                }
     
    953953        VISIT(
    954954                {
    955                         guard_indexer guard { *this };
     955                        guard_symtab guard { *this };
    956956                        maybe_accept( node, &ApplicationExpr::result );
    957957                }
     
    971971        VISIT(
    972972                {
    973                         guard_indexer guard { *this };
     973                        guard_symtab guard { *this };
    974974                        maybe_accept( node, &UntypedExpr::result );
    975975                }
     
    988988
    989989        VISIT({
    990                 guard_indexer guard { *this };
     990                guard_symtab guard { *this };
    991991                maybe_accept( node, &NameExpr::result );
    992992        })
     
    10021002
    10031003        VISIT({
    1004                         guard_indexer guard { *this };
     1004                        guard_symtab guard { *this };
    10051005                        maybe_accept( node, &CastExpr::result );
    10061006                }
     
    10181018
    10191019        VISIT({
    1020                         guard_indexer guard { *this };
     1020                        guard_symtab guard { *this };
    10211021                        maybe_accept( node, &KeywordCastExpr::result );
    10221022                }
     
    10341034
    10351035        VISIT({
    1036                         guard_indexer guard { *this };
     1036                        guard_symtab guard { *this };
    10371037                        maybe_accept( node, &VirtualCastExpr::result );
    10381038                }
     
    10501050
    10511051        VISIT({
    1052                         guard_indexer guard { *this };
     1052                        guard_symtab guard { *this };
    10531053                        maybe_accept( node, &AddressExpr::result );
    10541054                }
     
    10661066
    10671067        VISIT({
    1068                 guard_indexer guard { *this };
     1068                guard_symtab guard { *this };
    10691069                maybe_accept( node, &LabelAddressExpr::result );
    10701070        })
     
    10801080
    10811081        VISIT({
    1082                         guard_indexer guard { *this };
     1082                        guard_symtab guard { *this };
    10831083                        maybe_accept( node, &UntypedMemberExpr::result );
    10841084                }
     
    10971097
    10981098        VISIT({
    1099                         guard_indexer guard { *this };
     1099                        guard_symtab guard { *this };
    11001100                        maybe_accept( node, &MemberExpr::result );
    11011101                }
     
    11131113
    11141114        VISIT({
    1115                 guard_indexer guard { *this };
     1115                guard_symtab guard { *this };
    11161116                maybe_accept( node, &VariableExpr::result );
    11171117        })
     
    11271127
    11281128        VISIT({
    1129                 guard_indexer guard { *this };
     1129                guard_symtab guard { *this };
    11301130                maybe_accept( node, &ConstantExpr::result );
    11311131        })
     
    11411141
    11421142        VISIT({
    1143                         guard_indexer guard { *this };
     1143                        guard_symtab guard { *this };
    11441144                        maybe_accept( node, &SizeofExpr::result );
    11451145                }
     
    11611161
    11621162        VISIT({
    1163                         guard_indexer guard { *this };
     1163                        guard_symtab guard { *this };
    11641164                        maybe_accept( node, &AlignofExpr::result );
    11651165                }
     
    11811181
    11821182        VISIT({
    1183                         guard_indexer guard { *this };
     1183                        guard_symtab guard { *this };
    11841184                        maybe_accept( node, &UntypedOffsetofExpr::result );
    11851185                }
     
    11971197
    11981198        VISIT({
    1199                         guard_indexer guard { *this };
     1199                        guard_symtab guard { *this };
    12001200                        maybe_accept( node, &OffsetofExpr::result );
    12011201                }
     
    12131213
    12141214        VISIT({
    1215                         guard_indexer guard { *this };
     1215                        guard_symtab guard { *this };
    12161216                        maybe_accept( node, &OffsetPackExpr::result );
    12171217                }
     
    12291229
    12301230        VISIT({
    1231                         guard_indexer guard { *this };
     1231                        guard_symtab guard { *this };
    12321232                        maybe_accept( node, &LogicalExpr::result );
    12331233                }
     
    12461246
    12471247        VISIT({
    1248                         guard_indexer guard { *this };
     1248                        guard_symtab guard { *this };
    12491249                        maybe_accept( node, &ConditionalExpr::result );
    12501250                }
     
    12641264
    12651265        VISIT({
    1266                         guard_indexer guard { *this };
     1266                        guard_symtab guard { *this };
    12671267                        maybe_accept( node, &CommaExpr::result );
    12681268                }
     
    12811281
    12821282        VISIT({
    1283                         guard_indexer guard { *this };
     1283                        guard_symtab guard { *this };
    12841284                        maybe_accept( node, &TypeExpr::result );
    12851285                }
     
    12971297
    12981298        VISIT({
    1299                         guard_indexer guard { *this };
     1299                        guard_symtab guard { *this };
    13001300                        maybe_accept( node, &AsmExpr::result );
    13011301                }
     
    13151315
    13161316        VISIT({
    1317                         guard_indexer guard { *this };
     1317                        guard_symtab guard { *this };
    13181318                        maybe_accept( node, &ImplicitCopyCtorExpr::result );
    13191319                }
    13201320                maybe_accept( node, &ImplicitCopyCtorExpr::callExpr    );
    1321                 maybe_accept( node, &ImplicitCopyCtorExpr::tempDecls   );
    1322                 maybe_accept( node, &ImplicitCopyCtorExpr::returnDecls );
    1323                 maybe_accept( node, &ImplicitCopyCtorExpr::dtors       );
    13241321        )
    13251322
     
    13341331
    13351332        VISIT({
    1336                         guard_indexer guard { *this };
     1333                        guard_symtab guard { *this };
    13371334                        maybe_accept( node, &ConstructorExpr::result );
    13381335                }
     
    13501347
    13511348        VISIT({
    1352                         guard_indexer guard { *this };
     1349                        guard_symtab guard { *this };
    13531350                        maybe_accept( node, &CompoundLiteralExpr::result );
    13541351                }
     
    13661363
    13671364        VISIT({
    1368                         guard_indexer guard { *this };
     1365                        guard_symtab guard { *this };
    13691366                        maybe_accept( node, &RangeExpr::result );
    13701367                }
     
    13831380
    13841381        VISIT({
    1385                         guard_indexer guard { *this };
     1382                        guard_symtab guard { *this };
    13861383                        maybe_accept( node, &UntypedTupleExpr::result );
    13871384                }
     
    13991396
    14001397        VISIT({
    1401                         guard_indexer guard { *this };
     1398                        guard_symtab guard { *this };
    14021399                        maybe_accept( node, &TupleExpr::result );
    14031400                }
     
    14151412
    14161413        VISIT({
    1417                         guard_indexer guard { *this };
     1414                        guard_symtab guard { *this };
    14181415                        maybe_accept( node, &TupleIndexExpr::result );
    14191416                }
     
    14311428
    14321429        VISIT({
    1433                         guard_indexer guard { *this };
     1430                        guard_symtab guard { *this };
    14341431                        maybe_accept( node, &TupleAssignExpr::result );
    14351432                }
     
    14571454
    14581455                {
    1459                         guard_indexer guard { *this };
     1456                        guard_symtab guard { *this };
    14601457                        maybe_accept( node, &StmtExpr::result );
    14611458                }
     
    14751472
    14761473        VISIT({
    1477                         guard_indexer guard { *this };
     1474                        guard_symtab guard { *this };
    14781475                        maybe_accept( node, &UniqueExpr::result );
    14791476                }
     
    14911488
    14921489        VISIT({
    1493                         guard_indexer guard { *this };
     1490                        guard_symtab guard { *this };
    14941491                        maybe_accept( node, &UntypedInitExpr::result );
    14951492                }
     
    15081505
    15091506        VISIT({
    1510                         guard_indexer guard { *this };
     1507                        guard_symtab guard { *this };
    15111508                        maybe_accept( node, &InitExpr::result );
    15121509                }
     
    15251522
    15261523        VISIT({
    1527                         guard_indexer guard { *this };
     1524                        guard_symtab guard { *this };
    15281525                        maybe_accept( node, &DeletedExpr::result );
    15291526                }
     
    15421539
    15431540        VISIT({
    1544                         guard_indexer guard { *this };
     1541                        guard_symtab guard { *this };
    15451542                        maybe_accept( node, &DefaultArgExpr::result );
    15461543                }
     
    15581555
    15591556        VISIT({
    1560                         guard_indexer guard { *this };
     1557                        guard_symtab guard { *this };
    15611558                        maybe_accept( node, &GenericExpr::result );
    15621559                }
     
    15691566                        const Type * type = nullptr;
    15701567                        if( assoc.type ) {
    1571                                 guard_indexer guard { *this };
     1568                                guard_symtab guard { *this };
    15721569                                type = assoc.type->accept( *this );
    15731570                                if( type != assoc.type ) mutated = true;
     
    16851682        VISIT_START( node );
    16861683
    1687         __pass::indexer::addStruct( pass, 0, node->name );
    1688 
    1689         VISIT({
    1690                 guard_indexer guard { *this };
     1684        __pass::symtab::addStruct( pass, 0, node->name );
     1685
     1686        VISIT({
     1687                guard_symtab guard { *this };
    16911688                maybe_accept( node, &StructInstType::forall );
    16921689                maybe_accept( node, &StructInstType::params );
     
    17021699        VISIT_START( node );
    17031700
    1704         __pass::indexer::addStruct( pass, 0, node->name );
     1701        __pass::symtab::addStruct( pass, 0, node->name );
    17051702
    17061703        {
    1707                 guard_indexer guard { *this };
     1704                guard_symtab guard { *this };
    17081705                maybe_accept( node, &UnionInstType::forall );
    17091706                maybe_accept( node, &UnionInstType::params );
     
    18961893                        std::unordered_map< std::string, ast::ptr< ast::Type > > new_map;
    18971894                        for ( const auto & p : node->typeEnv ) {
    1898                                 guard_indexer guard { *this };
     1895                                guard_symtab guard { *this };
    18991896                                auto new_node = p.second->accept( *this );
    19001897                                if (new_node != p.second) mutated = false;
     
    19121909                        std::unordered_map< std::string, ast::ptr< ast::Expr > > new_map;
    19131910                        for ( const auto & p : node->varEnv ) {
    1914                                 guard_indexer guard { *this };
     1911                                guard_symtab guard { *this };
    19151912                                auto new_node = p.second->accept( *this );
    19161913                                if (new_node != p.second) mutated = false;
Note: See TracChangeset for help on using the changeset viewer.