Changes in src/SynTree/Expression.h [65cdc1e:62423350]
- File:
-
- 1 edited
-
src/SynTree/Expression.h (modified) (63 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.h
r65cdc1e r62423350 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Fri Aug 8 11:54:00 201713 // Update Count : 4 411 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Mar 30 16:44:00 2017 13 // Update Count : 41 14 14 // 15 15 16 #pragma once 16 #ifndef EXPRESSION_H 17 #define EXPRESSION_H 17 18 18 19 #include <map> … … 29 30 class Expression : public BaseSyntaxNode{ 30 31 public: 31 Type * result;32 TypeSubstitution * env;33 Expression * argName; // if expression is used as an argument, it can be "designated" by this name34 bool extension = false;35 36 32 Expression( Expression * _aname = nullptr ); 37 33 Expression( const Expression & other ); … … 54 50 virtual Expression * acceptMutator( Mutator & m ) = 0; 55 51 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; 56 57 }; 57 58 … … 79 80 class ApplicationExpr : public Expression { 80 81 public: 81 Expression * function; 82 83 ApplicationExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >() ); 82 ApplicationExpr( Expression * function ); 84 83 ApplicationExpr( const ApplicationExpr & other ); 85 84 virtual ~ApplicationExpr(); … … 94 93 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 95 94 virtual void print( std::ostream & os, int indent = 0 ) const; 96 97 private: 95 private: 96 Expression * function; 98 97 std::list<Expression *> args; 99 98 InferredParams inferParams; … … 105 104 class UntypedExpr : public Expression { 106 105 public: 107 Expression * function;108 std::list<Expression*> args;109 110 106 UntypedExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >(), Expression *_aname = nullptr ); 111 107 UntypedExpr( const UntypedExpr & other ); … … 128 124 virtual void print( std::ostream & os, int indent = 0 ) const; 129 125 virtual void printArgs(std::ostream & os, int indent = 0) const; 126 private: 127 Expression * function; 128 std::list<Expression*> args; 130 129 }; 131 130 … … 133 132 class NameExpr : public Expression { 134 133 public: 135 std::string name;136 137 134 NameExpr( std::string name, Expression *_aname = nullptr ); 138 135 NameExpr( const NameExpr & other ); … … 146 143 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 147 144 virtual void print( std::ostream & os, int indent = 0 ) const; 145 private: 146 std::string name; 148 147 }; 149 148 … … 154 153 class AddressExpr : public Expression { 155 154 public: 156 Expression * arg;157 158 155 AddressExpr( Expression * arg, Expression *_aname = nullptr ); 159 156 AddressExpr( const AddressExpr & other ); … … 167 164 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 168 165 virtual void print( std::ostream & os, int indent = 0 ) const; 166 private: 167 Expression * arg; 169 168 }; 170 169 … … 172 171 class LabelAddressExpr : public Expression { 173 172 public: 174 Expression * arg;175 176 173 LabelAddressExpr( Expression * arg ); 177 174 LabelAddressExpr( const LabelAddressExpr & other ); … … 185 182 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 186 183 virtual void print( std::ostream & os, int indent = 0 ) const; 184 private: 185 Expression * arg; 187 186 }; 188 187 … … 190 189 class CastExpr : public Expression { 191 190 public: 192 Expression * arg;193 194 191 CastExpr( Expression * arg, Expression *_aname = nullptr ); 195 192 CastExpr( Expression * arg, Type * toType, Expression *_aname = nullptr ); … … 198 195 199 196 Expression * get_arg() const { return arg; } 200 void set_arg( Expression * newValue ) { arg = newValue; }197 void set_arg(Expression * newValue ) { arg = newValue; } 201 198 202 199 virtual CastExpr * clone() const { return new CastExpr( * this ); } … … 204 201 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 205 202 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: 211 204 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;224 205 }; 225 206 … … 227 208 class UntypedMemberExpr : public Expression { 228 209 public: 229 Expression * member;230 Expression * aggregate;231 232 210 UntypedMemberExpr( Expression * member, Expression * aggregate, Expression *_aname = nullptr ); 233 211 UntypedMemberExpr( const UntypedMemberExpr & other ); … … 243 221 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 244 222 virtual void print( std::ostream & os, int indent = 0 ) const; 223 private: 224 Expression * member; 225 Expression * aggregate; 245 226 }; 246 227 … … 249 230 class MemberExpr : public Expression { 250 231 public: 251 DeclarationWithType * member;252 Expression * aggregate;253 254 232 MemberExpr( DeclarationWithType * member, Expression * aggregate, Expression *_aname = nullptr ); 255 233 MemberExpr( const MemberExpr & other ); … … 265 243 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 266 244 virtual void print( std::ostream & os, int indent = 0 ) const; 245 private: 246 DeclarationWithType * member; 247 Expression * aggregate; 267 248 }; 268 249 … … 271 252 class VariableExpr : public Expression { 272 253 public: 273 DeclarationWithType * var;274 275 254 VariableExpr( DeclarationWithType * var, Expression *_aname = nullptr ); 276 255 VariableExpr( const VariableExpr & other ); … … 284 263 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 285 264 virtual void print( std::ostream & os, int indent = 0 ) const; 265 private: 266 DeclarationWithType * var; 286 267 }; 287 268 … … 289 270 class ConstantExpr : public Expression { 290 271 public: 291 Constant constant;292 293 272 ConstantExpr( Constant constant, Expression *_aname = nullptr ); 294 273 ConstantExpr( const ConstantExpr & other ); … … 302 281 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 303 282 virtual void print( std::ostream & os, int indent = 0 ) const; 283 private: 284 Constant constant; 304 285 }; 305 286 … … 307 288 class SizeofExpr : public Expression { 308 289 public: 309 Expression * expr;310 Type * type;311 bool isType;312 313 290 SizeofExpr( Expression * expr, Expression *_aname = nullptr ); 314 291 SizeofExpr( const SizeofExpr & other ); … … 327 304 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 328 305 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: 334 307 Expression * expr; 335 308 Type * type; 336 309 bool isType; 337 310 }; 311 312 /// AlignofExpr represents an alignof expression 313 class AlignofExpr : public Expression { 314 public: 338 315 AlignofExpr( Expression * expr, Expression *_aname = nullptr ); 339 316 AlignofExpr( const AlignofExpr & other ); … … 352 329 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 353 330 virtual void print( std::ostream & os, int indent = 0 ) const; 331 private: 332 Expression * expr; 333 Type * type; 334 bool isType; 354 335 }; 355 336 … … 357 338 class UntypedOffsetofExpr : public Expression { 358 339 public: 359 Type * type;360 std::string member;361 362 340 UntypedOffsetofExpr( Type * type, const std::string & member, Expression *_aname = nullptr ); 363 341 UntypedOffsetofExpr( const UntypedOffsetofExpr & other ); … … 373 351 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 374 352 virtual void print( std::ostream & os, int indent = 0 ) const; 353 private: 354 Type * type; 355 std::string member; 375 356 }; 376 357 … … 378 359 class OffsetofExpr : public Expression { 379 360 public: 380 Type * type;381 DeclarationWithType * member;382 383 361 OffsetofExpr( Type * type, DeclarationWithType * member, Expression *_aname = nullptr ); 384 362 OffsetofExpr( const OffsetofExpr & other ); … … 394 372 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 395 373 virtual void print( std::ostream & os, int indent = 0 ) const; 374 private: 375 Type * type; 376 DeclarationWithType * member; 396 377 }; 397 378 … … 399 380 class OffsetPackExpr : public Expression { 400 381 public: 401 StructInstType * type;402 403 382 OffsetPackExpr( StructInstType * type_, Expression * aname_ = 0 ); 404 383 OffsetPackExpr( const OffsetPackExpr & other ); … … 411 390 virtual void accept( Visitor & v ) { v.visit( this ); } 412 391 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 395 private: 396 StructInstType * type; 414 397 }; 415 398 … … 417 400 class AttrExpr : public Expression { 418 401 public: 419 Expression * attr;420 Expression * expr;421 Type * type;422 bool isType;423 424 402 AttrExpr(Expression * attr, Expression * expr, Expression *_aname = nullptr ); 425 403 AttrExpr( const AttrExpr & other ); … … 440 418 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 441 419 virtual void print( std::ostream & os, int indent = 0 ) const; 420 private: 421 Expression * attr; 422 Expression * expr; 423 Type * type; 424 bool isType; 442 425 }; 443 426 … … 445 428 class LogicalExpr : public Expression { 446 429 public: 447 Expression * arg1;448 Expression * arg2;449 450 430 LogicalExpr( Expression * arg1, Expression * arg2, bool andp = true, Expression *_aname = nullptr ); 451 431 LogicalExpr( const LogicalExpr & other ); … … 462 442 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 463 443 virtual void print( std::ostream & os, int indent = 0 ) const; 464 465 private: 444 private: 445 Expression * arg1; 446 Expression * arg2; 466 447 bool isAnd; 467 448 }; … … 470 451 class ConditionalExpr : public Expression { 471 452 public: 472 Expression * arg1;473 Expression * arg2;474 Expression * arg3;475 476 453 ConditionalExpr( Expression * arg1, Expression * arg2, Expression * arg3, Expression *_aname = nullptr ); 477 454 ConditionalExpr( const ConditionalExpr & other ); … … 489 466 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 490 467 virtual void print( std::ostream & os, int indent = 0 ) const; 468 private: 469 Expression * arg1; 470 Expression * arg2; 471 Expression * arg3; 491 472 }; 492 473 … … 494 475 class CommaExpr : public Expression { 495 476 public: 496 Expression * arg1;497 Expression * arg2;498 499 477 CommaExpr( Expression * arg1, Expression * arg2, Expression *_aname = nullptr ); 500 478 CommaExpr( const CommaExpr & other ); … … 510 488 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 511 489 virtual void print( std::ostream & os, int indent = 0 ) const; 490 private: 491 Expression * arg1; 492 Expression * arg2; 512 493 }; 513 494 … … 515 496 class TypeExpr : public Expression { 516 497 public: 517 Type * type;518 519 498 TypeExpr( Type * type ); 520 499 TypeExpr( const TypeExpr & other ); … … 528 507 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 529 508 virtual void print( std::ostream & os, int indent = 0 ) const; 509 private: 510 Type * type; 530 511 }; 531 512 … … 533 514 class AsmExpr : public Expression { 534 515 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 535 535 Expression * inout; 536 536 ConstantExpr * constraint; 537 537 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-Constraints558 538 }; 559 539 … … 562 542 class ImplicitCopyCtorExpr : public Expression { 563 543 public: 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: 564 560 ApplicationExpr * callExpr; 565 561 std::list< ObjectDecl * > tempDecls; 566 562 std::list< ObjectDecl * > returnDecls; 567 563 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;584 564 }; 585 565 … … 587 567 class ConstructorExpr : public Expression { 588 568 public: 589 Expression * callExpr;590 591 569 ConstructorExpr( Expression * callExpr ); 592 570 ConstructorExpr( const ConstructorExpr & other ); … … 600 578 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 601 579 virtual void print( std::ostream & os, int indent = 0 ) const; 580 private: 581 Expression * callExpr; 602 582 }; 603 583 … … 605 585 class CompoundLiteralExpr : public Expression { 606 586 public: 607 Initializer * initializer;608 609 587 CompoundLiteralExpr( Type * type, Initializer * initializer ); 610 588 CompoundLiteralExpr( const CompoundLiteralExpr & other ); … … 618 596 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 619 597 virtual void print( std::ostream & os, int indent = 0 ) const; 598 private: 599 Initializer * initializer; 620 600 }; 621 601 … … 623 603 class RangeExpr : public Expression { 624 604 public: 625 Expression * low, * high;626 627 605 RangeExpr( Expression * low, Expression * high ); 628 606 RangeExpr( const RangeExpr & other ); … … 637 615 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 638 616 virtual void print( std::ostream & os, int indent = 0 ) const; 617 private: 618 Expression * low, * high; 639 619 }; 640 620 … … 642 622 class UntypedTupleExpr : public Expression { 643 623 public: 644 std::list<Expression*> exprs;645 646 624 UntypedTupleExpr( const std::list< Expression * > & exprs, Expression *_aname = nullptr ); 647 625 UntypedTupleExpr( const UntypedTupleExpr & other ); … … 654 632 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 655 633 virtual void print( std::ostream & os, int indent = 0 ) const; 634 private: 635 std::list<Expression*> exprs; 656 636 }; 657 637 … … 659 639 class TupleExpr : public Expression { 660 640 public: 661 std::list<Expression*> exprs;662 663 641 TupleExpr( const std::list< Expression * > & exprs, Expression *_aname = nullptr ); 664 642 TupleExpr( const TupleExpr & other ); … … 671 649 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 672 650 virtual void print( std::ostream & os, int indent = 0 ) const; 651 private: 652 std::list<Expression*> exprs; 673 653 }; 674 654 … … 676 656 class TupleIndexExpr : public Expression { 677 657 public: 678 Expression * tuple;679 unsigned int index;680 681 658 TupleIndexExpr( Expression * tuple, unsigned int index ); 682 659 TupleIndexExpr( const TupleIndexExpr & other ); … … 692 669 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 693 670 virtual void print( std::ostream & os, int indent = 0 ) const; 671 private: 672 Expression * tuple; 673 unsigned int index; 694 674 }; 695 675 … … 697 677 class TupleAssignExpr : public Expression { 698 678 public: 699 StmtExpr * stmtExpr = nullptr;700 701 679 TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls, Expression * _aname = nullptr ); 702 680 TupleAssignExpr( const TupleAssignExpr & other ); … … 710 688 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 711 689 virtual void print( std::ostream & os, int indent = 0 ) const; 690 private: 691 StmtExpr * stmtExpr = nullptr; 712 692 }; 713 693 … … 715 695 class StmtExpr : public Expression { 716 696 public: 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; 711 private: 717 712 CompoundStmt * statements; 718 713 std::list< ObjectDecl * > returnDecls; // return variable(s) for stmt expression 719 714 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;735 715 }; 736 716 737 717 class UniqueExpr : public Expression { 738 718 public: 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; 738 private: 739 739 Expression * expr; 740 740 ObjectDecl * object; 741 741 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:764 742 int id; 765 743 static long long count; … … 778 756 class UntypedInitExpr : public Expression { 779 757 public: 780 Expression * expr;781 std::list<InitAlternative> initAlts;782 783 758 UntypedInitExpr( Expression * expr, const std::list<InitAlternative> & initAlts ); 784 759 UntypedInitExpr( const UntypedInitExpr & other ); … … 794 769 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 795 770 virtual void print( std::ostream & os, int indent = 0 ) const; 771 private: 772 Expression * expr; 773 std::list<InitAlternative> initAlts; 796 774 }; 797 775 798 776 class InitExpr : public Expression { 799 777 public: 800 Expression * expr;801 Designation * designation;802 803 778 InitExpr( Expression * expr, Designation * designation ); 804 779 InitExpr( const InitExpr & other ); … … 815 790 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 816 791 virtual void print( std::ostream & os, int indent = 0 ) const; 792 private: 793 Expression * expr; 794 Designation * designation; 817 795 }; 818 796 819 797 820 798 std::ostream & operator<<( std::ostream & out, const Expression * expr ); 799 800 #endif // EXPRESSION_H 821 801 822 802 // Local Variables: //
Note:
See TracChangeset
for help on using the changeset viewer.