Changeset fa2c005 for src/CodeGen


Ignore:
Timestamp:
Jun 8, 2023, 3:19:43 PM (3 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT
Parents:
044ae62
Message:

Finish Adt POC

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r044ae62 rfa2c005  
    296296
    297297        void CodeGenerator::handleData( EnumDecl * ) {
    298                 // output << " /** data type */" << endl;
    299                 // for ( StructDecl * decl : dataDecl->data_constructors ) {
    300                 //      postvisit(decl);
    301                 //      output << ";" << endl;
    302                 // }
    303                 // postvisit( dataDecl->data_union );
    304                 // output << ";" << endl;
    305                 // postvisit( dataDecl->tag );
    306                 // output << ";" << endl;
    307                 // postvisit( dataDecl->tag_union );
    308                 // output << ";" << endl;
    309298                assert(false);
    310299        }
    311300
    312301        void CodeGenerator::postvisit( EnumDecl * enumDecl ) {
    313                 // if ( enumDecl->data_constructors.size() > 0 ) return handleData( enumDecl );
    314302                extension( enumDecl );
    315303                std::list< Declaration* > &memb = enumDecl->get_members();
     
    350338        }
    351339
    352         void CodeGenerator::postvisit( AdtDecl * ) {
    353                 // TODO
     340        // Temporary fix, But visitor should be able to handle this
     341        void CodeGenerator::postvisit( AdtDecl * adtDecl ) {
     342                output << endl << "/* AdtDecl Code Section */" << endl;
     343                postvisit( adtDecl->tag );
     344                output << ";" << endl;
     345                postvisit( adtDecl->data_union );
     346                output << ";" << endl;
     347                postvisit( adtDecl->tag_union );
    354348        }
    355349
Note: See TracChangeset for help on using the changeset viewer.