summaryrefslogtreecommitdiffstats
path: root/examples/reflection-api/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/reflection-api/main.cpp')
-rw-r--r--examples/reflection-api/main.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/examples/reflection-api/main.cpp b/examples/reflection-api/main.cpp
index c072c641b..2ff4475bf 100644
--- a/examples/reflection-api/main.cpp
+++ b/examples/reflection-api/main.cpp
@@ -114,6 +114,21 @@ struct ReflectingPrinting
List<ComPtr<slang::IComponentType>> componentsToLink;
+ // ### Variable decls
+ //
+ key("global constants");
+ WITH_ARRAY()
+ for (auto decl : module->getModuleReflection()->getChildren())
+ {
+ if (auto varDecl = decl->asVariable(); varDecl &&
+ varDecl->findModifier(slang::Modifier::Const) &&
+ varDecl->findModifier(slang::Modifier::Static))
+ {
+ element();
+ printVariable(varDecl);
+ }
+ }
+
// ### Finding Entry Points
//
@@ -213,6 +228,13 @@ struct ReflectingPrinting
printQuotedString(name);
key("type");
printType(type);
+
+ int64_t value;
+ if (SLANG_SUCCEEDED(variable->getDefaultValueInt(&value)))
+ {
+ key("value");
+ printf("%" PRId64, value);
+ }
}
// ### Types