aboutsummaryrefslogtreecommitdiff
path: root/lib/Parser
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Parser')
-rw-r--r--lib/Parser/ParserFunction.cc1
-rw-r--r--lib/Parser/ParserType.cc4
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/Parser/ParserFunction.cc b/lib/Parser/ParserFunction.cc
index 1aef756..ad187c8 100644
--- a/lib/Parser/ParserFunction.cc
+++ b/lib/Parser/ParserFunction.cc
@@ -51,6 +51,7 @@ std::optional<std::vector<ParamDecl>> Parser::ParsePrototypeArgs(bool AllowByRef
return std::nullopt;
}
ParamDecl P;
+ P.Line = Lex.getLine();
P.Name = Lex.IdentifierStr;
P.Mode = Current;
getNextToken();
diff --git a/lib/Parser/ParserType.cc b/lib/Parser/ParserType.cc
index 0d664d0..dab71a1 100644
--- a/lib/Parser/ParserType.cc
+++ b/lib/Parser/ParserType.cc
@@ -124,7 +124,9 @@ std::optional<std::vector<RecordFieldDecl>> Parser::ParseRecordBody(
if (AtField()) {
// Class fields default to public, like record fields.
bool IsPublic = CurTok != tok_private;
- if (IsClass && (CurTok == tok_public || CurTok == tok_private)) getNextToken();
+ if (IsClass && (CurTok == tok_public || CurTok == tok_private) &&
+ (Lex.peekToken() == tok_function || Lex.peekToken() == tok_procedure))
+ getNextToken();
if (IsClass && (CurTok == tok_function || CurTok == tok_procedure)) {
auto Method = CurTok == tok_function ? ParseFunction(Name, IsPublic)
: ParseProcedure(Name, IsPublic);