Hey you all,
Me again, this time I have problem to check when a derived type is being defined.
I would like to check when inside BlockData if a symbol is a derived type being defined.
The function CheckDerivedTypeDefinition should check if a new declaration type is being defined.
void ResolveNamesVisitor::CheckDerivedTypeDefinition() {
for (auto &pair : currScope()) {
auto &symbol{*pair.second};
if (currScope().kind() == Scope::Kind::BlockData){
if (symbol.has() || GetDeclTypeSpec()){
Say(symbol.name(),
“’%s’ is declaration type definition”_err_en_US);
}
}
}
}
I image these ones only check if the type is a derived type or if it has a type defined
currScope().IsDerivedType() || symbol.GetType()
but not a derived type declaration
I can see there is a method:
void ConstructVisitor::Post(const parser::TypeGuardStmt::Guard &x)
Is this one checking when a derived type is being defined?
I believe this is allowed inside BlockData:
block data bdderivedtype
type mytype
integer:: i
end type mytype
type (mytype) var
end block data
PS.: I’ve created the Scope::Kind::BlockData, as it was not defined yet and I needed to make the semantic checks.
Thank you,
Carol