Ignore:
Timestamp:
Mar 9, 2023, 2:37:53 PM (17 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, master
Children:
fed03b3
Parents:
a29477f
Message:

Pre-translation pass on the parser. Entirely code readability improvements, no behaviour (on a larger scale) should be effected.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parserutility.h

    ra29477f r702e826  
    1010// Created On       : Sat May 16 15:31:46 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Feb 16 12:34:00 2023
    13 // Update Count     : 5
     12// Last Modified On : Thr Mar  9 12:16:00 2023
     13// Update Count     : 6
    1414//
    1515
     
    2020Expression *notZeroExpr( Expression *orig );
    2121
    22 template< typename T, typename U >
    23 struct maybeBuild_t {
    24         static T * doit( const U *orig ) {
    25                 if ( orig ) {
    26                         return orig->build();
    27                 } else {
    28                         return 0;
    29                 }
    30         }
    31 };
    32 
    33 template< typename T, typename U >
    34 static inline T * maybeBuild( const U *orig ) {
    35         return maybeBuild_t<T,U>::doit(orig);
     22template< typename T >
     23static inline auto maybeBuild( const T *orig ) -> decltype(orig->build()) {
     24        return (orig) ? orig->build() : nullptr;
    3625}
    3726
    38 template< typename T, typename U >
    39 static inline T * maybeMoveBuild( const U *orig ) {
    40         T* ret = maybeBuild<T>(orig);
     27template< typename T >
     28static inline auto maybeMoveBuild( const T *orig ) -> decltype(orig->build()) {
     29        auto ret = maybeBuild<T>(orig);
    4130        delete orig;
    4231        return ret;
Note: See TracChangeset for help on using the changeset viewer.