Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Initializer.h

    r65cdc1e re4d829b  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Aug  9 10:19:00 2017
    13 // Update Count     : 22
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Mar 23 16:12:42 2017
     13// Update Count     : 20
    1414//
    1515
    16 #pragma once
     16#ifndef INITIALIZER_H
     17#define INITIALIZER_H
    1718
    1819#include <cassert>
     
    2728class Designation : public BaseSyntaxNode {
    2829public:
    29         std::list< Expression * > designators;
    30 
    3130        Designation( const std::list< Expression * > & designators );
    3231        Designation( const Designation & other );
     
    3938        virtual Designation * acceptMutator( Mutator &m ) { return m.mutate( this ); }
    4039        virtual void print( std::ostream &os, int indent = 0 ) const;
     40private:
     41        std::list< Expression * > designators;
    4142};
    4243
     
    6364class SingleInit : public Initializer {
    6465  public:
    65         //Constant *value;
    66         Expression *value;      // has to be a compile-time constant
    67 
    6866        SingleInit( Expression *value, bool maybeConstructed = false );
    6967        SingleInit( const SingleInit &other );
     
    7775        virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    7876        virtual void print( std::ostream &os, int indent = 0 ) const;
     77  private:
     78        //Constant *value;
     79        Expression *value;      // has to be a compile-time constant
    7980};
    8081
     
    8384class ListInit : public Initializer {
    8485  public:
    85         std::list<Initializer *> initializers;  // order *is* important
    86         std::list<Designation *> designations;  // order/length is consistent with initializers
    87 
    8886        ListInit( const std::list<Initializer*> &initializers,
    8987                          const std::list<Designation *> &designators = {}, bool maybeConstructed = false );
     
    105103        virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    106104        virtual void print( std::ostream &os, int indent = 0 ) const;
     105  private:
     106        std::list<Initializer *> initializers;  // order *is* important
     107        std::list<Designation *> designations;  // order/length is consistent with initializers
    107108};
    108109
     
    113114class ConstructorInit : public Initializer {
    114115  public:
    115         Statement * ctor;
    116         Statement * dtor;
    117 
    118116        ConstructorInit( Statement * ctor, Statement * dtor, Initializer * init );
    119117        ConstructorInit( const ConstructorInit &other );
     
    133131
    134132  private:
     133        Statement * ctor;
     134        Statement * dtor;
    135135        // C-style initializer made up of SingleInit and ListInit nodes to use as a fallback
    136136        // if an appropriate constructor definition is not found by the resolver
     
    141141std::ostream & operator<<( std::ostream & out, const Designation * des );
    142142
     143#endif // INITIALIZER_H
     144
    143145// Local Variables: //
    144146// tab-width: 4 //
Note: See TracChangeset for help on using the changeset viewer.