Changeset 4559b34 for src/SymTab


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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    r3eb1653 r4559b34  
    939939                                        // need to resolve enumerator initializers early so that other passes that determine if an expression is constexpr have the appropriate information.
    940940                                        SingleInit * init = strict_dynamic_cast<SingleInit *>( field->init );
    941                                         ResolvExpr::findSingleExpression( init->value, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), indexer );
     941                                        if ( !enumDecl->base || dynamic_cast<BasicType *>(enumDecl->base))
     942                                                ResolvExpr::findSingleExpression( init->value, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), indexer );
     943                                        else {
     944                                                if (dynamic_cast<PointerType *>(enumDecl->base)) {
     945                                                        auto typePtr = dynamic_cast<PointerType *>(enumDecl->base);
     946                                                        ResolvExpr::findSingleExpression( init->value,
     947                                                         new PointerType( Type::Qualifiers(), typePtr->base ), indexer );
     948                                                } else {
     949                                                        ResolvExpr::findSingleExpression( init->value, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), indexer );
     950                                                }
     951                                        }
     952                                       
    942953                                }
    943954                        }
     955
    944956                } // if
    945957        }
Note: See TracChangeset for help on using the changeset viewer.