Changeset 4559b34 for src/SynTree


Ignore:
Timestamp:
Apr 3, 2022, 8:49:42 PM (4 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
92538ab
Parents:
3eb1653
Message:

Update the String Enum implementation. The declaration now can handles creating the enum decl. But the compilation fails when trying to create reference to the Enum. Need a way to resolve InstTypes

Location:
src/SynTree
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/AggregateDecl.cc

    r3eb1653 r4559b34  
    5959        } // if
    6060        os << " with body " << has_body();
    61 
    6261        if ( ! parameters.empty() ) {
    6362                os << endl << indent << "... with parameters" << endl;
     
    106105const char * EnumDecl::typeString() const { return aggrString( Enum ); }
    107106
     107void EnumDecl::print( std::ostream & os, Indenter indent ) const {
     108        AggregateDecl::print(os, indent);
     109        os << " with base? " << (base? "True" : "False") << std::endl;
     110        if ( base ) {
     111                os << "Base Type of Enum:" << std::endl;
     112                base->print(os, indent);
     113        }
     114        os <<  std::endl << "End of EnumDecl::print" << std::endl;
     115}
     116
    108117const char * TraitDecl::typeString() const { return aggrString( Trait ); }
    109118
  • src/SynTree/Declaration.h

    r3eb1653 r4559b34  
    290290        AggregateDecl * set_body( bool body ) { AggregateDecl::body = body; return this; }
    291291
    292         virtual void print( std::ostream & os, Indenter indent = {} ) const override final;
     292        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    293293        virtual void printShort( std::ostream & os, Indenter indent = {} ) const override;
    294294  protected:
     
    352352        Type * base;
    353353        std::unordered_map< std::string, long long int > enumValues;
     354        virtual void print( std::ostream & os, Indenter indent = {} ) const override final;
    354355  private:
    355356        // std::unordered_map< std::string, long long int > enumValues;
Note: See TracChangeset for help on using the changeset viewer.