[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - basic/source
Eike Rathke (via logerrit)
logerrit at kemper.freedesktop.org
Fri May 3 15:11:42 UTC 2019
basic/source/sbx/sbxvalue.cxx | 36 +++++++++++-------------------------
1 file changed, 11 insertions(+), 25 deletions(-)
New commits:
commit 0f96df766e2b51ad49fed1e4d3f3d2660f80da12
Author: Eike Rathke <erack at redhat.com>
AuthorDate: Thu May 2 20:54:16 2019 +0200
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri May 3 17:10:47 2019 +0200
Resolves: tdf#124605 ditch "if operand 1 is Empty, result is operand 2"
It has been like that since the initial import but is utter
nonsense. It might had (doubtfully) served some early StarBasic
compatibility quirk, but is wrong and was implementation defined
buggy behaviour. The Option VBASupport 1 even explicitly disabled
it.
In future we may want to implement the VBA Nothing value for an
SbxEMPTY at least for boolean operators, but this for Calc user
defined macro functions might even need a distinguished
SbxEMPTYCELL or such. Or an explicit SbxNOTHING.
Change-Id: I28919d982d0e60b9b840a12271dc717effa59662
Reviewed-on: https://gerrit.libreoffice.org/71701
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Jenkins
(cherry picked from commit 15c39bb2e75df40c30bcbf789d815376dd2e31ce)
Reviewed-on: https://gerrit.libreoffice.org/71705
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index 05e8773aab9f..cc4cb15fb311 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -821,12 +821,6 @@ bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
// Special rule 1: If one operand is null, the result is null
else if( eThisType == SbxNULL || eOpType == SbxNULL )
SetType( SbxNULL );
- // Special rule 2: If the operand is Empty, the result is the 2. operand
- else if( eThisType == SbxEMPTY
- && !bVBAInterop
- )
- *this = rOp;
- // 1996-2-13: Don't test for SbxEMPTY before Get
else
{
SbxValues aL, aR;
@@ -846,7 +840,7 @@ bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
rOp.Get( aR );
// From 1999-12-8, #70399: Here call GetType() again, Get() can change the type!
if( rOp.GetType() == SbxEMPTY )
- goto Lbl_OpIsEmpty;
+ goto Lbl_OpIsEmpty; // concatenate empty, *this stays lhs as result
Get( aL );
// #30576: To begin with test, if the conversion worked
@@ -891,13 +885,18 @@ bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
if( rOp.Get( aR ) ) // re-do Get after type assigns above
{
- if( rOp.GetType() == SbxEMPTY )
- {
- if ( !bVBAInterop || ( eOp != SbxNOT ) )
- goto Lbl_OpIsEmpty;
- }
if( Get( aL ) ) switch( eOp )
{
+ /* TODO: For SbxEMPTY operands with boolean operators use
+ * the VBA Nothing definition of Comparing Nullable Types?
+ * https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/data-types/nullable-value-types
+ */
+ /* TODO: it is unclear yet whether this also should be done
+ * for the non-bVBAInterop case or not, or at all, consider
+ * user defined spreadsheet functions where an empty cell
+ * is SbxEMPTY and usually is treated as 0 zero or "" empty
+ * string.
+ */
case SbxIDIV:
if( aL.eType == SbxCURRENCY )
if( !aR.nInt64 ) SetError( ERRCODE_BASIC_ZERODIV );
@@ -984,11 +983,6 @@ bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
bDecimal = true;
if( rOp.Get( aR ) )
{
- if( rOp.GetType() == SbxEMPTY )
- {
- releaseDecimalPtr( aL.pDecimal );
- goto Lbl_OpIsEmpty;
- }
if( Get( aL ) )
{
if( aL.pDecimal && aR.pDecimal )
@@ -1034,9 +1028,6 @@ bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
if( rOp.Get( aR ) )
{
- if( rOp.GetType() == SbxEMPTY )
- goto Lbl_OpIsEmpty;
-
if( Get( aL ) ) switch( eOp )
{
case SbxMUL:
@@ -1127,11 +1118,6 @@ Lbl_OpIsDouble:
aL.eType = aR.eType = SbxDOUBLE;
if( rOp.Get( aR ) )
{
- if( rOp.GetType() == SbxEMPTY )
- {
- if ( !bVBAInterop || ( eOp != SbxNEG ) )
- goto Lbl_OpIsEmpty;
- }
if( Get( aL ) )
{
switch( eOp )
More information about the Libreoffice-commits
mailing list