diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-10-28 18:59:57 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-11-09 09:53:38 +0100 |
commit | d628258f279d003ba4e11f1f7e2e69273acd008c (patch) | |
tree | 15eb418ed03271538d1155402d41f8d1778937a6 /basic | |
parent | 7e7e97fc0bd2f3d7b794b3fc064c60ef86e9b72b (diff) |
tdf#80731: Only check closing parenthesis when in IDE
This reinstates the fix by Pierre Lepage, which was reverted in
351dead74b4c213b13102f81b5ae9bb47ad8ca39, and makes sure it only
has effect when the compilation is started from IDE.
The idea is that the IDE is used primarily for development, and
that's a good opportunity to detect any error in the code. When
the code is compiled from outside of the IDE (like running an
extension), the error is tolerated to allow users run the legacy
code having this error. Hopefully this is enough for tdf#106529.
This re-uses comphelper's NoEnableJavaInteractionContext class,
which is converted into general-purpose SetFlagContext class to
avoid code duplication.
Change-Id: Ie290019cb190b8d1d590699ec13bd63eac478d09
Reviewed-on: https://gerrit.libreoffice.org/81616
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/comp/exprtree.cxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx index a7f5188aa075..a5d149a6c0ef 100644 --- a/basic/source/comp/exprtree.cxx +++ b/basic/source/comp/exprtree.cxx @@ -22,6 +22,7 @@ #include <parser.hxx> #include <basic/sbx.hxx> #include <expr.hxx> +#include <uno/current_context.hxx> SbiExpression::SbiExpression( SbiParser* p, SbiExprType t, SbiExprMode eMode, const KeywordSymbolInfo* pKeywordSymbolInfo ) @@ -1033,6 +1034,21 @@ SbiExprListPtr SbiExprList::ParseParameters( SbiParser* pParser, bool bStandalon { if( ( pExprList->bBracket && eTok == RPAREN ) || SbiTokenizer::IsEoln( eTok ) ) { + // tdf#80731 + if (SbiTokenizer::IsEoln(eTok) && pExprList->bBracket) + { + // tdf#106529: only fail here in strict mode (i.e. when compiled from IDE), and + // allow legacy code with missing closing parenthesis when started e.g. from + // extensions and event handlers + bool bCheckStrict = false; + if (auto xContext = css::uno::getCurrentContext()) + xContext->getValueByName("BasicStrict") >>= bCheckStrict; + if (bCheckStrict) + { + pParser->Error(ERRCODE_BASIC_EXPECTED, RPAREN); + pExprList->bError = true; + } + } break; } pParser->Error( pExprList->bBracket ? ERRCODE_BASIC_BAD_BRACKETS : ERRCODE_BASIC_EXPECTED, COMMA ); |