Changeset 16ba4897 for src/Common


Ignore:
Timestamp:
Oct 9, 2024, 5:07:59 PM (12 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
0766399
Parents:
1b770e40
Message:

Replaced SemanticErrorException::isEmpty with ...::throwIfNonEmpty. This is how it was used in every context and it saves a bit of text (if not two lines) at every use. I considered putting this function in the header for better inlining, but this should have at least the same preformance as the last version.

Location:
src/Common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Common/ErrorObjects.hpp

    r1b770e40 r16ba4897  
    4141        void append( SemanticErrorException & other );
    4242        void append( CodeLocation location, const std::string & );
    43         bool isEmpty() const;
     43        void throwIfNonEmpty();
    4444        void print();
    4545  private:
  • src/Common/SemanticError.cpp

    r1b770e40 r16ba4897  
    8888}
    8989
    90 bool SemanticErrorException::isEmpty() const {
    91         return errors.empty();
     90void SemanticErrorException::throwIfNonEmpty() {
     91        if ( !errors.empty() ) {
     92                throw *this;
     93        }
    9294}
    9395
Note: See TracChangeset for help on using the changeset viewer.