Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.h

    rd5631b3 r312029a  
    163163};
    164164
    165 /// VariableExpr represents an expression that simply refers to the value of a named variable.
    166 /// Does not take ownership of var.
    167 class VariableExpr : public Expression {
    168   public:
    169         DeclarationWithType * var;
    170 
    171         VariableExpr();
    172         VariableExpr( DeclarationWithType * var );
    173         VariableExpr( const VariableExpr & other );
    174         virtual ~VariableExpr();
    175 
    176         bool get_lvalue() const final;
    177 
    178         DeclarationWithType * get_var() const { return var; }
    179         void set_var( DeclarationWithType * newValue ) { var = newValue; }
    180 
    181         static VariableExpr * functionPointer( FunctionDecl * decl );
    182 
    183         virtual VariableExpr * clone() const override { return new VariableExpr( * this ); }
    184         virtual void accept( Visitor & v ) override { v.visit( this ); }
    185         virtual void accept( Visitor & v ) const override { v.visit( this ); }
    186         virtual Expression * acceptMutator( Mutator & m ) override { return m.mutate( this ); }
    187         virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    188 };
    189 
    190165// The following classes are used to represent expression types that cannot be converted into
    191166// function-call format.
     
    231206  public:
    232207        Expression * arg;
    233 
    234         // Inidicates cast is introduced by the CFA type system.
    235         // true for casts that the resolver introduces to force a return type
    236         // false for casts from user code
    237         // false for casts from desugaring advanced CFA features into simpler CFA
    238         // example
    239         //   int * p;     // declaration
    240         //   (float *) p; // use, with subject cast
    241         // subject cast isGenerated means we are considering an interpretation with a type mismatch
    242         // subject cast not isGenerated means someone in charge wants it that way
    243         bool isGenerated = true;
     208        bool isGenerated = true; // cast generated implicitly by code generation or explicit in program
    244209
    245210        CastExpr( Expression * arg, bool isGenerated = true );
     
    273238
    274239        KeywordCastExpr( Expression * arg, AggregateDecl::Aggregate target );
    275         KeywordCastExpr( Expression * arg, AggregateDecl::Aggregate target, const Concrete & concrete_target );
    276240        KeywordCastExpr( const KeywordCastExpr & other );
    277241        virtual ~KeywordCastExpr();
     
    348312
    349313        virtual MemberExpr * clone() const override { return new MemberExpr( * this ); }
     314        virtual void accept( Visitor & v ) override { v.visit( this ); }
     315        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     316        virtual Expression * acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     317        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
     318};
     319
     320/// VariableExpr represents an expression that simply refers to the value of a named variable.
     321/// Does not take ownership of var.
     322class VariableExpr : public Expression {
     323  public:
     324        DeclarationWithType * var;
     325
     326        VariableExpr();
     327        VariableExpr( DeclarationWithType * var );
     328        VariableExpr( const VariableExpr & other );
     329        virtual ~VariableExpr();
     330
     331        bool get_lvalue() const final;
     332
     333        DeclarationWithType * get_var() const { return var; }
     334        void set_var( DeclarationWithType * newValue ) { var = newValue; }
     335
     336        static VariableExpr * functionPointer( FunctionDecl * decl );
     337
     338        virtual VariableExpr * clone() const override { return new VariableExpr( * this ); }
    350339        virtual void accept( Visitor & v ) override { v.visit( this ); }
    351340        virtual void accept( Visitor & v ) const override { v.visit( this ); }
Note: See TracChangeset for help on using the changeset viewer.