Changeset e67991f for src/SymTab


Ignore:
Timestamp:
Jul 16, 2019, 10:38:32 AM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
6f15121
Parents:
7dc2e57b
Message:

WithStmt? is now a Declaration

Location:
src/SymTab
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Indexer.cc

    r7dc2e57b re67991f  
    210210        bool Indexer::addedIdConflicts(
    211211                        const Indexer::IdData & existing, const DeclarationWithType * added,
    212                         Indexer::OnConflict handleConflicts, const BaseSyntaxNode * deleteStmt ) {
     212                        Indexer::OnConflict handleConflicts, const Declaration * deleteStmt ) {
    213213                // if we're giving the same name mangling to things of different types then there is
    214214                // something wrong
     
    432432
    433433        void Indexer::addId(const DeclarationWithType * decl, OnConflict handleConflicts, const Expression * baseExpr,
    434                         const BaseSyntaxNode * deleteStmt ) {
     434                        const Declaration * deleteStmt ) {
    435435                ++* stats().add_calls;
    436436                const std::string &name = decl->name;
     
    510510        }
    511511
    512         void Indexer::addDeletedId( const DeclarationWithType * decl, const BaseSyntaxNode * deleteStmt ) {
     512        void Indexer::addDeletedId( const DeclarationWithType * decl, const Declaration * deleteStmt ) {
    513513                // default handling of conflicts is to raise an error
    514514                addId( decl, OnConflict::error(), nullptr, deleteStmt );
     
    661661        }
    662662
    663         void Indexer::addWith( const std::list< Expression * > & withExprs, const BaseSyntaxNode * withStmt ) {
     663        void Indexer::addWith( const std::list< Expression * > & withExprs, const Declaration * withStmt ) {
    664664                for ( const Expression * expr : withExprs ) {
    665665                        if ( expr->result ) {
     
    704704                        ret = new VariableExpr( const_cast<DeclarationWithType *>(id) );
    705705                }
    706                 if ( deleteStmt ) ret = new DeletedExpr( ret, const_cast<BaseSyntaxNode *>(deleteStmt) );
     706                if ( deleteStmt ) ret = new DeletedExpr( ret, const_cast<Declaration *>(deleteStmt) );
    707707                return ret;
    708708        }
  • src/SymTab/Indexer.h

    r7dc2e57b re67991f  
    4444
    4545                        /// non-null if this declaration is deleted
    46                         const BaseSyntaxNode * deleteStmt = nullptr;
     46                        const Declaration * deleteStmt = nullptr;
    4747                        /// scope of identifier
    4848                        unsigned long scope = 0;
     
    5151                        IdData() = default;
    5252                        IdData(
    53                                 const DeclarationWithType * id, const Expression * baseExpr, const BaseSyntaxNode * deleteStmt,
     53                                const DeclarationWithType * id, const Expression * baseExpr, const Declaration * deleteStmt,
    5454                                unsigned long scope )
    5555                                : id( id ), baseExpr( baseExpr ), deleteStmt( deleteStmt ), scope( scope ) {}
    56                         IdData( const IdData& o, const BaseSyntaxNode * deleteStmt )
     56                        IdData( const IdData& o, const Declaration * deleteStmt )
    5757                                : id( o.id ), baseExpr( o.baseExpr ), deleteStmt( deleteStmt ), scope( o.scope ) {}
    5858
     
    8383
    8484                void addId( const DeclarationWithType * decl, const Expression * baseExpr = nullptr );
    85                 void addDeletedId( const DeclarationWithType * decl, const BaseSyntaxNode * deleteStmt );
     85                void addDeletedId( const DeclarationWithType * decl, const Declaration * deleteStmt );
    8686
    8787                void addType( const NamedTypeDecl * decl );
     
    9494
    9595                /// adds all of the IDs from WithStmt exprs
    96                 void addWith( const std::list< Expression * > & withExprs, const BaseSyntaxNode * withStmt );
     96                void addWith( const std::list< Expression * > & withExprs, const Declaration * withStmt );
    9797
    9898                /// convenience function for adding a list of Ids to the indexer
     
    152152                                Delete  ///< Delete the earlier version with the delete statement
    153153                        } mode;
    154                         const BaseSyntaxNode * deleteStmt;  ///< Statement that deletes this expression
     154                        const Declaration * deleteStmt;  ///< Statement that deletes this expression
    155155
    156156                private:
    157157                        OnConflict() : mode(Error), deleteStmt(nullptr) {}
    158                         OnConflict( const BaseSyntaxNode * d ) : mode(Delete), deleteStmt(d) {}
     158                        OnConflict( const Declaration * d ) : mode(Delete), deleteStmt(d) {}
    159159                public:
    160160                        OnConflict( const OnConflict& ) = default;
    161161
    162162                        static OnConflict error() { return {}; }
    163                         static OnConflict deleteWith( const BaseSyntaxNode * d ) { return { d }; }
     163                        static OnConflict deleteWith( const Declaration * d ) { return { d }; }
    164164                };
    165165
     
    167167                bool addedIdConflicts(
    168168                        const IdData & existing, const DeclarationWithType * added, OnConflict handleConflicts,
    169                         const BaseSyntaxNode * deleteStmt );
     169                        const Declaration * deleteStmt );
    170170
    171171                /// common code for addId, addDeletedId, etc.
    172172                void addId(const DeclarationWithType * decl, OnConflict handleConflicts,
    173                         const Expression * baseExpr = nullptr, const BaseSyntaxNode * deleteStmt = nullptr );
     173                        const Expression * baseExpr = nullptr, const Declaration * deleteStmt = nullptr );
    174174
    175175                /// adds all of the members of the Aggregate (addWith helper)
Note: See TracChangeset for help on using the changeset viewer.