From 20ab16178e45d07b4dc0104a7a98865d18440b62 Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 9 Feb 2024 22:00:15 -0800 Subject: Support link-time constants. (#3564) * Support link-time constants. * Fix. * Fix. --- source/slang/slang-check-decl.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source/slang/slang-check-decl.cpp') diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index 3882994da..2a6ee8abc 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -1471,6 +1471,11 @@ namespace Slang } else { + if (varDecl->hasModifier()) + { + getSink()->diagnose(initExpr, Diagnostics::externValueCannotHaveInitializer); + } + initExpr = CheckExpr(initExpr); // TODO: We might need some additional steps here to ensure @@ -1484,7 +1489,7 @@ namespace Slang _validateCircularVarDefinition(varDecl); } - + // If we've gone down this path, then the variable // declaration is actually pretty far along in checking varDecl->setCheckState(DeclCheckState::DefinitionChecked); -- cgit v1.2.3