summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-parser.cpp')
-rw-r--r--source/slang/slang-parser.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/slang/slang-parser.cpp b/source/slang/slang-parser.cpp
index 7cd0cdce9..b513217c8 100644
--- a/source/slang/slang-parser.cpp
+++ b/source/slang/slang-parser.cpp
@@ -5086,6 +5086,14 @@ namespace Slang
return tryExpr;
}
+ static NodeBase* parseTreatAsDifferentiableExpr(Parser* parser, void* /*userData*/)
+ {
+ auto noDiffExpr = parser->astBuilder->create<TreatAsDifferentiableExpr>();
+ noDiffExpr->innerExpr = parser->ParseLeafExpression();
+ noDiffExpr->scope = parser->currentScope;
+ return noDiffExpr;
+ }
+
static bool _isFinite(double value)
{
// Lets type pun double to uint64_t, so we can detect special double values
@@ -6670,6 +6678,7 @@ namespace Slang
_makeParseExpr("nullptr", parseNullPtrExpr),
_makeParseExpr("none", parseNoneExpr),
_makeParseExpr("try", parseTryExpr),
+ _makeParseExpr("no_diff", parseTreatAsDifferentiableExpr),
_makeParseExpr("__TaggedUnion", parseTaggedUnionType),
_makeParseExpr("__fwd_diff", parseForwardDifferentiate),
_makeParseExpr("__bwd_diff", parseBackwardDifferentiate)