From e93cb8a4d1bb7d835bc3762ce25ced422e75e97a Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 20 Dec 2024 00:53:49 -0800 Subject: Check subscript/property accessor for differentiability. (#5922) --- source/slang/slang-syntax.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'source/slang/slang-syntax.cpp') diff --git a/source/slang/slang-syntax.cpp b/source/slang/slang-syntax.cpp index 9e448a5fa..1d3763299 100644 --- a/source/slang/slang-syntax.cpp +++ b/source/slang/slang-syntax.cpp @@ -851,7 +851,7 @@ FuncType* getFuncType(ASTBuilder* astBuilder, DeclRef const& declR List paramTypes; auto resultType = getResultType(astBuilder, declRef); auto errorType = getErrorCodeType(astBuilder, declRef); - for (auto paramDeclRef : getParameters(astBuilder, declRef)) + auto visitParamDecl = [&](DeclRef paramDeclRef) { auto paramDecl = paramDeclRef.getDecl(); auto paramType = getParamType(astBuilder, paramDeclRef); @@ -875,6 +875,18 @@ FuncType* getFuncType(ASTBuilder* astBuilder, DeclRef const& declR } } paramTypes.add(paramType); + }; + auto parent = declRef.getParent(); + if (as(parent) || as(parent)) + { + for (auto paramDeclRef : getParameters(astBuilder, parent.as())) + { + visitParamDecl(paramDeclRef); + } + } + for (auto paramDeclRef : getParameters(astBuilder, declRef)) + { + visitParamDecl(paramDeclRef); } FuncType* funcType = -- cgit v1.2.3