diff options
| author | kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> | 2024-04-30 10:47:10 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-30 10:47:10 -0700 |
| commit | 492f56e02fe9e9902eabefaa34f5b2fc9778dd47 (patch) | |
| tree | 7bbef87fd9b0b117f01a1d34227bbd02f227f783 /source/slang/slang-check-impl.h | |
| parent | f1221b80c3c5f59ed533147825ea414bef5e9df2 (diff) | |
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.
Diffstat (limited to 'source/slang/slang-check-impl.h')
| -rw-r--r-- | source/slang/slang-check-impl.h | 8 |
1 files changed, 7 insertions, 1 deletions
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(); } |
