Ignore:
Timestamp:
Feb 28, 2018, 4:48:22 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
446ffa3
Parents:
6a8df56
Message:

Changed warning system to prepare for toggling warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    r6a8df56 ra16764a6  
    360360                        // the only case in which "void" is valid is where it is the only one in the list
    361361                        if ( containsVoid && ( nvals > 1 || isVarArgs ) ) {
    362                                 throw SemanticError( func, "invalid type void in function type " );
     362                                SemanticError( func, "invalid type void in function type " );
    363363                        }
    364364
     
    401401                for ( Expression * param : inst->parameters ) {
    402402                        if ( ! dynamic_cast< TypeExpr * >( param ) ) {
    403                                 throw SemanticError( inst, "Expression parameters for generic types are currently unsupported: " );
     403                                SemanticError( inst, "Expression parameters for generic types are currently unsupported: " );
    404404                        }
    405405                }
     
    501501                TraitDecl *traitDecl = local_indexer->lookupTrait( traitInst->name );
    502502                if ( ! traitDecl ) {
    503                         throw SemanticError( traitInst->location, "use of undeclared trait " + traitInst->name );
     503                        SemanticError( traitInst->location, "use of undeclared trait " + traitInst->name );
    504504                } // if
    505505                if ( traitDecl->get_parameters().size() != traitInst->get_parameters().size() ) {
    506                         throw SemanticError( traitInst, "incorrect number of trait parameters: " );
     506                        SemanticError( traitInst, "incorrect number of trait parameters: " );
    507507                } // if
    508508                traitInst->baseTrait = traitDecl;
     
    512512                        TypeExpr * expr = dynamic_cast< TypeExpr * >( std::get<1>(p) );
    513513                        if ( ! expr ) {
    514                                 throw SemanticError( std::get<1>(p), "Expression parameters for trait instances are currently unsupported: " );
     514                                SemanticError( std::get<1>(p), "Expression parameters for trait instances are currently unsupported: " );
    515515                        }
    516516                        if ( TypeInstType * inst = dynamic_cast< TypeInstType * >( expr->get_type() ) ) {
     
    618618                                bool isVoid = fixFunction( assertion );
    619619                                if ( isVoid ) {
    620                                         throw SemanticError( node, "invalid type void in assertion of function " );
     620                                        SemanticError( node, "invalid type void in assertion of function " );
    621621                                } // if
    622622                        } // for
     
    662662                // were cast to void.
    663663                if ( ! returnStmt->get_expr() && returnVals.size() != 0 ) {
    664                         throw SemanticError( returnStmt, "Non-void function returns no values: " );
     664                        SemanticError( returnStmt, "Non-void function returns no values: " );
    665665                }
    666666        }
     
    703703                                ReferenceToType *rtt = dynamic_cast<ReferenceToType*>(ret);
    704704                                if ( ! rtt ) {
    705                                         throw SemanticError( typeInst->location, "Cannot apply type parameters to base type of " + typeInst->name );
     705                                        SemanticError( typeInst->location, "Cannot apply type parameters to base type of " + typeInst->name );
    706706                                }
    707707                                rtt->get_parameters().clear();
     
    741741                        Type * t2 = typedefNames[ tyDecl->get_name() ].first->get_base();
    742742                        if ( ! ResolvExpr::typesCompatible( t1, t2, Indexer() ) ) {
    743                                 throw SemanticError( tyDecl->location, "Cannot redefine typedef: " + tyDecl->name );
     743                                SemanticError( tyDecl->location, "Cannot redefine typedef: " + tyDecl->name );
    744744                        }
    745745                        // Cannot redefine VLA typedefs. Note: this is slightly incorrect, because our notion of VLAs
     
    748748                        // to fix this corner case likely outweighs the utility of allowing it.
    749749                        if ( isVariableLength( t1 ) || isVariableLength( t2 ) ) {
    750                                 throw SemanticError( tyDecl->location, "Cannot redefine typedef: " + tyDecl->name );
     750                                SemanticError( tyDecl->location, "Cannot redefine typedef: " + tyDecl->name );
    751751                        }
    752752                } else {
     
    897897                if ( CodeGen::isCtorDtorAssign( funcDecl->get_name() ) ) { // TODO: also check /=, etc.
    898898                        if ( params.size() == 0 ) {
    899                                 throw SemanticError( funcDecl, "Constructors, destructors, and assignment functions require at least one parameter " );
     899                                SemanticError( funcDecl, "Constructors, destructors, and assignment functions require at least one parameter " );
    900900                        }
    901901                        ReferenceType * refType = dynamic_cast< ReferenceType * >( params.front()->get_type() );
    902902                        if ( ! refType ) {
    903                                 throw SemanticError( funcDecl, "First parameter of a constructor, destructor, or assignment function must be a reference " );
     903                                SemanticError( funcDecl, "First parameter of a constructor, destructor, or assignment function must be a reference " );
    904904                        }
    905905                        if ( CodeGen::isCtorDtor( funcDecl->get_name() ) && returnVals.size() != 0 ) {
    906                                 throw SemanticError( funcDecl, "Constructors and destructors cannot have explicit return values " );
     906                                SemanticError( funcDecl, "Constructors and destructors cannot have explicit return values " );
    907907                        }
    908908                }
     
    939939
    940940                        sub.apply( inst );
    941                         if ( args.size() < params->size() ) throw SemanticError( inst, "Too few type arguments in generic type " );
    942                         if ( args.size() > params->size() ) throw SemanticError( inst, "Too many type arguments in generic type " );
     941                        if ( args.size() < params->size() ) SemanticError( inst, "Too few type arguments in generic type " );
     942                        if ( args.size() > params->size() ) SemanticError( inst, "Too many type arguments in generic type " );
    943943                }
    944944        }
Note: See TracChangeset for help on using the changeset viewer.