Lots more tests for function statements, fixes several bugs.

This commit is contained in:
2020-10-10 16:04:59 +02:00
parent dcf143b1b2
commit f5baed48a9
3 changed files with 118 additions and 12 deletions

View File

@@ -106,7 +106,7 @@ namespace MalachScript::Parser {
class ParsedParameter {
private:
const ParsedTypeStatement* _typeStatement = nullptr;
TypeMod _typeMod;
TypeMod _typeMod = TypeMod::None;
Identifier _identifier;
const ParsedExpression* _defaultExpression = nullptr;
@@ -132,6 +132,8 @@ namespace MalachScript::Parser {
public:
ParsedParamListStatement(TextSpan span, std::vector<ParsedParameter> parameters)
: ParsedStatementImpl<ParsedStatementKind::ParamList>(span), _parameters(std::move(parameters)){};
[[nodiscard]] const std::vector<ParsedParameter>& GetParameters() const noexcept { return _parameters; }
};
class ParsedFuncStatement : public ParsedStatementImpl<ParsedStatementKind::Func> {