Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Initializer.h

    r05d47278 r71f4e4f  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Initializer.h -- 
     7// Initializer.h --
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 18 09:03:48 2015
    13 // Update Count     : 1
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Wed Jan 13 15:29:53 2016
     13// Update Count     : 17
    1414//
    1515
     
    2727  public:
    2828        //      Initializer( std::string _name = std::string(""), int _pos = 0 );
    29         Initializer( );
     29        Initializer( bool maybeConstructed );
    3030        virtual ~Initializer();
    3131
     
    4343        }
    4444
     45        bool get_maybeConstructed() { return maybeConstructed; }
     46
    4547        virtual Initializer *clone() const = 0;
    4648        virtual void accept( Visitor &v ) = 0;
     
    5052        //      std::string name;
    5153        //      int pos;
     54        bool maybeConstructed;
    5255};
    5356
     
    5558class SingleInit : public Initializer {
    5659  public:
    57         SingleInit( Expression *value, std::list< Expression *> &designators = *(new std::list<Expression *>()) );
     60        SingleInit( Expression *value, std::list< Expression *> &designators, bool maybeConstructed );
    5861        SingleInit( const SingleInit &other );
    5962        virtual ~SingleInit();
    60        
     63
    6164        Expression *get_value() { return value; }
    6265        void set_value( Expression *newValue ) { value = newValue; }
     
    7982class ListInit : public Initializer {
    8083  public:
    81         ListInit( std::list<Initializer*> &, 
    82                           std::list<Expression *> &designators = *(new std::list<Expression *>()) );
     84        ListInit( std::list<Initializer*> &,
     85                          std::list<Expression *> &designators, bool maybeConstructed );
    8386        virtual ~ListInit();
    8487
     
    100103};
    101104
     105// ConstructorInit represents an initializer that is either a constructor expression or
     106// a C-style initializer.
     107class ConstructorInit : public Initializer {
     108  public:
     109        ConstructorInit( Expression * ctor, Initializer * init );
     110        virtual ~ConstructorInit();
     111
     112        void set_ctor( Expression * newValue ) { ctor = newValue; }
     113        Expression * get_ctor() const { return ctor; }
     114        void set_init( Initializer * newValue ) { init = newValue; }
     115        Initializer * get_init() const { return init; }
     116
     117        virtual ConstructorInit *clone() const;
     118        virtual void accept( Visitor &v ) { v.visit( this ); }
     119        virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     120        virtual void print( std::ostream &os, int indent = 0 );
     121
     122  private:
     123        Expression * ctor;
     124        // C-style initializer made up of SingleInit and ListInit nodes to use as a fallback
     125        // if an appropriate constructor definition is not found by the resolver
     126        Initializer * init;
     127};
     128
    102129#endif // INITIALIZER_H
    103130
Note: See TracChangeset for help on using the changeset viewer.