Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Statement.cc

    rba3706f rd55d7a6  
    100100        //actually this is a syntactic error signaled by the parser
    101101        if ( type == BranchStmt::Goto && target.empty() ) {
    102                 throw SemanticError("goto without target");
     102                throw SemanticError( target.get_statement()->location, "goto without target");
    103103        }
    104104}
     
    107107        Statement(), computedTarget( computedTarget ), type( type ) {
    108108        if ( type != BranchStmt::Goto || computedTarget == nullptr ) {
    109                 throw SemanticError("Computed target not valid in branch statement");
     109                throw SemanticError( computedTarget->location, "Computed target not valid in branch statement");
    110110        }
    111111}
     
    203203CaseStmt::CaseStmt( Expression *condition, const std::list<Statement *> &statements, bool deflt ) throw ( SemanticError ) :
    204204        Statement(), condition( condition ), stmts( statements ), _isDefault( deflt ) {
    205         if ( isDefault() && condition != 0 ) throw SemanticError("default case with condition: ", condition);
     205        if ( isDefault() && condition != 0 ) throw SemanticError( condition, "default case with condition: " );
    206206}
    207207
     
    456456}
    457457
     458
     459WithStmt::WithStmt( const std::list< Expression * > & exprs, Statement * stmt ) : Statement(), exprs( exprs ), stmt( stmt ) {}
     460WithStmt::WithStmt( const WithStmt & other ) : Statement( other ), stmt( maybeClone( other.stmt ) ) {
     461        cloneAll( other.exprs, exprs );
     462}
     463WithStmt::~WithStmt() {
     464        deleteAll( exprs );
     465        delete stmt;
     466}
     467
     468void WithStmt::print( std::ostream & os, Indenter indent ) const {
     469        os << "With statement" << endl;
     470        os << indent << "... with statement:" << endl << indent+1;
     471        stmt->print( os, indent+1 );
     472}
     473
     474
    458475NullStmt::NullStmt( const std::list<Label> & labels ) : Statement( labels ) {
    459476}
Note: See TracChangeset for help on using the changeset viewer.