Changes in src/SymTab/Validate.cc [11ab8ea8:ed8a0d2]
- File:
-
- 1 edited
-
src/SymTab/Validate.cc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Validate.cc
r11ab8ea8 red8a0d2 208 208 }; 209 209 210 /// ensure that generic types have the correct number of type arguments211 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 218 210 class ArrayLength : public Visitor { 219 211 public: … … 243 235 Pass3 pass3( 0 ); 244 236 CompoundLiteral compoundliteral; 245 ValidateGenericParameters genericParams; 246 237 238 HoistStruct::hoistStruct( translationUnit ); 247 239 EliminateTypedef::eliminateTypedef( translationUnit ); 248 HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order249 240 ReturnTypeFixer::fix( translationUnit ); // must happen before autogen 250 241 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 LinkReferenceToTypes252 242 acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist 253 243 VerifyCtorDtorAssign::verify( translationUnit ); // must happen before autogen, because autogen examines existing ctor/dtors … … 839 829 } 840 830 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 861 831 DeclarationWithType * CompoundLiteral::mutate( ObjectDecl *objectDecl ) { 862 832 storageClasses = objectDecl->get_storageClasses();
Note:
See TracChangeset
for help on using the changeset viewer.