diff options
| author | Yong He <yonghe@outlook.com> | 2025-05-16 10:42:11 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-16 10:42:11 -0700 |
| commit | 9dfd5244ad2953753535e82acd05e72e5ab2bc5f (patch) | |
| tree | 0f7c8a0bf4ea3dd25348e1d1ac8e5bfcfd8c9724 /source/slang/slang-check-impl.h | |
| parent | 1fd7b2296d8360c245a0c732e7f842876533f92a (diff) | |
Allow lambda exprs without captures to coerce to `functype`. (#7129)
Diffstat (limited to 'source/slang/slang-check-impl.h')
| -rw-r--r-- | source/slang/slang-check-impl.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/slang/slang-check-impl.h b/source/slang/slang-check-impl.h index f0884503f..87f2df53d 100644 --- a/source/slang/slang-check-impl.h +++ b/source/slang/slang-check-impl.h @@ -1451,6 +1451,15 @@ public: /// void ensureDeclBase(DeclBase* decl, DeclCheckState state, SemanticsContext* baseContext); + // Check if `lambdaStruct` can be coerced to `funcType`, if so returns the coerced + // expression in `outExpr`. The coercion is only valid if the lambda struct + // does not contain any captures. + bool tryCoerceLambdaToFuncType( + DeclRef<StructDecl> lambdaStruct, + FuncType* funcType, + Expr* fromExpr, + Expr** outExpr); + // A "proper" type is one that can be used as the type of an expression. // Put simply, it can be a concrete type like `int`, or a generic // type that is applied to arguments, like `Texture2D<float4>`. |
