ReturnStatement(1)
This commit is contained in:
17
inc/AST/ReturnStatement.h
Normal file
17
inc/AST/ReturnStatement.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef RETURNSTATEMENT_H
|
||||
#define RETURNSTATEMENT_H
|
||||
|
||||
#include "AST/Statement.h"
|
||||
#include "AST/Expression.h"
|
||||
|
||||
class ReturnStatement : public Statement {
|
||||
public:
|
||||
ReturnStatement(Expression* expr);
|
||||
virtual ~ReturnStatement();
|
||||
virtual void accept(ASTVisitor *visitor);
|
||||
Expression* getExpr();
|
||||
private:
|
||||
Expression* expr_;
|
||||
};
|
||||
|
||||
#endif // RETURNSTATEMENT_H
|
||||
18
src/AST/ReturnStatement.cpp
Normal file
18
src/AST/ReturnStatement.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "AST/ReturnStatement.h"
|
||||
#include "AST/ASTVisitor.h"
|
||||
|
||||
ReturnStatement::ReturnStatement(Expression* expr): expr_(expr) {
|
||||
//
|
||||
}
|
||||
|
||||
ReturnStatement::~ReturnStatement() {
|
||||
//
|
||||
}
|
||||
|
||||
void ReturnStatement::accept(ASTVisitor* visitor) {
|
||||
visitor->visit(this);
|
||||
}
|
||||
|
||||
Expression* ReturnStatement::getExpr() {
|
||||
return expr_;
|
||||
}
|
||||
Reference in New Issue
Block a user