Lines Matching full:scope
1 //===-- lib/Semantics/scope.cpp -------------------------------------------===//
9 #include "flang/Semantics/scope.h"
19 Symbols<1024> Scope::allSymbols;
52 Scope &Scope::MakeScope(Kind kind, Symbol *symbol) { in MakeScope()
68 MutableSymbolVector Scope::GetSymbols() { in GetSymbols()
71 SymbolVector Scope::GetSymbols() const { in GetSymbols()
75 Scope::iterator Scope::find(const SourceName &name) { in find()
78 Scope::size_type Scope::erase(const SourceName &name) { in erase()
87 Symbol *Scope::FindSymbol(const SourceName &name) const { in FindSymbol()
98 Symbol *Scope::FindComponent(SourceName name) const { in FindComponent()
103 } else if (const Scope * parent{GetDerivedTypeParent()}) { in FindComponent()
110 bool Scope::Contains(const Scope &that) const { in Contains()
111 for (const Scope *scope{&that};; scope = &scope->parent()) { in Contains() local
112 if (*scope == *this) { in Contains()
115 if (scope->IsGlobal()) { in Contains()
121 Symbol *Scope::CopySymbol(const Symbol &symbol) { in CopySymbol()
133 void Scope::add_equivalenceSet(EquivalenceSet &&set) { in add_equivalenceSet()
137 void Scope::add_crayPointer(const SourceName &name, Symbol &pointer) { in add_crayPointer()
142 Symbol &Scope::MakeCommonBlock(const SourceName &name) { in MakeCommonBlock()
152 Symbol *Scope::FindCommonBlock(const SourceName &name) { in FindCommonBlock()
157 Scope *Scope::FindSubmodule(const SourceName &name) const { in FindSubmodule()
165 bool Scope::AddSubmodule(const SourceName &name, Scope &submodule) { in AddSubmodule()
169 const DeclTypeSpec *Scope::FindType(const DeclTypeSpec &type) const { in FindType()
174 const DeclTypeSpec &Scope::MakeNumericType( in MakeNumericType()
178 const DeclTypeSpec &Scope::MakeLogicalType(KindExpr &&kind) { in MakeLogicalType()
181 const DeclTypeSpec &Scope::MakeTypeStarType() { in MakeTypeStarType()
184 const DeclTypeSpec &Scope::MakeClassStarType() { in MakeClassStarType()
188 // compare length expressions. They are stored in the global scope.
189 const DeclTypeSpec &Scope::MakeLengthlessType(DeclTypeSpec &&type) { in MakeLengthlessType()
194 const DeclTypeSpec &Scope::MakeCharacterType( in MakeCharacterType()
200 DeclTypeSpec &Scope::MakeDerivedType( in MakeDerivedType()
205 Scope::ImportKind Scope::GetImportKind() const { in GetImportKind()
219 std::optional<parser::MessageFixedText> Scope::SetImportKind(ImportKind kind) { in SetImportKind()
229 ? "IMPORT,NONE must be the only IMPORT statement in a scope"_err_en_US in SetImportKind()
230 : "IMPORT,ALL must be the only IMPORT statement in a scope"_err_en_US; in SetImportKind()
239 void Scope::add_importName(const SourceName &name) { in add_importName()
243 // true if name can be imported or host-associated from parent scope.
244 bool Scope::CanImport(const SourceName &name) const { in CanImport()
260 const Scope *Scope::FindScope(parser::CharBlock source) const { in FindScope()
261 return const_cast<Scope *>(this)->FindScope(source); in FindScope()
264 Scope *Scope::FindScope(parser::CharBlock source) { in FindScope()
270 if (auto *scope{child.FindScope(source)}) { in FindScope() local
271 return scope; in FindScope()
277 void Scope::AddSourceRange(const parser::CharBlock &source) { in AddSourceRange()
278 for (auto *scope = this; !scope->IsGlobal(); scope = &scope->parent()) { in AddSourceRange() local
279 scope->sourceRange_.ExtendToCover(source); in AddSourceRange()
283 llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Scope &scope) { in operator <<() argument
284 os << Scope::EnumToString(scope.kind()) << " scope: "; in operator <<()
285 if (auto *symbol{scope.symbol()}) { in operator <<()
288 if (scope.derivedTypeSpec_) { in operator <<()
289 os << "instantiation of " << *scope.derivedTypeSpec_ << ' '; in operator <<()
291 os << scope.children_.size() << " children\n"; in operator <<()
292 for (const auto &pair : scope.symbols_) { in operator <<()
296 if (!scope.equivalenceSets_.empty()) { in operator <<()
298 for (const auto &set : scope.equivalenceSets_) { in operator <<()
306 for (const auto &pair : scope.commonBlocks_) { in operator <<()
313 bool Scope::IsStmtFunction() const { in IsStmtFunction()
317 bool Scope::IsParameterizedDerivedType() const { in IsParameterizedDerivedType()
321 if (const Scope * parent{GetDerivedTypeParent()}) { in IsParameterizedDerivedType()
334 const DeclTypeSpec *Scope::FindInstantiatedDerivedType( in FindInstantiatedDerivedType()
346 const Scope *Scope::GetDerivedTypeParent() const { in GetDerivedTypeParent()
349 return parent->scope(); in GetDerivedTypeParent()
355 const Scope &Scope::GetDerivedTypeBase() const { in GetDerivedTypeBase()
356 const Scope *child{this}; in GetDerivedTypeBase()
357 for (const Scope *parent{GetDerivedTypeParent()}; parent != nullptr; in GetDerivedTypeBase()
364 void Scope::InstantiateDerivedTypes(SemanticsContext &context) { in InstantiateDerivedTypes()