aboutsummaryrefslogtreecommitdiff
path: root/lib/Parser/Parser.cc
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-22 03:55:22 +0000
committer_ov4 <ov4@ov4.org>2026-10-22 04:05:50 +0000
commit56e97d0ddd3fff2bee160bae04e8f659671f398d (patch)
treec12bee619f88d8be306117913a4e8e349c2d7797 /lib/Parser/Parser.cc
parentcad64c865ae517a1d2925544e5f99ec3c414690b (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'lib/Parser/Parser.cc')
-rw-r--r--lib/Parser/Parser.cc8
1 files changed, 1 insertions, 7 deletions
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<StmtAST> Parser::ParseInputStmt() {
getNextToken();
std::vector<DesignatorAccess> Accesses;
if (!ParseDesignatorSuffix(Accesses)) return nullptr;
- std::unique_ptr<ExprAST> Target;
- if (Accesses.empty())
- Target = std::make_unique<VariableExprAST>(Name);
- else if (Accesses.size() == 1 && Accesses[0].Kind == AccessKind::Index)
- Target = std::make_unique<ArrayAccessExprAST>(Name, std::move(Accesses[0].Indices), Line);
- else
- Target = std::make_unique<DesignatorExprAST>(Name, std::move(Accesses), Line);
+ auto Target = makeDesignator(Name, std::move(Accesses), Line);
Target->setLine(Line);
return std::make_unique<InputStmtAST>(std::move(Target));
}