Changeset af5c204


Ignore:
Timestamp:
Jun 21, 2017, 11:47:32 AM (4 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
06edda0
Parents:
4551a6e
Message:

remove UntypedValOfExpr? and hook in build for StmtExpr?

Location:
src
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • src/Common/PassVisitor.h

    r4551a6e raf5c204  
    9595        virtual void visit( ConstructorExpr * ctorExpr ) override final;
    9696        virtual void visit( CompoundLiteralExpr *compLitExpr ) override final;
    97         virtual void visit( UntypedValofExpr *valofExpr ) override final;
    9897        virtual void visit( RangeExpr *rangeExpr ) override final;
    9998        virtual void visit( UntypedTupleExpr *tupleExpr ) override final;
     
    181180        virtual Expression* mutate( ConstructorExpr *ctorExpr ) override final;
    182181        virtual Expression* mutate( CompoundLiteralExpr *compLitExpr ) override final;
    183         virtual Expression* mutate( UntypedValofExpr *valofExpr ) override final;
    184182        virtual Expression* mutate( RangeExpr *rangeExpr ) override final;
    185183        virtual Expression* mutate( UntypedTupleExpr *tupleExpr ) override final;
  • src/Common/PassVisitor.impl.h

    r4551a6e raf5c204  
    607607template< typename pass_type >
    608608void PassVisitor< pass_type >::visit( CompoundLiteralExpr * node ) {
    609         VISIT_BODY( node );
    610 }
    611 
    612 template< typename pass_type >
    613 void PassVisitor< pass_type >::visit( UntypedValofExpr * node ) {
    614         VISIT_BODY( node );
     609        VISIT_BODY( node );
    615610}
    616611
     
    988983
    989984template< typename pass_type >
    990 Expression * PassVisitor< pass_type >::mutate( UntypedValofExpr * node ) {
    991         MUTATE_BODY( Expression, node );
    992 }
    993 
    994 template< typename pass_type >
    995985Expression * PassVisitor< pass_type >::mutate( RangeExpr * node ) {
    996986        MUTATE_BODY( Expression, node );
  • src/Parser/ExpressionNode.cc

    r4551a6e raf5c204  
    346346
    347347Expression *build_valexpr( StatementNode *s ) {
    348         return new UntypedValofExpr( maybeMoveBuild< Statement >(s), nullptr );
     348        return new StmtExpr( dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(s) ) );
    349349}
    350350Expression *build_typevalue( DeclarationNode *decl ) {
  • src/SymTab/Indexer.cc

    r4551a6e raf5c204  
    493493                acceptNewScope( compLitExpr->get_result(), *this );
    494494                maybeAccept( compLitExpr->get_initializer(), *this );
    495         }
    496 
    497         void Indexer::visit( UntypedValofExpr *valofExpr ) {
    498                 acceptNewScope( valofExpr->get_result(), *this );
    499                 maybeAccept( valofExpr->get_body(), *this );
    500495        }
    501496
  • src/SymTab/Indexer.h

    r4551a6e raf5c204  
    6969                virtual void visit( ConstructorExpr * ctorExpr );
    7070                virtual void visit( CompoundLiteralExpr *compLitExpr );
    71                 virtual void visit( UntypedValofExpr *valofExpr );
    7271                virtual void visit( RangeExpr *rangeExpr );
    7372                virtual void visit( UntypedTupleExpr *tupleExpr );
  • src/SynTree/Expression.cc

    r4551a6e raf5c204  
    588588}
    589589
    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 
    600590RangeExpr::RangeExpr( Expression *low, Expression *high ) : low( low ), high( high ) {}
    601591RangeExpr::RangeExpr( const RangeExpr &other ) : Expression( other ), low( other.low->clone() ), high( other.high->clone() ) {}
  • src/SynTree/Expression.h

    r4551a6e raf5c204  
    600600};
    601601
    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 
    620602/// RangeExpr represents a range e.g. '3 ... 5' or '1~10'
    621603class RangeExpr : public Expression {
  • src/SynTree/Mutator.cc

    r4551a6e raf5c204  
    380380}
    381381
    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 
    388382Expression *Mutator::mutate( RangeExpr *rangeExpr ) {
    389383        rangeExpr->set_env( maybeMutate( rangeExpr->get_env(), *this ) );
  • src/SynTree/Mutator.h

    r4551a6e raf5c204  
    7878        virtual Expression* mutate( ConstructorExpr *ctorExpr );
    7979        virtual Expression* mutate( CompoundLiteralExpr *compLitExpr );
    80         virtual Expression* mutate( UntypedValofExpr *valofExpr );
    8180        virtual Expression* mutate( RangeExpr *rangeExpr );
    8281        virtual Expression* mutate( UntypedTupleExpr *tupleExpr );
  • src/SynTree/Visitor.cc

    r4551a6e raf5c204  
    301301}
    302302
    303 void Visitor::visit( UntypedValofExpr *valofExpr ) {
    304         maybeAccept( valofExpr->get_result(), *this );
    305         maybeAccept( valofExpr->get_body(), *this );
    306 }
    307 
    308303void Visitor::visit( RangeExpr *rangeExpr ) {
    309304        maybeAccept( rangeExpr->get_low(), *this );
  • src/SynTree/Visitor.h

    r4551a6e raf5c204  
    8181        virtual void visit( ConstructorExpr * ctorExpr );
    8282        virtual void visit( CompoundLiteralExpr *compLitExpr );
    83         virtual void visit( UntypedValofExpr *valofExpr );
    8483        virtual void visit( RangeExpr *rangeExpr );
    8584        virtual void visit( UntypedTupleExpr *tupleExpr );
     
    163162                        } // if
    164163                } catch( SemanticError &e ) {
    165                         e.set_location( (*i)->location );                       
     164                        e.set_location( (*i)->location );
    166165                        errors.append( e );
    167166                } // try
Note: See TracChangeset for help on using the changeset viewer.