diff options
| author | Yong He <yonghe@outlook.com> | 2023-07-07 14:26:37 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-07 14:26:37 -0700 |
| commit | 643aaa13d2c6e0c4994437aa9fba6716787608ce (patch) | |
| tree | 279794cfafecc89f0be133d2a81750d59d9ee94a /source/slang/slang-check-shader.cpp | |
| parent | fb6605c2a7bc17d3b3b79dabd07e1f05267eb33a (diff) | |
Make DeclRefBase a Val, and DeclRef<T> a helper class. (#2967)
* Make DeclRefBase a Val, and DeclRef<T> a helper class.
* Fixes.
* Workaround gcc parser issue.
* Revert NodeOperand change.
* Fix.
* Fix clang incomplete class complains.
* Fix code review.
* Small cleanups and improvements.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-check-shader.cpp')
| -rw-r--r-- | source/slang/slang-check-shader.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/source/slang/slang-check-shader.cpp b/source/slang/slang-check-shader.cpp index acefa7660..69e419f75 100644 --- a/source/slang/slang-check-shader.cpp +++ b/source/slang/slang-check-shader.cpp @@ -583,7 +583,7 @@ namespace Slang return varDecl->getName(); } - Type* getParamType(ASTBuilder* astBuilder, DeclRef<VarDeclBase> const& paramDeclRef) + Type* getParamType(ASTBuilder* astBuilder, DeclRef<VarDeclBase> paramDeclRef) { auto paramType = getType(astBuilder, paramDeclRef); if (paramDeclRef.getDecl()->findModifier<NoDiffModifier>()) @@ -1207,17 +1207,15 @@ namespace Slang getLinkage()->getASTBuilder()->getOrCreateGenericSubstitution( genericDeclRef.getDecl(), genericArgs, - genericDeclRef.substitutions.substitutions); + genericDeclRef.getSubst()); + ASTBuilder* astBuilder = getLinkage()->getASTBuilder(); - for( auto constraintDecl : genericDeclRef.getDecl()->getMembersOfType<GenericTypeConstraintDecl>() ) + for (auto constraintDecl : getMembersOfType<GenericTypeConstraintDecl>( + getLinkage()->getASTBuilder(), DeclRef<ContainerDecl>(genericDeclRef))) { - auto constraintSubst = genericDeclRef.substitutions; - constraintSubst.substitutions = genericSubst; + DeclRef<GenericTypeConstraintDecl> constraintDeclRef = astBuilder->getSpecializedDeclRef( + constraintDecl.getDecl(), genericSubst); - DeclRef<GenericTypeConstraintDecl> constraintDeclRef = getLinkage()->getASTBuilder()->getSpecializedDeclRef( - constraintDecl, constraintSubst); - - ASTBuilder* astBuilder = getLinkage()->getASTBuilder(); auto sub = getSub(astBuilder, constraintDeclRef); auto sup = getSup(astBuilder, constraintDeclRef); @@ -1239,8 +1237,8 @@ namespace Slang getLinkage()->getASTBuilder()->getOrCreateGenericSubstitution( genericDeclRef.getDecl(), genericArgs, - genericDeclRef.substitutions.substitutions); - specializedFuncDeclRef.substitutions.substitutions = genericSubst; + genericDeclRef.getSubst()); + specializedFuncDeclRef = astBuilder->getSpecializedDeclRef(specializedFuncDeclRef.getDecl(), genericSubst); } info->specializedFuncDeclRef = specializedFuncDeclRef; |
