Changes in src/SynTree/Statement.cc [ba3706f:d55d7a6]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Statement.cc
rba3706f rd55d7a6 100 100 //actually this is a syntactic error signaled by the parser 101 101 if ( type == BranchStmt::Goto && target.empty() ) { 102 throw SemanticError( "goto without target");102 throw SemanticError( target.get_statement()->location, "goto without target"); 103 103 } 104 104 } … … 107 107 Statement(), computedTarget( computedTarget ), type( type ) { 108 108 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"); 110 110 } 111 111 } … … 203 203 CaseStmt::CaseStmt( Expression *condition, const std::list<Statement *> &statements, bool deflt ) throw ( SemanticError ) : 204 204 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: " ); 206 206 } 207 207 … … 456 456 } 457 457 458 459 WithStmt::WithStmt( const std::list< Expression * > & exprs, Statement * stmt ) : Statement(), exprs( exprs ), stmt( stmt ) {} 460 WithStmt::WithStmt( const WithStmt & other ) : Statement( other ), stmt( maybeClone( other.stmt ) ) { 461 cloneAll( other.exprs, exprs ); 462 } 463 WithStmt::~WithStmt() { 464 deleteAll( exprs ); 465 delete stmt; 466 } 467 468 void 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 458 475 NullStmt::NullStmt( const std::list<Label> & labels ) : Statement( labels ) { 459 476 }
Note:
See TracChangeset
for help on using the changeset viewer.