Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.h

    r65cdc1e r62423350  
    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 : Fri Aug  8 11:54:00 2017
    13 // Update Count     : 44
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Mar 30 16:44:00 2017
     13// Update Count     : 41
    1414//
    1515
    16 #pragma once
     16#ifndef EXPRESSION_H
     17#define EXPRESSION_H
    1718
    1819#include <map>
     
    2930class Expression : public BaseSyntaxNode{
    3031  public:
    31         Type * result;
    32         TypeSubstitution * env;
    33         Expression * argName; // if expression is used as an argument, it can be "designated" by this name
    34         bool extension = false;
    35 
    3632        Expression( Expression * _aname = nullptr );
    3733        Expression( const Expression & other );
     
    5450        virtual Expression * acceptMutator( Mutator & m ) = 0;
    5551        virtual void print( std::ostream & os, int indent = 0 ) const;
     52  protected:
     53        Type * result;
     54        TypeSubstitution * env;
     55        Expression * argName; // if expression is used as an argument, it can be "designated" by this name
     56        bool extension = false;
    5657};
    5758
     
    7980class ApplicationExpr : public Expression {
    8081  public:
    81         Expression * function;
    82 
    83         ApplicationExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >() );
     82        ApplicationExpr( Expression * function );
    8483        ApplicationExpr( const ApplicationExpr & other );
    8584        virtual ~ApplicationExpr();
     
    9493        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    9594        virtual void print( std::ostream & os, int indent = 0 ) const;
    96 
    97   private:
     95  private:
     96        Expression * function;
    9897        std::list<Expression *> args;
    9998        InferredParams inferParams;
     
    105104class UntypedExpr : public Expression {
    106105  public:
    107         Expression * function;
    108         std::list<Expression*> args;
    109 
    110106        UntypedExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >(), Expression *_aname = nullptr );
    111107        UntypedExpr( const UntypedExpr & other );
     
    128124        virtual void print( std::ostream & os, int indent = 0 ) const;
    129125        virtual void printArgs(std::ostream & os, int indent = 0) const;
     126  private:
     127        Expression * function;
     128        std::list<Expression*> args;
    130129};
    131130
     
    133132class NameExpr : public Expression {
    134133  public:
    135         std::string name;
    136 
    137134        NameExpr( std::string name, Expression *_aname = nullptr );
    138135        NameExpr( const NameExpr & other );
     
    146143        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    147144        virtual void print( std::ostream & os, int indent = 0 ) const;
     145  private:
     146        std::string name;
    148147};
    149148
     
    154153class AddressExpr : public Expression {
    155154  public:
    156         Expression * arg;
    157 
    158155        AddressExpr( Expression * arg, Expression *_aname = nullptr );
    159156        AddressExpr( const AddressExpr & other );
     
    167164        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    168165        virtual void print( std::ostream & os, int indent = 0 ) const;
     166  private:
     167        Expression * arg;
    169168};
    170169
     
    172171class LabelAddressExpr : public Expression {
    173172  public:
    174         Expression * arg;
    175 
    176173        LabelAddressExpr( Expression * arg );
    177174        LabelAddressExpr( const LabelAddressExpr & other );
     
    185182        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    186183        virtual void print( std::ostream & os, int indent = 0 ) const;
     184  private:
     185        Expression * arg;
    187186};
    188187
     
    190189class CastExpr : public Expression {
    191190  public:
    192         Expression * arg;
    193 
    194191        CastExpr( Expression * arg, Expression *_aname = nullptr );
    195192        CastExpr( Expression * arg, Type * toType, Expression *_aname = nullptr );
     
    198195
    199196        Expression * get_arg() const { return arg; }
    200         void set_arg( Expression * newValue ) { arg = newValue; }
     197        void set_arg(Expression * newValue ) { arg = newValue; }
    201198
    202199        virtual CastExpr * clone() const { return new CastExpr( * this ); }
     
    204201        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    205202        virtual void print( std::ostream & os, int indent = 0 ) const;
    206 };
    207 
    208 /// VirtualCastExpr repersents a virtual dynamic cast, e.g. (virtual exception)e
    209 class VirtualCastExpr : public Expression {
    210   public:
     203  private:
    211204        Expression * arg;
    212 
    213         VirtualCastExpr( Expression * arg, Type * toType );
    214         VirtualCastExpr( const VirtualCastExpr & other );
    215         virtual ~VirtualCastExpr();
    216 
    217         Expression * get_arg() const { return arg; }
    218         void set_arg( Expression * newValue ) { arg = newValue; }
    219 
    220         virtual VirtualCastExpr * clone() const { return new VirtualCastExpr( * this ); }
    221         virtual void accept( Visitor & v ) { v.visit( this ); }
    222         virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    223         virtual void print( std::ostream & os, int indent = 0 ) const;
    224205};
    225206
     
    227208class UntypedMemberExpr : public Expression {
    228209  public:
    229         Expression * member;
    230         Expression * aggregate;
    231 
    232210        UntypedMemberExpr( Expression * member, Expression * aggregate, Expression *_aname = nullptr );
    233211        UntypedMemberExpr( const UntypedMemberExpr & other );
     
    243221        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    244222        virtual void print( std::ostream & os, int indent = 0 ) const;
     223  private:
     224        Expression * member;
     225        Expression * aggregate;
    245226};
    246227
     
    249230class MemberExpr : public Expression {
    250231  public:
    251         DeclarationWithType * member;
    252         Expression * aggregate;
    253 
    254232        MemberExpr( DeclarationWithType * member, Expression * aggregate, Expression *_aname = nullptr );
    255233        MemberExpr( const MemberExpr & other );
     
    265243        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    266244        virtual void print( std::ostream & os, int indent = 0 ) const;
     245  private:
     246        DeclarationWithType * member;
     247        Expression * aggregate;
    267248};
    268249
     
    271252class VariableExpr : public Expression {
    272253  public:
    273         DeclarationWithType * var;
    274 
    275254        VariableExpr( DeclarationWithType * var, Expression *_aname = nullptr );
    276255        VariableExpr( const VariableExpr & other );
     
    284263        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    285264        virtual void print( std::ostream & os, int indent = 0 ) const;
     265  private:
     266        DeclarationWithType * var;
    286267};
    287268
     
    289270class ConstantExpr : public Expression {
    290271  public:
    291         Constant constant;
    292 
    293272        ConstantExpr( Constant constant, Expression *_aname = nullptr );
    294273        ConstantExpr( const ConstantExpr & other );
     
    302281        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    303282        virtual void print( std::ostream & os, int indent = 0 ) const;
     283  private:
     284        Constant constant;
    304285};
    305286
     
    307288class SizeofExpr : public Expression {
    308289  public:
    309         Expression * expr;
    310         Type * type;
    311         bool isType;
    312 
    313290        SizeofExpr( Expression * expr, Expression *_aname = nullptr );
    314291        SizeofExpr( const SizeofExpr & other );
     
    327304        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    328305        virtual void print( std::ostream & os, int indent = 0 ) const;
    329 };
    330 
    331 /// AlignofExpr represents an alignof expression
    332 class AlignofExpr : public Expression {
    333   public:
     306  private:
    334307        Expression * expr;
    335308        Type * type;
    336309        bool isType;
    337 
     310};
     311
     312/// AlignofExpr represents an alignof expression
     313class AlignofExpr : public Expression {
     314  public:
    338315        AlignofExpr( Expression * expr, Expression *_aname = nullptr );
    339316        AlignofExpr( const AlignofExpr & other );
     
    352329        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    353330        virtual void print( std::ostream & os, int indent = 0 ) const;
     331  private:
     332        Expression * expr;
     333        Type * type;
     334        bool isType;
    354335};
    355336
     
    357338class UntypedOffsetofExpr : public Expression {
    358339  public:
    359         Type * type;
    360         std::string member;
    361 
    362340        UntypedOffsetofExpr( Type * type, const std::string & member, Expression *_aname = nullptr );
    363341        UntypedOffsetofExpr( const UntypedOffsetofExpr & other );
     
    373351        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    374352        virtual void print( std::ostream & os, int indent = 0 ) const;
     353  private:
     354        Type * type;
     355        std::string member;
    375356};
    376357
     
    378359class OffsetofExpr : public Expression {
    379360  public:
    380         Type * type;
    381         DeclarationWithType * member;
    382 
    383361        OffsetofExpr( Type * type, DeclarationWithType * member, Expression *_aname = nullptr );
    384362        OffsetofExpr( const OffsetofExpr & other );
     
    394372        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    395373        virtual void print( std::ostream & os, int indent = 0 ) const;
     374  private:
     375        Type * type;
     376        DeclarationWithType * member;
    396377};
    397378
     
    399380class OffsetPackExpr : public Expression {
    400381public:
    401         StructInstType * type;
    402 
    403382        OffsetPackExpr( StructInstType * type_, Expression * aname_ = 0 );
    404383        OffsetPackExpr( const OffsetPackExpr & other );
     
    411390        virtual void accept( Visitor & v ) { v.visit( this ); }
    412391        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    413         virtual void print( std::ostream & os, int indent = 0 ) const;
     392
     393        virtual void print( std::ostream & os, int indent = 0 ) const;
     394
     395private:
     396        StructInstType * type;
    414397};
    415398
     
    417400class AttrExpr : public Expression {
    418401  public:
    419         Expression * attr;
    420         Expression * expr;
    421         Type * type;
    422         bool isType;
    423 
    424402        AttrExpr(Expression * attr, Expression * expr, Expression *_aname = nullptr );
    425403        AttrExpr( const AttrExpr & other );
     
    440418        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    441419        virtual void print( std::ostream & os, int indent = 0 ) const;
     420  private:
     421        Expression * attr;
     422        Expression * expr;
     423        Type * type;
     424        bool isType;
    442425};
    443426
     
    445428class LogicalExpr : public Expression {
    446429  public:
    447         Expression * arg1;
    448         Expression * arg2;
    449 
    450430        LogicalExpr( Expression * arg1, Expression * arg2, bool andp = true, Expression *_aname = nullptr );
    451431        LogicalExpr( const LogicalExpr & other );
     
    462442        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    463443        virtual void print( std::ostream & os, int indent = 0 ) const;
    464 
    465   private:
     444  private:
     445        Expression * arg1;
     446        Expression * arg2;
    466447        bool isAnd;
    467448};
     
    470451class ConditionalExpr : public Expression {
    471452  public:
    472         Expression * arg1;
    473         Expression * arg2;
    474         Expression * arg3;
    475 
    476453        ConditionalExpr( Expression * arg1, Expression * arg2, Expression * arg3, Expression *_aname = nullptr );
    477454        ConditionalExpr( const ConditionalExpr & other );
     
    489466        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    490467        virtual void print( std::ostream & os, int indent = 0 ) const;
     468  private:
     469        Expression * arg1;
     470        Expression * arg2;
     471        Expression * arg3;
    491472};
    492473
     
    494475class CommaExpr : public Expression {
    495476  public:
    496         Expression * arg1;
    497         Expression * arg2;
    498 
    499477        CommaExpr( Expression * arg1, Expression * arg2, Expression *_aname = nullptr );
    500478        CommaExpr( const CommaExpr & other );
     
    510488        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    511489        virtual void print( std::ostream & os, int indent = 0 ) const;
     490  private:
     491        Expression * arg1;
     492        Expression * arg2;
    512493};
    513494
     
    515496class TypeExpr : public Expression {
    516497  public:
    517         Type * type;
    518 
    519498        TypeExpr( Type * type );
    520499        TypeExpr( const TypeExpr & other );
     
    528507        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    529508        virtual void print( std::ostream & os, int indent = 0 ) const;
     509  private:
     510        Type * type;
    530511};
    531512
     
    533514class AsmExpr : public Expression {
    534515  public:
     516        AsmExpr( Expression * inout, ConstantExpr * constraint, Expression * operand ) : inout( inout ), constraint( constraint ), operand( operand ) {}
     517        AsmExpr( const AsmExpr & other );
     518        virtual ~AsmExpr() { delete inout; delete constraint; delete operand; };
     519
     520        Expression * get_inout() const { return inout; }
     521        void set_inout( Expression * newValue ) { inout = newValue; }
     522
     523        ConstantExpr * get_constraint() const { return constraint; }
     524        void set_constraint( ConstantExpr * newValue ) { constraint = newValue; }
     525
     526        Expression * get_operand() const { return operand; }
     527        void set_operand( Expression * newValue ) { operand = newValue; }
     528
     529        virtual AsmExpr * clone() const { return new AsmExpr( * this ); }
     530        virtual void accept( Visitor & v ) { v.visit( this ); }
     531        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
     532        virtual void print( std::ostream & os, int indent = 0 ) const;
     533  private:
     534        // https://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/Machine-Constraints.html#Machine-Constraints
    535535        Expression * inout;
    536536        ConstantExpr * constraint;
    537537        Expression * operand;
    538 
    539         AsmExpr( Expression * inout, ConstantExpr * constraint, Expression * operand ) : inout( inout ), constraint( constraint ), operand( operand ) {}
    540         AsmExpr( const AsmExpr & other );
    541         virtual ~AsmExpr() { delete inout; delete constraint; delete operand; };
    542 
    543         Expression * get_inout() const { return inout; }
    544         void set_inout( Expression * newValue ) { inout = newValue; }
    545 
    546         ConstantExpr * get_constraint() const { return constraint; }
    547         void set_constraint( ConstantExpr * newValue ) { constraint = newValue; }
    548 
    549         Expression * get_operand() const { return operand; }
    550         void set_operand( Expression * newValue ) { operand = newValue; }
    551 
    552         virtual AsmExpr * clone() const { return new AsmExpr( * this ); }
    553         virtual void accept( Visitor & v ) { v.visit( this ); }
    554         virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    555         virtual void print( std::ostream & os, int indent = 0 ) const;
    556 
    557         // https://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/Machine-Constraints.html#Machine-Constraints
    558538};
    559539
     
    562542class ImplicitCopyCtorExpr : public Expression {
    563543public:
     544        ImplicitCopyCtorExpr( ApplicationExpr * callExpr );
     545        ImplicitCopyCtorExpr( const ImplicitCopyCtorExpr & other );
     546        virtual ~ImplicitCopyCtorExpr();
     547
     548        ApplicationExpr * get_callExpr() const { return callExpr; }
     549        void set_callExpr( ApplicationExpr * newValue ) { callExpr = newValue; }
     550
     551        std::list< ObjectDecl * > & get_tempDecls() { return tempDecls; }
     552        std::list< ObjectDecl * > & get_returnDecls() { return returnDecls; }
     553        std::list< Expression * > & get_dtors() { return dtors; }
     554
     555        virtual ImplicitCopyCtorExpr * clone() const { return new ImplicitCopyCtorExpr( * this ); }
     556        virtual void accept( Visitor & v ) { v.visit( this ); }
     557        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
     558        virtual void print( std::ostream & os, int indent = 0 ) const;
     559  private:
    564560        ApplicationExpr * callExpr;
    565561        std::list< ObjectDecl * > tempDecls;
    566562        std::list< ObjectDecl * > returnDecls;
    567563        std::list< Expression * > dtors;
    568 
    569         ImplicitCopyCtorExpr( ApplicationExpr * callExpr );
    570         ImplicitCopyCtorExpr( const ImplicitCopyCtorExpr & other );
    571         virtual ~ImplicitCopyCtorExpr();
    572 
    573         ApplicationExpr * get_callExpr() const { return callExpr; }
    574         void set_callExpr( ApplicationExpr * newValue ) { callExpr = newValue; }
    575 
    576         std::list< ObjectDecl * > & get_tempDecls() { return tempDecls; }
    577         std::list< ObjectDecl * > & get_returnDecls() { return returnDecls; }
    578         std::list< Expression * > & get_dtors() { return dtors; }
    579 
    580         virtual ImplicitCopyCtorExpr * clone() const { return new ImplicitCopyCtorExpr( * this ); }
    581         virtual void accept( Visitor & v ) { v.visit( this ); }
    582         virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    583         virtual void print( std::ostream & os, int indent = 0 ) const;
    584564};
    585565
     
    587567class ConstructorExpr : public Expression {
    588568public:
    589         Expression * callExpr;
    590 
    591569        ConstructorExpr( Expression * callExpr );
    592570        ConstructorExpr( const ConstructorExpr & other );
     
    600578        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    601579        virtual void print( std::ostream & os, int indent = 0 ) const;
     580private:
     581        Expression * callExpr;
    602582};
    603583
     
    605585class CompoundLiteralExpr : public Expression {
    606586  public:
    607         Initializer * initializer;
    608 
    609587        CompoundLiteralExpr( Type * type, Initializer * initializer );
    610588        CompoundLiteralExpr( const CompoundLiteralExpr & other );
     
    618596        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    619597        virtual void print( std::ostream & os, int indent = 0 ) const;
     598  private:
     599        Initializer * initializer;
    620600};
    621601
     
    623603class RangeExpr : public Expression {
    624604  public:
    625         Expression * low, * high;
    626 
    627605        RangeExpr( Expression * low, Expression * high );
    628606        RangeExpr( const RangeExpr & other );
     
    637615        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    638616        virtual void print( std::ostream & os, int indent = 0 ) const;
     617  private:
     618        Expression * low, * high;
    639619};
    640620
     
    642622class UntypedTupleExpr : public Expression {
    643623  public:
    644         std::list<Expression*> exprs;
    645 
    646624        UntypedTupleExpr( const std::list< Expression * > & exprs, Expression *_aname = nullptr );
    647625        UntypedTupleExpr( const UntypedTupleExpr & other );
     
    654632        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    655633        virtual void print( std::ostream & os, int indent = 0 ) const;
     634  private:
     635        std::list<Expression*> exprs;
    656636};
    657637
     
    659639class TupleExpr : public Expression {
    660640  public:
    661         std::list<Expression*> exprs;
    662 
    663641        TupleExpr( const std::list< Expression * > & exprs, Expression *_aname = nullptr );
    664642        TupleExpr( const TupleExpr & other );
     
    671649        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    672650        virtual void print( std::ostream & os, int indent = 0 ) const;
     651  private:
     652        std::list<Expression*> exprs;
    673653};
    674654
     
    676656class TupleIndexExpr : public Expression {
    677657  public:
    678         Expression * tuple;
    679         unsigned int index;
    680 
    681658        TupleIndexExpr( Expression * tuple, unsigned int index );
    682659        TupleIndexExpr( const TupleIndexExpr & other );
     
    692669        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    693670        virtual void print( std::ostream & os, int indent = 0 ) const;
     671  private:
     672        Expression * tuple;
     673        unsigned int index;
    694674};
    695675
     
    697677class TupleAssignExpr : public Expression {
    698678  public:
    699         StmtExpr * stmtExpr = nullptr;
    700 
    701679        TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls, Expression * _aname = nullptr );
    702680        TupleAssignExpr( const TupleAssignExpr & other );
     
    710688        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    711689        virtual void print( std::ostream & os, int indent = 0 ) const;
     690  private:
     691        StmtExpr * stmtExpr = nullptr;
    712692};
    713693
     
    715695class StmtExpr : public Expression {
    716696public:
     697        StmtExpr( CompoundStmt * statements );
     698        StmtExpr( const StmtExpr & other );
     699        virtual ~StmtExpr();
     700
     701        CompoundStmt * get_statements() const { return statements; }
     702        StmtExpr * set_statements( CompoundStmt * newValue ) { statements = newValue; return this; }
     703
     704        std::list< ObjectDecl * > & get_returnDecls() { return returnDecls; }
     705        std::list< Expression * > & get_dtors() { return dtors; }
     706
     707        virtual StmtExpr * clone() const { return new StmtExpr( * this ); }
     708        virtual void accept( Visitor & v ) { v.visit( this ); }
     709        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
     710        virtual void print( std::ostream & os, int indent = 0 ) const;
     711private:
    717712        CompoundStmt * statements;
    718713        std::list< ObjectDecl * > returnDecls; // return variable(s) for stmt expression
    719714        std::list< Expression * > dtors; // destructor(s) for return variable(s)
    720 
    721         StmtExpr( CompoundStmt * statements );
    722         StmtExpr( const StmtExpr & other );
    723         virtual ~StmtExpr();
    724 
    725         CompoundStmt * get_statements() const { return statements; }
    726         StmtExpr * set_statements( CompoundStmt * newValue ) { statements = newValue; return this; }
    727 
    728         std::list< ObjectDecl * > & get_returnDecls() { return returnDecls; }
    729         std::list< Expression * > & get_dtors() { return dtors; }
    730 
    731         virtual StmtExpr * clone() const { return new StmtExpr( * this ); }
    732         virtual void accept( Visitor & v ) { v.visit( this ); }
    733         virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    734         virtual void print( std::ostream & os, int indent = 0 ) const;
    735715};
    736716
    737717class UniqueExpr : public Expression {
    738718public:
     719        UniqueExpr( Expression * expr, long long idVal = -1 );
     720        UniqueExpr( const UniqueExpr & other );
     721        ~UniqueExpr();
     722
     723        Expression * get_expr() const { return expr; }
     724        UniqueExpr * set_expr( Expression * newValue ) { expr = newValue; return this; }
     725
     726        ObjectDecl * get_object() const { return object; }
     727        UniqueExpr * set_object( ObjectDecl * newValue ) { object = newValue; return this; }
     728
     729        VariableExpr * get_var() const { return var; }
     730        UniqueExpr * set_var( VariableExpr * newValue ) { var = newValue; return this; }
     731
     732        int get_id() const { return id; }
     733
     734        virtual UniqueExpr * clone() const { return new UniqueExpr( * this ); }
     735        virtual void accept( Visitor & v ) { v.visit( this ); }
     736        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
     737        virtual void print( std::ostream & os, int indent = 0 ) const;
     738private:
    739739        Expression * expr;
    740740        ObjectDecl * object;
    741741        VariableExpr * var;
    742 
    743         UniqueExpr( Expression * expr, long long idVal = -1 );
    744         UniqueExpr( const UniqueExpr & other );
    745         ~UniqueExpr();
    746 
    747         Expression * get_expr() const { return expr; }
    748         UniqueExpr * set_expr( Expression * newValue ) { expr = newValue; return this; }
    749 
    750         ObjectDecl * get_object() const { return object; }
    751         UniqueExpr * set_object( ObjectDecl * newValue ) { object = newValue; return this; }
    752 
    753         VariableExpr * get_var() const { return var; }
    754         UniqueExpr * set_var( VariableExpr * newValue ) { var = newValue; return this; }
    755 
    756         int get_id() const { return id; }
    757 
    758         virtual UniqueExpr * clone() const { return new UniqueExpr( * this ); }
    759         virtual void accept( Visitor & v ) { v.visit( this ); }
    760         virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    761         virtual void print( std::ostream & os, int indent = 0 ) const;
    762 
    763 private:
    764742        int id;
    765743        static long long count;
     
    778756class UntypedInitExpr : public Expression {
    779757public:
    780         Expression * expr;
    781         std::list<InitAlternative> initAlts;
    782 
    783758        UntypedInitExpr( Expression * expr, const std::list<InitAlternative> & initAlts );
    784759        UntypedInitExpr( const UntypedInitExpr & other );
     
    794769        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    795770        virtual void print( std::ostream & os, int indent = 0 ) const;
     771private:
     772        Expression * expr;
     773        std::list<InitAlternative> initAlts;
    796774};
    797775
    798776class InitExpr : public Expression {
    799777public:
    800         Expression * expr;
    801         Designation * designation;
    802 
    803778        InitExpr( Expression * expr, Designation * designation );
    804779        InitExpr( const InitExpr & other );
     
    815790        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    816791        virtual void print( std::ostream & os, int indent = 0 ) const;
     792private:
     793        Expression * expr;
     794        Designation * designation;
    817795};
    818796
    819797
    820798std::ostream & operator<<( std::ostream & out, const Expression * expr );
     799
     800#endif // EXPRESSION_H
    821801
    822802// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.