Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    r11ab8ea8 red8a0d2  
    208208        };
    209209
    210         /// ensure that generic types have the correct number of type arguments
    211         class ValidateGenericParameters : public Visitor {
    212         public:
    213                 typedef Visitor Parent;
    214                 virtual void visit( StructInstType * inst ) final override;
    215                 virtual void visit( UnionInstType * inst ) final override;
    216         };
    217 
    218210        class ArrayLength : public Visitor {
    219211        public:
     
    243235                Pass3 pass3( 0 );
    244236                CompoundLiteral compoundliteral;
    245                 ValidateGenericParameters genericParams;
    246 
     237
     238                HoistStruct::hoistStruct( translationUnit );
    247239                EliminateTypedef::eliminateTypedef( translationUnit );
    248                 HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order
    249240                ReturnTypeFixer::fix( translationUnit ); // must happen before autogen
    250241                acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions
    251                 acceptAll( translationUnit, genericParams );  // check as early as possible - can't happen before LinkReferenceToTypes
    252242                acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist
    253243                VerifyCtorDtorAssign::verify( translationUnit );  // must happen before autogen, because autogen examines existing ctor/dtors
     
    839829        }
    840830
    841         template< typename Aggr >
    842         void validateGeneric( Aggr * inst ) {
    843                 std::list< TypeDecl * > * params = inst->get_baseParameters();
    844                 if ( params != NULL ) {
    845                         std::list< Expression * > & args = inst->get_parameters();
    846                         if ( args.size() < params->size() ) throw SemanticError( "Too few type arguments in generic type ", inst );
    847                         if ( args.size() > params->size() ) throw SemanticError( "Too many type arguments in generic type ", inst );
    848                 }
    849         }
    850 
    851         void ValidateGenericParameters::visit( StructInstType * inst ) {
    852                 validateGeneric( inst );
    853                 Parent::visit( inst );
    854         }
    855 
    856         void ValidateGenericParameters::visit( UnionInstType * inst ) {
    857                 validateGeneric( inst );
    858                 Parent::visit( inst );
    859         }
    860 
    861831        DeclarationWithType * CompoundLiteral::mutate( ObjectDecl *objectDecl ) {
    862832                storageClasses = objectDecl->get_storageClasses();
Note: See TracChangeset for help on using the changeset viewer.