Changes in src/SynTree/Expression.h [e4d829b:af5c204a]
- File:
-
- 1 edited
-
src/SynTree/Expression.h (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.h
re4d829b raf5c204a 226 226 }; 227 227 228 /// MemberExpr represents a member selection operation, e.g. q.p after processing by the expression analyzer 228 /// MemberExpr represents a member selection operation, e.g. q.p after processing by the expression analyzer. 229 /// Does not take ownership of member. 229 230 class MemberExpr : public Expression { 230 231 public: … … 247 248 }; 248 249 249 /// VariableExpr represents an expression that simply refers to the value of a named variable 250 /// VariableExpr represents an expression that simply refers to the value of a named variable. 251 /// Does not take ownership of var. 250 252 class VariableExpr : public Expression { 251 253 public: … … 598 600 }; 599 601 600 /// ValofExpr represents a GCC 'lambda expression'601 class UntypedValofExpr : public Expression {602 public:603 UntypedValofExpr( Statement *_body, Expression *_aname = nullptr ) : Expression( _aname ), body ( _body ) {}604 UntypedValofExpr( const UntypedValofExpr & other );605 virtual ~UntypedValofExpr();606 607 Expression * get_value();608 Statement * get_body() const { return body; }609 610 virtual UntypedValofExpr * clone() const { return new UntypedValofExpr( * this ); }611 virtual void accept( Visitor & v ) { v.visit( this ); }612 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }613 virtual void print( std::ostream & os, int indent = 0 ) const;614 private:615 Statement * body;616 };617 618 602 /// RangeExpr represents a range e.g. '3 ... 5' or '1~10' 619 603 class RangeExpr : public Expression { … … 688 672 Expression * tuple; 689 673 unsigned int index; 690 };691 692 /// MemberTupleExpr represents a tuple member selection operation on a struct type, e.g. s.[a, b, c] after processing by the expression analyzer693 class MemberTupleExpr : public Expression {694 public:695 MemberTupleExpr( Expression * member, Expression * aggregate, Expression * _aname = nullptr );696 MemberTupleExpr( const MemberTupleExpr & other );697 virtual ~MemberTupleExpr();698 699 Expression * get_member() const { return member; }700 Expression * get_aggregate() const { return aggregate; }701 MemberTupleExpr * set_member( Expression * newValue ) { member = newValue; return this; }702 MemberTupleExpr * set_aggregate( Expression * newValue ) { aggregate = newValue; return this; }703 704 virtual MemberTupleExpr * clone() const { return new MemberTupleExpr( * this ); }705 virtual void accept( Visitor & v ) { v.visit( this ); }706 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }707 virtual void print( std::ostream & os, int indent = 0 ) const;708 private:709 Expression * member;710 Expression * aggregate;711 674 }; 712 675 … … 781 744 }; 782 745 783 struct InitAlternative {784 public:785 Type * type = nullptr;786 Designation * designation = nullptr;787 InitAlternative( Type * type, Designation * designation );788 InitAlternative( const InitAlternative & other );789 InitAlternative & operator=( const Initializer & other ) = delete; // at the moment this isn't used, and I don't want to implement it790 ~InitAlternative();791 };792 793 class UntypedInitExpr : public Expression {794 public:795 UntypedInitExpr( Expression * expr, const std::list<InitAlternative> & initAlts );796 UntypedInitExpr( const UntypedInitExpr & other );797 ~UntypedInitExpr();798 799 Expression * get_expr() const { return expr; }800 UntypedInitExpr * set_expr( Expression * newValue ) { expr = newValue; return this; }801 802 std::list<InitAlternative> & get_initAlts() { return initAlts; }803 804 virtual UntypedInitExpr * clone() const { return new UntypedInitExpr( * this ); }805 virtual void accept( Visitor & v ) { v.visit( this ); }806 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }807 virtual void print( std::ostream & os, int indent = 0 ) const;808 private:809 Expression * expr;810 std::list<InitAlternative> initAlts;811 };812 813 class InitExpr : public Expression {814 public:815 InitExpr( Expression * expr, Type * type, Designation * designation );816 InitExpr( const InitExpr & other );817 ~InitExpr();818 819 Expression * get_expr() const { return expr; }820 InitExpr * set_expr( Expression * newValue ) { expr = newValue; return this; }821 822 Designation * get_designation() const { return designation; }823 InitExpr * set_designation( Designation * newValue ) { designation = newValue; return this; }824 825 virtual InitExpr * clone() const { return new InitExpr( * this ); }826 virtual void accept( Visitor & v ) { v.visit( this ); }827 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }828 virtual void print( std::ostream & os, int indent = 0 ) const;829 private:830 Expression * expr;831 Designation * designation;832 };833 834 835 746 std::ostream & operator<<( std::ostream & out, const Expression * expr ); 836 747
Note:
See TracChangeset
for help on using the changeset viewer.