Changeset af5c204a for src/SynTree
- Timestamp:
- Jun 21, 2017, 11:47:32 AM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 06edda0
- Parents:
- 4551a6e
- Location:
- src/SynTree
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
r4551a6e raf5c204a 588 588 } 589 589 590 UntypedValofExpr::UntypedValofExpr( const UntypedValofExpr & other ) : Expression( other ), body ( maybeClone( other.body ) ) {}591 592 UntypedValofExpr::~UntypedValofExpr() { delete body; }593 594 void UntypedValofExpr::print( std::ostream &os, int indent ) const {595 os << std::string( indent, ' ' ) << "Valof Expression: " << std::endl;596 if ( get_body() != 0 )597 get_body()->print( os, indent + 2 );598 }599 600 590 RangeExpr::RangeExpr( Expression *low, Expression *high ) : low( low ), high( high ) {} 601 591 RangeExpr::RangeExpr( const RangeExpr &other ) : Expression( other ), low( other.low->clone() ), high( other.high->clone() ) {} -
src/SynTree/Expression.h
r4551a6e raf5c204a 600 600 }; 601 601 602 /// ValofExpr represents a GCC 'lambda expression'603 class UntypedValofExpr : public Expression {604 public:605 UntypedValofExpr( Statement *_body, Expression *_aname = nullptr ) : Expression( _aname ), body ( _body ) {}606 UntypedValofExpr( const UntypedValofExpr & other );607 virtual ~UntypedValofExpr();608 609 Expression * get_value();610 Statement * get_body() const { return body; }611 612 virtual UntypedValofExpr * clone() const { return new UntypedValofExpr( * this ); }613 virtual void accept( Visitor & v ) { v.visit( this ); }614 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }615 virtual void print( std::ostream & os, int indent = 0 ) const;616 private:617 Statement * body;618 };619 620 602 /// RangeExpr represents a range e.g. '3 ... 5' or '1~10' 621 603 class RangeExpr : public Expression { -
src/SynTree/Mutator.cc
r4551a6e raf5c204a 380 380 } 381 381 382 Expression *Mutator::mutate( UntypedValofExpr *valofExpr ) {383 valofExpr->set_env( maybeMutate( valofExpr->get_env(), *this ) );384 valofExpr->set_result( maybeMutate( valofExpr->get_result(), *this ) );385 return valofExpr;386 }387 388 382 Expression *Mutator::mutate( RangeExpr *rangeExpr ) { 389 383 rangeExpr->set_env( maybeMutate( rangeExpr->get_env(), *this ) ); -
src/SynTree/Mutator.h
r4551a6e raf5c204a 78 78 virtual Expression* mutate( ConstructorExpr *ctorExpr ); 79 79 virtual Expression* mutate( CompoundLiteralExpr *compLitExpr ); 80 virtual Expression* mutate( UntypedValofExpr *valofExpr );81 80 virtual Expression* mutate( RangeExpr *rangeExpr ); 82 81 virtual Expression* mutate( UntypedTupleExpr *tupleExpr ); -
src/SynTree/Visitor.cc
r4551a6e raf5c204a 301 301 } 302 302 303 void Visitor::visit( UntypedValofExpr *valofExpr ) {304 maybeAccept( valofExpr->get_result(), *this );305 maybeAccept( valofExpr->get_body(), *this );306 }307 308 303 void Visitor::visit( RangeExpr *rangeExpr ) { 309 304 maybeAccept( rangeExpr->get_low(), *this ); -
src/SynTree/Visitor.h
r4551a6e raf5c204a 81 81 virtual void visit( ConstructorExpr * ctorExpr ); 82 82 virtual void visit( CompoundLiteralExpr *compLitExpr ); 83 virtual void visit( UntypedValofExpr *valofExpr );84 83 virtual void visit( RangeExpr *rangeExpr ); 85 84 virtual void visit( UntypedTupleExpr *tupleExpr ); … … 163 162 } // if 164 163 } catch( SemanticError &e ) { 165 e.set_location( (*i)->location ); 164 e.set_location( (*i)->location ); 166 165 errors.append( e ); 167 166 } // try
Note: See TracChangeset
for help on using the changeset viewer.