Ignore:
Timestamp:
Jun 30, 2017, 4:59:54 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
a5de33e, b1e63ac5
Parents:
435e75f
git-author:
Rob Schluntz <rschlunt@…> (06/30/17 16:55:23)
git-committer:
Rob Schluntz <rschlunt@…> (06/30/17 16:59:54)
Message:

refactor indenter from CodeGen? and CurrentObject?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CurrentObject.cc

    r435e75f rf7cb0bc  
    1919#include "CurrentObject.h"
    2020
     21#include "Common/Indenter.h"
     22
    2123#include "SynTree/Declaration.h"
    2224#include "SynTree/Initializer.h"
     
    4547                        assertf( false, "unhandled type on getConstValue %s", toString( constExpr->get_result() ).c_str() ); // xxx - might be semantic error
    4648                }
    47         }
    48 
    49         struct Indenter {
    50                 static const int amt = 2;
    51                 unsigned int indent = 0;
    52 
    53                 Indenter & operator+=(int nlevels) { indent += amt*nlevels; return *this; }
    54                 Indenter & operator-=(int nlevels) { indent -= amt*nlevels; return *this; }
    55                 Indenter operator+(int nlevels) { Indenter indenter = *this; return indenter += nlevels; }
    56                 Indenter operator-(int nlevels) { Indenter indenter = *this; return indenter -= nlevels; }
    57                 Indenter & operator++() { return *this += 1; }
    58                 Indenter & operator--() { return *this -= 1; }
    59         };
    60         std::ostream & operator<<( std::ostream & out, Indenter & indent ) {
    61                 return out << std::string(indent.indent, ' ');
    6249        }
    6350
Note: See TracChangeset for help on using the changeset viewer.