Ignore:
Timestamp:
Jan 13, 2016, 5:19:47 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
f1e012b
Parents:
02c7d04
Message:

added ConstructorInit?, simple constructors and destructors work correctly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Initializer.cc

    r02c7d04 r71f4e4f  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Thu Jan 07 15:00:18 2016
    13 // Update Count     : 23
     12// Last Modified On : Wed Jan 13 15:31:45 2016
     13// Update Count     : 28
    1414//
    1515
     
    7979                (*i)->print( os, indent + 2 );
    8080}
     81
     82
     83ConstructorInit::ConstructorInit( Expression * ctor, Initializer * init ) : Initializer( true ), ctor( ctor ), init( init ) {}
     84ConstructorInit::~ConstructorInit() {
     85        delete ctor;
     86        delete init;
     87}
     88
     89ConstructorInit *ConstructorInit::clone() const {
     90        return new ConstructorInit( *this );
     91}
     92
     93void ConstructorInit::print( std::ostream &os, int indent ) {
     94        os << std::endl << std::string(indent, ' ') << "Constructor initializer: ";
     95        if ( ctor ) {
     96                os << " initially constructed with ";
     97                ctor->print( os, indent+2 );
     98        } // if
     99
     100        if ( init ) {
     101                os << " with fallback C-style initializer: ";
     102                init->print( os, indent+2 );
     103        }
     104}
     105
     106
    81107// Local Variables: //
    82108// tab-width: 4 //
Note: See TracChangeset for help on using the changeset viewer.