From 56e97d0ddd3fff2bee160bae04e8f659671f398d Mon Sep 17 00:00:00 2001 From: _ov4 Date: Thu, 22 Oct 2026 03:55:22 +0000 Subject: refactor(parser): share the designator degrade rule for INPUT and expressions INPUT targets and identifier expressions now build their legacy VariableExprAST/ArrayAccessExprAST/DesignatorExprAST node through makeDesignator(). INPUT still sets the target line explicitly. Co-Authored-By: Claude Opus 5.5 --- lib/Parser/Parser.cc | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'lib/Parser/Parser.cc') diff --git a/lib/Parser/Parser.cc b/lib/Parser/Parser.cc index 37fe8ec..d17856b 100644 --- a/lib/Parser/Parser.cc +++ b/lib/Parser/Parser.cc @@ -271,13 +271,7 @@ std::unique_ptr Parser::ParseInputStmt() { getNextToken(); std::vector Accesses; if (!ParseDesignatorSuffix(Accesses)) return nullptr; - std::unique_ptr Target; - if (Accesses.empty()) - Target = std::make_unique(Name); - else if (Accesses.size() == 1 && Accesses[0].Kind == AccessKind::Index) - Target = std::make_unique(Name, std::move(Accesses[0].Indices), Line); - else - Target = std::make_unique(Name, std::move(Accesses), Line); + auto Target = makeDesignator(Name, std::move(Accesses), Line); Target->setLine(Line); return std::make_unique(std::move(Target)); } -- cgit v1.3.1-4-g156e