Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/SemanticError.cc

    rd55d7a6 r80ac42d  
    2323#include "SemanticError.h"
    2424
    25 SemanticError::SemanticError( CodeLocation location, std::string error ) {
    26         append( location, error );
     25SemanticError::SemanticError() {
     26}
     27
     28SemanticError::SemanticError( std::string error ) {
     29        append( error );
    2730}
    2831
     
    3134}
    3235
    33 void SemanticError::append( CodeLocation location, const std::string & msg ) {
    34         errors.emplace_back( location, msg );
     36void SemanticError::append( const std::string & msg ) {
     37        errors.emplace_back( error_str() + msg );
    3538}
    3639
     
    3942}
    4043
    41 void SemanticError::print() {
     44void SemanticError::print( std::ostream &os ) {
    4245        using std::to_string;
    4346        for( auto err : errors ) {
    44                 std::cerr << bold() << err.location << error_str() << reset_font() << err.description << std::endl;
     47                os << err.location << err.description << std::endl;
    4548        }
    4649}
    4750
    48 SemanticWarning::SemanticWarning( CodeLocation location, std::string msg ) {
    49         std::cerr << bold() << location << warning_str() << reset_font() << msg << std::endl;
     51void SemanticError::set_location( const CodeLocation& location ) {
     52        errors.begin()->maybeSet( location );
    5053}
    5154
Note: See TracChangeset for help on using the changeset viewer.