aboutsummaryrefslogtreecommitdiff
path: root/lib/Parser/ParserExpression.cc
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-22 03:42:49 +0000
committer_ov4 <ov4@ov4.org>2026-10-22 04:05:50 +0000
commitd603a3bab5ee07e3fe8665a7dce8c80cb391ca08 (patch)
tree43d55d6f029959aafdf4700cb6c21c47a441b5da /lib/Parser/ParserExpression.cc
parent0b87ded993d59450ab70ade6e4ce154da65948a3 (diff)
refactor(parser): share callee-name parsing and make operator out-param optional
ParseOperatorName() takes an optional int * so callers that ignore the operator token no longer declare a dummy. The identical identifier-or- OPERATOR prologues of assignment, identifier-expression and CALL parsing move into ParseCalleeName(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'lib/Parser/ParserExpression.cc')
-rw-r--r--lib/Parser/ParserExpression.cc15
1 files changed, 3 insertions, 12 deletions
diff --git a/lib/Parser/ParserExpression.cc b/lib/Parser/ParserExpression.cc
index 25752b8..6ed3f1c 100644
--- a/lib/Parser/ParserExpression.cc
+++ b/lib/Parser/ParserExpression.cc
@@ -74,14 +74,7 @@ bool Parser::isTemplateCall() {
std::unique_ptr<ExprAST> Parser::ParseIdentifierExpr() {
int Line = Lex.getLine();
std::string IdName;
- if (CurTok == tok_operator) {
- int Op;
- IdName = ParseOperatorName(Op);
- if (IdName.empty()) return nullptr;
- } else {
- IdName = Lex.IdentifierStr;
- getNextToken();
- }
+ if (!ParseCalleeName(IdName)) return nullptr;
if (PackNames.count(IdName)) {
if (CurTok != tok_ellipsis) {
@@ -173,8 +166,7 @@ bool Parser::ParseDesignatorSuffix(std::vector<DesignatorAccess> &Out) {
DesignatorAccess A;
A.Kind = AccessKind::Field;
if (CurTok == tok_operator) {
- int Op;
- A.FieldName = ParseOperatorName(Op);
+ A.FieldName = ParseOperatorName();
if (A.FieldName.empty()) return false;
} else {
A.FieldName = CurTok == tok_new ? "NEW" : CurTok == tok_delete ? "DELETE" : Lex.IdentifierStr;
@@ -227,8 +219,7 @@ std::unique_ptr<ExprAST> Parser::ParseResultMethods(std::unique_ptr<ExprAST> Exp
getNextToken();
std::string Name;
if (CurTok == tok_operator) {
- int Op;
- Name = ParseOperatorName(Op);
+ Name = ParseOperatorName();
if (Name.empty()) return nullptr;
} else if (CurTok == tok_identifier || CurTok == tok_delete) {
Name = CurTok == tok_delete ? "DELETE" : Lex.IdentifierStr;