summaryrefslogtreecommitdiff
path: root/source/slang/slang-syntax.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2025-02-27 13:21:20 -0800
committerGitHub <noreply@github.com>2025-02-27 13:21:20 -0800
commit90b3817498d9cf664346f04dcea71f48ce81993e (patch)
treec5efa3424b9dff520e090e98c245a8b518c0b51e /source/slang/slang-syntax.cpp
parent6cf15f4ea1fe044d8227440dcc30ac712334568e (diff)
Make capability diagnostic message more friendly. (#6474)
* Make capability diagnostic message more friendly. * Fix. * Fix. * Fix. * Fix test. * Update expected fail setting for aarch64/linux * Fix.
Diffstat (limited to 'source/slang/slang-syntax.cpp')
-rw-r--r--source/slang/slang-syntax.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/source/slang/slang-syntax.cpp b/source/slang/slang-syntax.cpp
index e479f1b9d..efb5814e6 100644
--- a/source/slang/slang-syntax.cpp
+++ b/source/slang/slang-syntax.cpp
@@ -223,8 +223,20 @@ void printDiagnosticArg(StringBuilder& sb, ASTNodeType nodeType)
case ASTNodeType::RequireCapabilityDecl:
sb << "__require_capability";
break;
+ case ASTNodeType::DiscardStmt:
+ sb << "discard";
+ break;
default:
- sb << "decl";
+ if (ASTClassInfo::getInfo(nodeType)->isDerivedFrom((uint32_t)ASTNodeType::Expr))
+ sb << "expression";
+ else if (ASTClassInfo::getInfo(nodeType)->isDerivedFrom((uint32_t)ASTNodeType::Stmt))
+ sb << "statement";
+ else if (ASTClassInfo::getInfo(nodeType)->isDerivedFrom((uint32_t)ASTNodeType::Decl))
+ sb << "decl";
+ else if (ASTClassInfo::getInfo(nodeType)->isDerivedFrom((uint32_t)ASTNodeType::Val))
+ sb << "val";
+ else
+ sb << "node";
break;
}
}