Implements statblock for functions.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-11-08 15:52:44 +01:00
parent bfb47d9b5f
commit 09023d6337
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 6 additions and 3 deletions

View File

@ -222,8 +222,11 @@ namespace MalachScript::Parser {
ParseFuncAttr(funcAttr, current);
const ParsedStatement* statblock = nullptr;
if (current->GetKind() != LexTokenKind::SemicolonSymbol) {
// TODO: Parse stat block.
throw std::logic_error("not implemented");
if (!ParseStatBlock(statblock, current)) {
LogError(Diagnostics::DiagnosticType::UnexpectedToken, current->GetSpan());
}
} else {
PROGRESS_TOKEN(current);
}
out = new ParsedFuncStatement(TextSpan(start, current->GetSpan().GetEnd()), isShared, isExternal,
accessModifier, typeStatement, returnsReference, identifier, paramList, isConst,

View File

@ -130,7 +130,7 @@ PARSER_TEST(
REQUIRE(virtPropStatement->GetSetStatement() == nullptr);
})
/// Parse class foobar {
/// class foobar {
// int i;
// bool foo {
// get {