diff options
| author | Yong He <yonghe@outlook.com> | 2025-06-13 22:13:00 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-13 22:13:00 -0700 |
| commit | 6a23949f07f4eba38086b656e7073ce3bf8cd2fe (patch) | |
| tree | 132bbe330b6027d323c74175686d006605e4da6d /source/slang/slang-syntax.h | |
| parent | e72b3325663ab6d4bb791742574b031f0df6328a (diff) | |
Allow interface methods to have default implementations. (#7439)
Diffstat (limited to 'source/slang/slang-syntax.h')
| -rw-r--r-- | source/slang/slang-syntax.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/slang/slang-syntax.h b/source/slang/slang-syntax.h index 1b5fc005d..e7a82592c 100644 --- a/source/slang/slang-syntax.h +++ b/source/slang/slang-syntax.h @@ -284,6 +284,14 @@ inline Decl* getInner(DeclRef<GenericDecl> declRef) return declRef.getDecl()->inner; } +inline Decl* maybeGetInner(Decl* decl) +{ + if (auto genericDeclRef = as<GenericDecl>(decl)) + { + return genericDeclRef->inner; + } + return decl; +} // inline Type* getType(ASTBuilder* astBuilder, SubstExpr<Expr> expr) @@ -393,6 +401,8 @@ AggTypeDecl* getParentAggTypeDecl(Decl* decl); AggTypeDeclBase* getParentAggTypeDeclBase(Decl* decl); FunctionDeclBase* getParentFunc(Decl* decl); +/// Get the parent declref, skipping any generic decls in between. +DeclRef<Decl> getParentDeclRef(DeclRef<Decl> declRef); } // namespace Slang #endif |
