Changeset 28f8f15 for src/CodeGen


Ignore:
Timestamp:
Apr 27, 2023, 3:13:24 PM (2 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT
Children:
561354f
Parents:
b110bcc
Message:

Save progress

Location:
src/CodeGen
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    rb110bcc r28f8f15  
    295295        }
    296296
     297        void CodeGenerator::handleData( EnumDecl * dataDecl ) {
     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->tags );
     306                output << ";" << endl;
     307                postvisit( dataDecl->tag_union );
     308                output << ";" << endl;
     309        }
     310
    297311        void CodeGenerator::postvisit( EnumDecl * enumDecl ) {
    298                 extension( enumDecl );
     312                if ( enumDecl->data_constructors.size() > 0 ) return handleData( enumDecl );
     313                extension( enumDecl );
    299314                std::list< Declaration* > &memb = enumDecl->get_members();
    300315                if (enumDecl->base && ! memb.empty()) {
  • src/CodeGen/CodeGenerator.h

    rb110bcc r28f8f15  
    165165                void handleTypedef( NamedTypeDecl *namedType );
    166166                std::string mangleName( DeclarationWithType * decl );
     167
     168                void handleData( EnumDecl * EnumDecl );
    167169        }; // CodeGenerator
    168170
Note: See TracChangeset for help on using the changeset viewer.