diff --git a/basic/qa/vba_tests/typename.vb b/basic/qa/vba_tests/typename.vb index 4ec2f3e31063..7e49a4d61cdc 100644 --- a/basic/qa/vba_tests/typename.vb +++ b/basic/qa/vba_tests/typename.vb @@ -61,6 +61,12 @@ Function verify_testTypeName() As String date1 = TypeName(l1) TestLog_ASSERT date1 = date2, "the return TypeName is: " & date1 + ' tdf#129596 - Types of constant values + TestLog_ASSERT TypeName(32767) = "Integer", "the return TypeName(32767) is: " & TypeName(32767) + TestLog_ASSERT TypeName(-32767) = "Integer", "the return TypeName(-32767) is: " & TypeName(-32767) + TestLog_ASSERT TypeName(1048575) = "Long", "the return TypeName(1048575) is: " & TypeName(1048575) + TestLog_ASSERT TypeName(-1048575) = "Long", "the return TypeName(-1048575) is: " & TypeName(-1048575) + result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10) verify_testTypeName = result diff --git a/basic/source/comp/exprgen.cxx b/basic/source/comp/exprgen.cxx old mode 100644 new mode 100755 index d1ebb48c4c09..3981bef2fb5e --- a/basic/source/comp/exprgen.cxx +++ b/basic/source/comp/exprgen.cxx @@ -72,8 +72,10 @@ void SbiExprNode::Gen( SbiCodeGen& rGen, RecursiveMode eRecMode ) case SbxEMPTY: rGen.Gen( SbiOpcode::EMPTY_ ); break; + case SbxLONG: case SbxINTEGER: - rGen.Gen( SbiOpcode::CONST_, static_cast(nVal) ); + nStringId = rGen.GetParser()->aGblStrings.Add(nVal, eType); + rGen.Gen( SbiOpcode::CONST_, nStringId ); break; case SbxSTRING: nStringId = rGen.GetParser()->aGblStrings.Add( aStrVal ); diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx old mode 100644 new mode 100755 index d2cb9fe988b5..3a9cb95264d5 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -2803,8 +2803,18 @@ void SbiRuntime::StepLOADSC( sal_uInt32 nOp1 ) void SbiRuntime::StepLOADI( sal_uInt32 nOp1 ) { SbxVariable* p = new SbxVariable; - p->PutInteger( static_cast( nOp1 ) ); - PushVar( p ); + + OUString aStr = pImg->GetString(static_cast(nOp1)); + double n = ::rtl::math::stringToDouble(aStr, '.', ','); + if (n >= SbxMININT && n <= SbxMAXINT) + { + p->PutInteger(static_cast(n)); + } + else + { + p->PutLong(static_cast(n)); + } + PushVar(p); } // store a named argument in Argv (+Arg-no. from 1!)