- Timestamp:
- Dec 2, 2020, 1:01:01 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- b37515b
- Parents:
- 833ba13
- Location:
- src/Common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/CodeLocation.h
r833ba13 rddcedfe 42 42 } 43 43 44 bool followedBy( CodeLocation const & other, int seperation ) { 44 bool startsBefore( CodeLocation const & other ) const { 45 if( filename < other.filename ) return true; 46 if( filename > other.filename ) return false; 47 48 if( first_line < other.first_line ) return true; 49 if( first_line > other.first_line ) return false; 50 51 if( last_line < other.last_line ) return true; 52 return false; 53 } 54 55 bool followedBy( CodeLocation const & other, int seperation ) const { 45 56 return (first_line + seperation == other.first_line && 46 57 filename == other.filename); 47 58 } 48 59 49 bool operator==( CodeLocation const & other ) {60 bool operator==( CodeLocation const & other ) const { 50 61 return followedBy( other, 0 ); 51 62 } 52 63 53 bool operator!=( CodeLocation const & other ) {64 bool operator!=( CodeLocation const & other ) const { 54 65 return !(*this == other); 55 66 } -
src/Common/SemanticError.cc
r833ba13 rddcedfe 90 90 void SemanticErrorException::print() { 91 91 using std::to_string; 92 93 errors.sort([](const error & lhs, const error & rhs) -> bool { 94 if(lhs.location.startsBefore(rhs.location)) return true; 95 if(rhs.location.startsBefore(lhs.location)) return false; 96 97 return lhs.description < rhs.description; 98 }); 99 92 100 for( auto err : errors ) { 93 101 std::cerr << ErrorHelpers::bold() << err.location << ErrorHelpers::error_str() << ErrorHelpers::reset_font() << err.description << std::endl;
Note: See TracChangeset
for help on using the changeset viewer.