Kaydet (Commit) 3ee2cae3 authored tarafından Winfried Donkers's avatar Winfried Donkers Kaydeden (comit) Eike Rathke

tdf#97831 follow up : remove unused arguments from stack

Intention:
Make e.g. [1+SWITCH(1;1;1;6)] work. Without this fix, the result is
7 but should be 2.

Change-Id: I2a72e458e5458c02c3ce2f4214b86ba13f7b1d11
Reviewed-on: https://gerrit.libreoffice.org/27664Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
Tested-by: 's avatarEike Rathke <erack@redhat.com>
üst e0eb8578
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -1897,7 +1897,15 @@ void ScInterpreter::ScIfs_MS() ...@@ -1897,7 +1897,15 @@ void ScInterpreter::ScIfs_MS()
//push result : //push result :
FormulaTokenRef xToken( PopToken() ); FormulaTokenRef xToken( PopToken() );
if ( xToken ) if ( xToken )
{
// Remove unused arguments of IFS from the stack before pushing the result.
while ( nParamCount > 1 )
{
Pop();
nParamCount--;
}
PushTempToken( xToken.get() ); PushTempToken( xToken.get() );
}
else else
PushError( errUnknownStackVariable ); PushError( errUnknownStackVariable );
} }
...@@ -2000,7 +2008,15 @@ void ScInterpreter::ScSwitch_MS() ...@@ -2000,7 +2008,15 @@ void ScInterpreter::ScSwitch_MS()
// push result // push result
FormulaTokenRef xToken( PopToken() ); FormulaTokenRef xToken( PopToken() );
if ( xToken ) if ( xToken )
{
// Remove unused arguments of SWITCH from the stack before pushing the result.
while ( nParamCount > 1 )
{
Pop();
nParamCount--;
}
PushTempToken( xToken.get() ); PushTempToken( xToken.get() );
}
else else
PushError( errUnknownStackVariable ); PushError( errUnknownStackVariable );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment