Ignore:
File:
1 edited

Legend:

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

    r0e42794 r489bacf  
    398398        VISIT(
    399399                {
    400                         guard_symtab guard { *this };
     400                        guard_indexer guard { *this };
    401401                        maybe_accept( node, &ObjectDecl::type );
    402402                }
     
    406406        )
    407407
    408         __pass::symtab::addId( pass, 0, node );
     408        __pass::indexer::addId( pass, 0, node );
    409409
    410410        VISIT_END( DeclWithType, node );
     
    417417        VISIT_START( node );
    418418
    419         __pass::symtab::addId( pass, 0, node );
     419        __pass::indexer::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 symbol table before parameters so that parameters
     424                // with clause exprs are added to the indexer before parameters so that parameters
    425425                // shadow with exprs and not the other way around.
    426                 guard_symtab guard { *this };
    427                 __pass::symtab::addWith( pass, 0, node->withExprs, node );
     426                guard_indexer guard { *this };
     427                __pass::indexer::addWith( pass, 0, node->withExprs, node );
    428428                {
    429                         guard_symtab guard { *this };
     429                        guard_indexer 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::symtab::addId( pass, 0, &func );
     438                        __pass::indexer::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::symtab::addStructFwd( pass, 0, node );
    463 
    464         VISIT({
    465                 guard_symtab guard { * this };
     462        __pass::indexer::addStructFwd( pass, 0, node );
     463
     464        VISIT({
     465                guard_indexer guard { * this };
    466466                maybe_accept( node, &StructDecl::params  );
    467467                maybe_accept( node, &StructDecl::members );
     
    469469
    470470        // this addition replaces the forward declaration
    471         __pass::symtab::addStruct( pass, 0, node );
     471        __pass::indexer::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::symtab::addUnionFwd( pass, 0, node );
    484 
    485         VISIT({
    486                 guard_symtab guard { * this };
     483        __pass::indexer::addUnionFwd( pass, 0, node );
     484
     485        VISIT({
     486                guard_indexer guard { * this };
    487487                maybe_accept( node, &UnionDecl::params  );
    488488                maybe_accept( node, &UnionDecl::members );
    489489        })
    490490
    491         __pass::symtab::addUnion( pass, 0, node );
     491        __pass::indexer::addUnion( pass, 0, node );
    492492
    493493        VISIT_END( Decl, node );
     
    500500        VISIT_START( node );
    501501
    502         __pass::symtab::addEnum( pass, 0, node );
     502        __pass::indexer::addEnum( pass, 0, node );
    503503
    504504        VISIT(
     
    518518
    519519        VISIT({
    520                 guard_symtab guard { *this };
     520                guard_indexer guard { *this };
    521521                maybe_accept( node, &TraitDecl::params  );
    522522                maybe_accept( node, &TraitDecl::members );
    523523        })
    524524
    525         __pass::symtab::addTrait( pass, 0, node );
     525        __pass::indexer::addTrait( pass, 0, node );
    526526
    527527        VISIT_END( Decl, node );
     
    535535
    536536        VISIT({
    537                 guard_symtab guard { *this };
     537                guard_indexer 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::symtab::addType( pass, 0, node );
     545        __pass::indexer::addType( pass, 0, node );
    546546
    547547        VISIT(
     
    549549
    550550                {
    551                         guard_symtab guard { *this };
     551                        guard_indexer guard { *this };
    552552                        maybe_accept( node, &TypeDecl::init );
    553553                }
     
    564564
    565565        VISIT({
    566                 guard_symtab guard { *this };
     566                guard_indexer guard { *this };
    567567                maybe_accept( node, &TypedefDecl::params );
    568568                maybe_accept( node, &TypedefDecl::base   );
    569569        })
    570570
    571         __pass::symtab::addType( pass, 0, node );
     571        __pass::indexer::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::symtab::enter(pass, 0);
     613                        if ( ! inFunction ) __pass::indexer::enter(pass, 0);
    614614                }, [this, inFunction = this->inFunction]() {
    615                         if ( ! inFunction ) __pass::symtab::leave(pass, 0);
     615                        if ( ! inFunction ) __pass::indexer::leave(pass, 0);
    616616                });
    617617                ValueGuard< bool > guard2( inFunction );
     
    669669        VISIT({
    670670                // if statements introduce a level of scope (for the initialization)
    671                 guard_symtab guard { *this };
     671                guard_indexer 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_symtab guard { *this };
     689                guard_indexer 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_symtab guard { *this };
     706                guard_indexer 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_symtab guard { *this };
     802                guard_indexer 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_symtab guard { *this };
    904                         __pass::symtab::addWith( pass, 0, node->exprs, node );
     903                        guard_indexer guard { *this };
     904                        __pass::indexer::addWith( pass, 0, node->exprs, node );
    905905                        maybe_accept( node, &WithStmt::stmt );
    906906                }
     
    953953        VISIT(
    954954                {
    955                         guard_symtab guard { *this };
     955                        guard_indexer guard { *this };
    956956                        maybe_accept( node, &ApplicationExpr::result );
    957957                }
     
    971971        VISIT(
    972972                {
    973                         guard_symtab guard { *this };
     973                        guard_indexer guard { *this };
    974974                        maybe_accept( node, &UntypedExpr::result );
    975975                }
     
    988988
    989989        VISIT({
    990                 guard_symtab guard { *this };
     990                guard_indexer guard { *this };
    991991                maybe_accept( node, &NameExpr::result );
    992992        })
     
    10021002
    10031003        VISIT({
    1004                         guard_symtab guard { *this };
     1004                        guard_indexer guard { *this };
    10051005                        maybe_accept( node, &CastExpr::result );
    10061006                }
     
    10181018
    10191019        VISIT({
    1020                         guard_symtab guard { *this };
     1020                        guard_indexer guard { *this };
    10211021                        maybe_accept( node, &KeywordCastExpr::result );
    10221022                }
     
    10341034
    10351035        VISIT({
    1036                         guard_symtab guard { *this };
     1036                        guard_indexer guard { *this };
    10371037                        maybe_accept( node, &VirtualCastExpr::result );
    10381038                }
     
    10501050
    10511051        VISIT({
    1052                         guard_symtab guard { *this };
     1052                        guard_indexer guard { *this };
    10531053                        maybe_accept( node, &AddressExpr::result );
    10541054                }
     
    10661066
    10671067        VISIT({
    1068                 guard_symtab guard { *this };
     1068                guard_indexer guard { *this };
    10691069                maybe_accept( node, &LabelAddressExpr::result );
    10701070        })
     
    10801080
    10811081        VISIT({
    1082                         guard_symtab guard { *this };
     1082                        guard_indexer guard { *this };
    10831083                        maybe_accept( node, &UntypedMemberExpr::result );
    10841084                }
     
    10971097
    10981098        VISIT({
    1099                         guard_symtab guard { *this };
     1099                        guard_indexer guard { *this };
    11001100                        maybe_accept( node, &MemberExpr::result );
    11011101                }
     
    11131113
    11141114        VISIT({
    1115                 guard_symtab guard { *this };
     1115                guard_indexer guard { *this };
    11161116                maybe_accept( node, &VariableExpr::result );
    11171117        })
     
    11271127
    11281128        VISIT({
    1129                 guard_symtab guard { *this };
     1129                guard_indexer guard { *this };
    11301130                maybe_accept( node, &ConstantExpr::result );
    11311131        })
     
    11411141
    11421142        VISIT({
    1143                         guard_symtab guard { *this };
     1143                        guard_indexer guard { *this };
    11441144                        maybe_accept( node, &SizeofExpr::result );
    11451145                }
     
    11611161
    11621162        VISIT({
    1163                         guard_symtab guard { *this };
     1163                        guard_indexer guard { *this };
    11641164                        maybe_accept( node, &AlignofExpr::result );
    11651165                }
     
    11811181
    11821182        VISIT({
    1183                         guard_symtab guard { *this };
     1183                        guard_indexer guard { *this };
    11841184                        maybe_accept( node, &UntypedOffsetofExpr::result );
    11851185                }
     
    11971197
    11981198        VISIT({
    1199                         guard_symtab guard { *this };
     1199                        guard_indexer guard { *this };
    12001200                        maybe_accept( node, &OffsetofExpr::result );
    12011201                }
     
    12131213
    12141214        VISIT({
    1215                         guard_symtab guard { *this };
     1215                        guard_indexer guard { *this };
    12161216                        maybe_accept( node, &OffsetPackExpr::result );
    12171217                }
     
    12291229
    12301230        VISIT({
    1231                         guard_symtab guard { *this };
     1231                        guard_indexer guard { *this };
    12321232                        maybe_accept( node, &LogicalExpr::result );
    12331233                }
     
    12461246
    12471247        VISIT({
    1248                         guard_symtab guard { *this };
     1248                        guard_indexer guard { *this };
    12491249                        maybe_accept( node, &ConditionalExpr::result );
    12501250                }
     
    12641264
    12651265        VISIT({
    1266                         guard_symtab guard { *this };
     1266                        guard_indexer guard { *this };
    12671267                        maybe_accept( node, &CommaExpr::result );
    12681268                }
     
    12811281
    12821282        VISIT({
    1283                         guard_symtab guard { *this };
     1283                        guard_indexer guard { *this };
    12841284                        maybe_accept( node, &TypeExpr::result );
    12851285                }
     
    12971297
    12981298        VISIT({
    1299                         guard_symtab guard { *this };
     1299                        guard_indexer guard { *this };
    13001300                        maybe_accept( node, &AsmExpr::result );
    13011301                }
     
    13151315
    13161316        VISIT({
    1317                         guard_symtab guard { *this };
     1317                        guard_indexer 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       );
    13211324        )
    13221325
     
    13311334
    13321335        VISIT({
    1333                         guard_symtab guard { *this };
     1336                        guard_indexer guard { *this };
    13341337                        maybe_accept( node, &ConstructorExpr::result );
    13351338                }
     
    13471350
    13481351        VISIT({
    1349                         guard_symtab guard { *this };
     1352                        guard_indexer guard { *this };
    13501353                        maybe_accept( node, &CompoundLiteralExpr::result );
    13511354                }
     
    13631366
    13641367        VISIT({
    1365                         guard_symtab guard { *this };
     1368                        guard_indexer guard { *this };
    13661369                        maybe_accept( node, &RangeExpr::result );
    13671370                }
     
    13801383
    13811384        VISIT({
    1382                         guard_symtab guard { *this };
     1385                        guard_indexer guard { *this };
    13831386                        maybe_accept( node, &UntypedTupleExpr::result );
    13841387                }
     
    13961399
    13971400        VISIT({
    1398                         guard_symtab guard { *this };
     1401                        guard_indexer guard { *this };
    13991402                        maybe_accept( node, &TupleExpr::result );
    14001403                }
     
    14121415
    14131416        VISIT({
    1414                         guard_symtab guard { *this };
     1417                        guard_indexer guard { *this };
    14151418                        maybe_accept( node, &TupleIndexExpr::result );
    14161419                }
     
    14281431
    14291432        VISIT({
    1430                         guard_symtab guard { *this };
     1433                        guard_indexer guard { *this };
    14311434                        maybe_accept( node, &TupleAssignExpr::result );
    14321435                }
     
    14541457
    14551458                {
    1456                         guard_symtab guard { *this };
     1459                        guard_indexer guard { *this };
    14571460                        maybe_accept( node, &StmtExpr::result );
    14581461                }
     
    14721475
    14731476        VISIT({
    1474                         guard_symtab guard { *this };
     1477                        guard_indexer guard { *this };
    14751478                        maybe_accept( node, &UniqueExpr::result );
    14761479                }
     
    14881491
    14891492        VISIT({
    1490                         guard_symtab guard { *this };
     1493                        guard_indexer guard { *this };
    14911494                        maybe_accept( node, &UntypedInitExpr::result );
    14921495                }
     
    15051508
    15061509        VISIT({
    1507                         guard_symtab guard { *this };
     1510                        guard_indexer guard { *this };
    15081511                        maybe_accept( node, &InitExpr::result );
    15091512                }
     
    15221525
    15231526        VISIT({
    1524                         guard_symtab guard { *this };
     1527                        guard_indexer guard { *this };
    15251528                        maybe_accept( node, &DeletedExpr::result );
    15261529                }
     
    15391542
    15401543        VISIT({
    1541                         guard_symtab guard { *this };
     1544                        guard_indexer guard { *this };
    15421545                        maybe_accept( node, &DefaultArgExpr::result );
    15431546                }
     
    15551558
    15561559        VISIT({
    1557                         guard_symtab guard { *this };
     1560                        guard_indexer guard { *this };
    15581561                        maybe_accept( node, &GenericExpr::result );
    15591562                }
     
    15661569                        const Type * type = nullptr;
    15671570                        if( assoc.type ) {
    1568                                 guard_symtab guard { *this };
     1571                                guard_indexer guard { *this };
    15691572                                type = assoc.type->accept( *this );
    15701573                                if( type != assoc.type ) mutated = true;
     
    16821685        VISIT_START( node );
    16831686
    1684         __pass::symtab::addStruct( pass, 0, node->name );
    1685 
    1686         VISIT({
    1687                 guard_symtab guard { *this };
     1687        __pass::indexer::addStruct( pass, 0, node->name );
     1688
     1689        VISIT({
     1690                guard_indexer guard { *this };
    16881691                maybe_accept( node, &StructInstType::forall );
    16891692                maybe_accept( node, &StructInstType::params );
     
    16991702        VISIT_START( node );
    17001703
    1701         __pass::symtab::addStruct( pass, 0, node->name );
     1704        __pass::indexer::addStruct( pass, 0, node->name );
    17021705
    17031706        {
    1704                 guard_symtab guard { *this };
     1707                guard_indexer guard { *this };
    17051708                maybe_accept( node, &UnionInstType::forall );
    17061709                maybe_accept( node, &UnionInstType::params );
     
    18931896                        std::unordered_map< std::string, ast::ptr< ast::Type > > new_map;
    18941897                        for ( const auto & p : node->typeEnv ) {
    1895                                 guard_symtab guard { *this };
     1898                                guard_indexer guard { *this };
    18961899                                auto new_node = p.second->accept( *this );
    18971900                                if (new_node != p.second) mutated = false;
     
    19091912                        std::unordered_map< std::string, ast::ptr< ast::Expr > > new_map;
    19101913                        for ( const auto & p : node->varEnv ) {
    1911                                 guard_symtab guard { *this };
     1914                                guard_indexer guard { *this };
    19121915                                auto new_node = p.second->accept( *this );
    19131916                                if (new_node != p.second) mutated = false;
Note: See TracChangeset for help on using the changeset viewer.