Changes in src/SynTree/Expression.h [62423350:fbcde64]
- File:
-
- 1 edited
-
src/SynTree/Expression.h (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.h
r62423350 rfbcde64 226 226 }; 227 227 228 /// MemberExpr represents a member selection operation, e.g. q.p after processing by the expression analyzer. 229 /// Does not take ownership of member. 228 /// MemberExpr represents a member selection operation, e.g. q.p after processing by the expression analyzer 230 229 class MemberExpr : public Expression { 231 230 public: … … 248 247 }; 249 248 250 /// VariableExpr represents an expression that simply refers to the value of a named variable. 251 /// Does not take ownership of var. 249 /// VariableExpr represents an expression that simply refers to the value of a named variable 252 250 class VariableExpr : public Expression { 253 251 public: … … 600 598 }; 601 599 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 602 618 /// RangeExpr represents a range e.g. '3 ... 5' or '1~10' 603 619 class RangeExpr : public Expression { … … 672 688 Expression * tuple; 673 689 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 analyzer 693 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; 674 711 }; 675 712 … … 744 781 }; 745 782 746 struct InitAlternative {747 public:748 Type * type = nullptr;749 Designation * designation = nullptr;750 InitAlternative( Type * type, Designation * designation );751 InitAlternative( const InitAlternative & other );752 InitAlternative & operator=( const Initializer & other ) = delete; // at the moment this isn't used, and I don't want to implement it753 ~InitAlternative();754 };755 756 class UntypedInitExpr : public Expression {757 public:758 UntypedInitExpr( Expression * expr, const std::list<InitAlternative> & initAlts );759 UntypedInitExpr( const UntypedInitExpr & other );760 ~UntypedInitExpr();761 762 Expression * get_expr() const { return expr; }763 UntypedInitExpr * set_expr( Expression * newValue ) { expr = newValue; return this; }764 765 std::list<InitAlternative> & get_initAlts() { return initAlts; }766 767 virtual UntypedInitExpr * clone() const { return new UntypedInitExpr( * this ); }768 virtual void accept( Visitor & v ) { v.visit( this ); }769 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }770 virtual void print( std::ostream & os, int indent = 0 ) const;771 private:772 Expression * expr;773 std::list<InitAlternative> initAlts;774 };775 776 class InitExpr : public Expression {777 public:778 InitExpr( Expression * expr, Designation * designation );779 InitExpr( const InitExpr & other );780 ~InitExpr();781 782 Expression * get_expr() const { return expr; }783 InitExpr * set_expr( Expression * newValue ) { expr = newValue; return this; }784 785 Designation * get_designation() const { return designation; }786 InitExpr * set_designation( Designation * newValue ) { designation = newValue; return this; }787 788 virtual InitExpr * clone() const { return new InitExpr( * this ); }789 virtual void accept( Visitor & v ) { v.visit( this ); }790 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }791 virtual void print( std::ostream & os, int indent = 0 ) const;792 private:793 Expression * expr;794 Designation * designation;795 };796 797 798 783 std::ostream & operator<<( std::ostream & out, const Expression * expr ); 799 784
Note:
See TracChangeset
for help on using the changeset viewer.