Changeset ed3935da


Ignore:
Timestamp:
May 22, 2019, 3:16:52 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
09ab71a
Parents:
3f840e3
Message:

typeString is now public, since it is const and effectively constexpr, there is no downside

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Decl.hpp

    r3f840e3 red3935da  
    232232        AggregateDecl* set_body( bool b ) { body = b; return this; }
    233233
    234 private:
    235         AggregateDecl * clone() const override = 0;
    236         MUTATE_FRIEND
    237 
    238 protected:
    239234        /// Produces a name for the kind of aggregate
    240235        virtual std::string typeString() const = 0;
     236
     237private:
     238        AggregateDecl * clone() const override = 0;
     239        MUTATE_FRIEND
    241240};
    242241
     
    256255
    257256        const Decl * accept( Visitor & v ) const override { return v.visit( this ); }
     257
     258        std::string typeString() const override { return "struct"; }
     259
    258260private:
    259261        StructDecl * clone() const override { return new StructDecl{ *this }; }
    260262        MUTATE_FRIEND
    261 
    262         std::string typeString() const override { return "struct"; }
    263263};
    264264
     
    271271
    272272        const Decl * accept( Visitor& v ) const override { return v.visit( this ); }
     273
     274        std::string typeString() const override { return "union"; }
     275
    273276private:
    274277        UnionDecl * clone() const override { return new UnionDecl{ *this }; }
    275278        MUTATE_FRIEND
    276 
    277         std::string typeString() const override { return "union"; }
    278279};
    279280
     
    289290
    290291        const Decl * accept( Visitor & v ) const override { return v.visit( this ); }
     292
     293        std::string typeString() const override { return "enum"; }
     294
    291295private:
    292296        EnumDecl * clone() const override { return new EnumDecl{ *this }; }
    293297        MUTATE_FRIEND
    294 
    295         std::string typeString() const override { return "enum"; }
    296298
    297299        /// Map from names to enumerator values; kept private for lazy initialization
     
    307309
    308310        const Decl * accept( Visitor & v ) const override { return v.visit( this ); }
     311
     312        std::string typeString() const override { return "trait"; }
     313
    309314private:
    310315        TraitDecl * clone() const override { return new TraitDecl{ *this }; }
    311316        MUTATE_FRIEND
    312 
    313         std::string typeString() const override { return "trait"; }
    314317};
    315318
Note: See TracChangeset for help on using the changeset viewer.