Implements return statement
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -15,7 +15,8 @@ enum class ParsedStatementKind{
|
||||
Block,
|
||||
Expression,
|
||||
Assignment,
|
||||
FunctionDeclaration
|
||||
FunctionDeclaration,
|
||||
Return
|
||||
};
|
||||
|
||||
class ParsedStatement {
|
||||
@@ -166,4 +167,24 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class ParsedReturnStatement : public ParsedStatement{
|
||||
ParsedExpression* _expression;
|
||||
public:
|
||||
ParsedReturnStatement(ParsedExpression* expression, unsigned int start, unsigned int length) : ParsedStatement(start, length){
|
||||
_expression = expression;
|
||||
}
|
||||
|
||||
~ParsedReturnStatement() final{
|
||||
delete _expression;
|
||||
}
|
||||
|
||||
ParsedStatementKind GetKind() final{
|
||||
return ParsedStatementKind ::Return;
|
||||
}
|
||||
|
||||
ParsedExpression* GetExpression(){
|
||||
return _expression;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //PORYGONLANG_PARSEDSTATEMENT_HPP
|
||||
|
||||
Reference in New Issue
Block a user