summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-syntax.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-syntax.cpp')
-rw-r--r--source/slang/slang-syntax.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/source/slang/slang-syntax.cpp b/source/slang/slang-syntax.cpp
index e45311abc..55ed224cb 100644
--- a/source/slang/slang-syntax.cpp
+++ b/source/slang/slang-syntax.cpp
@@ -1093,44 +1093,44 @@ ModuleDecl* getModuleDecl(Scope* scope)
return nullptr;
}
-Decl* getParentDecl(Decl* decl)
+ContainerDecl* getParentDecl(Decl* decl)
{
- decl = decl->parentDecl;
- while (as<GenericDecl>(decl))
- decl = decl->parentDecl;
- return decl;
+ auto parentDecl = decl->parentDecl;
+ while (auto genericDecl = as<GenericDecl>(parentDecl))
+ parentDecl = genericDecl->parentDecl;
+ return parentDecl;
}
-Decl* getParentAggTypeDecl(Decl* decl)
+AggTypeDecl* getParentAggTypeDecl(Decl* decl)
{
decl = decl->parentDecl;
while (decl)
{
- if (as<AggTypeDecl>(decl))
- return decl;
+ if (auto found = as<AggTypeDecl>(decl))
+ return found;
decl = decl->parentDecl;
}
return nullptr;
}
-Decl* getParentAggTypeDeclBase(Decl* decl)
+AggTypeDeclBase* getParentAggTypeDeclBase(Decl* decl)
{
decl = decl->parentDecl;
while (decl)
{
- if (as<AggTypeDeclBase>(decl))
- return decl;
+ if (auto found = as<AggTypeDeclBase>(decl))
+ return found;
decl = decl->parentDecl;
}
return nullptr;
}
-Decl* getParentFunc(Decl* decl)
+FunctionDeclBase* getParentFunc(Decl* decl)
{
while (decl)
{
- if (as<FunctionDeclBase>(decl))
- return decl;
+ if (auto found = as<FunctionDeclBase>(decl))
+ return found;
decl = decl->parentDecl;
}
return nullptr;