From 492f56e02fe9e9902eabefaa34f5b2fc9778dd47 Mon Sep 17 00:00:00 2001 From: kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> Date: Tue, 30 Apr 2024 10:47:10 -0700 Subject: Add option -disable-short-circuit (#4054) Add option -disable-short-circuit to disable short circuit for logic operators && and ||. Also, disable the short circuit by default in the stdlib. --- source/slang/slang-check-impl.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source/slang/slang-check-impl.h') diff --git a/source/slang/slang-check-impl.h b/source/slang/slang-check-impl.h index f0c6d693d..d90c3c4b0 100644 --- a/source/slang/slang-check-impl.h +++ b/source/slang/slang-check-impl.h @@ -798,7 +798,13 @@ namespace Slang : m_shared(shared) , m_sink(shared->getSink()) , m_astBuilder(shared->getLinkage()->getASTBuilder()) - {} + { + if (shared->getLinkage()->m_optionSet.hasOption(CompilerOptionName::DisableShortCircuit)) + { + m_shouldShortCircuitLogicExpr = + !shared->getLinkage()->m_optionSet.getBoolOption(CompilerOptionName::DisableShortCircuit); + } + } SharedSemanticsContext* getShared() { return m_shared; } CompilerOptionSet& getOptionSet() { return getShared()->getOptionSet(); } -- cgit v1.2.3