Merge branch 'master' of git.tuxzone.org:woc2013
Conflicts: inc/AST/ASTVisitor.h
This commit is contained in:
@@ -73,6 +73,7 @@ SET(SCULLY_SOURCE
|
||||
src/AST/StatementList.cpp
|
||||
src/AST/ValueList.cpp
|
||||
src/AST/IfStatement.cpp
|
||||
src/AST/ReturnStatement.cpp
|
||||
|
||||
${CMAKE_CURRENT_BINARY_DIR}/grammar.cpp
|
||||
)
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include "ValueList.h"
|
||||
#include "VariableDefinition.h"
|
||||
#include "ExpressionStatement.h"
|
||||
#include "ReturnStatement.h"
|
||||
|
||||
|
||||
class ASTVisitor {
|
||||
public:
|
||||
@@ -27,6 +29,7 @@ public:
|
||||
virtual void visit(StatementList* e) = 0;
|
||||
virtual void visit(ValueList* e) = 0;
|
||||
virtual void visit(VariableDefinition* e) = 0;
|
||||
virtual void visit(ReturnStatement* e) = 0;
|
||||
};
|
||||
|
||||
#endif // ASTVISITOR_H
|
||||
|
||||
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