From b17f101cfc75565f9991c856ec62f1e17b0ab104 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sun, 18 Oct 2026 06:09:01 +0000 Subject: feat(operators): add member and unary overloads with explicit calls Select member and global candidates together, enforce private access, and reuse argument marshalling. Materialize temporary receivers for chaining and register them for the existing object cleanup mechanism. Co-Authored-By: Claude Opus 5.5 --- lib/Parser/Parser.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'lib/Parser/Parser.cc') diff --git a/lib/Parser/Parser.cc b/lib/Parser/Parser.cc index f22e3c6..afe0e80 100644 --- a/lib/Parser/Parser.cc +++ b/lib/Parser/Parser.cc @@ -48,7 +48,7 @@ void Parser::syncToStatementStart() { switch (CurTok) { case tok_include: case tok_global: case tok_endglobal: case tok_include_obj: case tok_extern: - case tok_delete: case tok_constant: case tok_declare: case tok_identifier: case tok_input: case tok_output: + case tok_delete: case tok_constant: case tok_declare: case tok_identifier: case tok_operator: case tok_input: case tok_output: case tok_case: case tok_endcase: case tok_otherwise: case tok_if: case tok_while: case tok_repeat: case tok_for: case tok_overload: case tok_function: case tok_procedure: case tok_call: case tok_return: @@ -163,7 +163,7 @@ std::unique_ptr Parser::ParseStatementImpl() { if (CurTok == tok_declare) { return ParseDeclare(); } - else if (CurTok == tok_identifier) { + else if (CurTok == tok_identifier || CurTok == tok_operator) { return ParseAssignStmt(); } else if (CurTok == tok_input) { @@ -284,9 +284,16 @@ std::unique_ptr Parser::ParseStatementImpl() { // Bare-name and single-index targets degrade to their legacy nodes so the // existing assignment code paths stay untouched. std::unique_ptr Parser::ParseAssignStmt() { - std::string Name = Lex.IdentifierStr; int Line = Lex.getLine(); - getNextToken(); + std::string Name; + if (CurTok == tok_operator) { + int Op; + Name = ParseOperatorName(Op); + if (Name.empty()) return nullptr; + } else { + Name = Lex.IdentifierStr; + getNextToken(); + } if (CurTok == '(') { getNextToken(); -- cgit v1.3.1-4-g156e