Skip to content
Snippets Groups Projects
StatementList.h 880 B
Newer Older
  • Learn to ignore specific revisions
  • #ifndef _CLI_STATEMENT_LIST_H_
    #define _CLI_STATEMENT_LIST_H_
    
    #include <ast/Statement.h>
    
    namespace cli {
    
    class StatementList : public Statement {
    	std::shared_ptr < Statement > m_statement;
    	std::shared_ptr < StatementList > m_next;
    
    public:
    	StatementList ( std::shared_ptr < Statement > statement, std::shared_ptr < StatementList > next ) : m_statement ( statement ), m_next ( next ) {
    	}
    
    
    	virtual std::shared_ptr < abstraction::OperationAbstraction > translateAndEval ( const std::shared_ptr < abstraction::OperationAbstraction > & prev, Environment & environment ) const override {
    		std::shared_ptr < abstraction::OperationAbstraction > next = m_statement->translateAndEval ( prev, environment );
    
    		if ( m_next != nullptr )
    
    			return m_next->translateAndEval ( next, environment );
    
    		else
    			return next;
    	}
    };
    
    } /* namespace cli */
    
    #endif /* _CLI_STATEMENT_LIST_H_ */