bool Pre(const parser::BindStmt &) { return BeginAttrs(); }
void Post(const parser::BindStmt &) { EndAttrs(); }
bool Pre(const parser::BindEntity &);
- void Post(const parser::NamedConstantDef &);
+ bool Pre(const parser::NamedConstantDef &);
+ bool Pre(const parser::NamedConstant &);
bool Pre(const parser::AsynchronousStmt &);
bool Pre(const parser::ContiguousStmt &);
bool Pre(const parser::ExternalStmt &);
bool Pre(const parser::AcSpec &);
bool Pre(const parser::AcImpliedDo &);
bool Pre(const parser::DataImpliedDo &);
- bool Pre(const parser::DataStmtSet &);
- void Post(const parser::DataStmtSet &);
+ bool Pre(const parser::DataStmtObject &);
bool Pre(const parser::DoConstruct &);
void Post(const parser::DoConstruct &);
void Post(const parser::ConcurrentControl &);
}
return false;
}
-void DeclarationVisitor::Post(const parser::NamedConstantDef &x) {
+bool DeclarationVisitor::Pre(const parser::NamedConstantDef &x) {
auto &name{std::get<parser::NamedConstant>(x.t).v};
auto &symbol{HandleAttributeStmt(Attr::PARAMETER, name)};
if (!ConvertToObjectEntity(symbol)) {
SayWithDecl(
name, symbol, "PARAMETER attribute not allowed on '%s'"_err_en_US);
- return;
+ return false;
}
const auto &expr{std::get<parser::ConstantExpr>(x.t)};
+ Walk(expr);
symbol.get<ObjectEntityDetails>().set_init(EvaluateExpr(expr));
ApplyImplicitRules(symbol);
+ return false;
+}
+bool DeclarationVisitor::Pre(const parser::NamedConstant &x) {
+ const parser::Name &name{x.v};
+ if (!FindSymbol(name)) {
+ Say(name, "Named constant '%s' not found"_err_en_US);
+ } else {
+ CheckUseError(name);
+ }
+ return false;
}
bool DeclarationVisitor::Pre(const parser::AsynchronousStmt &x) {
return HandleAttributeStmt(Attr::ASYNCHRONOUS, x.v);
return false;
}
-bool ConstructVisitor::Pre(const parser::DataStmtSet &) {
- PushScope(Scope::Kind::ImpliedDos, nullptr);
- return true;
+bool ConstructVisitor::Pre(const parser::DataStmtObject &x) {
+ std::visit(
+ common::visitors{
+ [&](const common::Indirection<parser::Variable> &y) { Walk(*y); },
+ [&](const parser::DataImpliedDo &y) {
+ PushScope(Scope::Kind::ImpliedDos, nullptr);
+ Walk(y);
+ PopScope();
+ },
+ },
+ x.u);
+ return false;
}
-void ConstructVisitor::Post(const parser::DataStmtSet &) { PopScope(); }
bool ConstructVisitor::Pre(const parser::DoConstruct &x) {
if (x.IsDoConcurrent()) {
a(i) = j+1
end do
end subroutine
+
+!DEF: /s7 Subprogram
+subroutine s7
+ !DEF: /s7/one PARAMETER ObjectEntity REAL(4)
+ real, parameter :: one = 1.0
+ !DEF: /s7/z ObjectEntity COMPLEX(4)
+ !REF: /s7/one
+ complex :: z = (one, -one)
+end subroutine
+
+!DEF: /s8 Subprogram
+subroutine s8
+ !DEF: /s8/one PARAMETER ObjectEntity REAL(4)
+ real, parameter :: one = 1.0
+ !DEF: /s8/y ObjectEntity REAL(4)
+ !DEF: /s8/z ObjectEntity REAL(4)
+ real y(10), z(10)
+ !REF: /s8/y
+ !DEF: /s8/ImpliedDos1/i (implicit) ObjectEntity INTEGER(4)
+ !REF: /s8/z
+ !DEF: /s8/ImpliedDos2/i (implicit) ObjectEntity INTEGER(4)
+ !DEF: /s8/x (implicit) ObjectEntity REAL(4)
+ !REF: /s8/one
+ data (y(i),i=1,10),(z(i),i=1,10),x/21*one/
+end subroutine