From ff6383face219970a0435b008a0439643a61043e Mon Sep 17 00:00:00 2001 From: Tomoyuki Kubota Date: Tue, 17 Sep 2019 21:24:50 +0900 Subject: tdf#118544 set correct type for optional parameter Change-Id: Id8840431b9dc1f1e97882c675ebfc6456e33d953 Reviewed-on: https://gerrit.libreoffice.org/77684 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../basic_coverage/test_optional_paramter_type.vb | 33 ++++++++++++++++++++++ basic/source/runtime/runtime.cxx | 2 +- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100755 basic/qa/basic_coverage/test_optional_paramter_type.vb mode change 100644 => 100755 basic/source/runtime/runtime.cxx (limited to 'basic') diff --git a/basic/qa/basic_coverage/test_optional_paramter_type.vb b/basic/qa/basic_coverage/test_optional_paramter_type.vb new file mode 100755 index 000000000000..37198ea38244 --- /dev/null +++ b/basic/qa/basic_coverage/test_optional_paramter_type.vb @@ -0,0 +1,33 @@ +REM ***** BASIC ***** +Option Compatible + +Function doUnitTest() As Integer + doUnitTest = 0 + If CheckType1(32) = 0 Then + Exit Function + End If + If CheckType2(32) = 0 Then + Exit Function + End If + If CheckType2() = 0 Then + Exit Function + End If + doUnitTest = 1 +End Function + +Function CheckType1(x As Integer) As Integer + If TypeName(x) = "Integer" Then + CheckType1 = 1 + Else + CheckType1 = 0 + End If +End Function + + +Function CheckType2(Optional y As Integer = 32 ) As Integer + If TypeName(y) = "Integer" Then + CheckType2 = 1 + Else + CheckType2 = 0 + End If +End Function \ No newline at end of file diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx old mode 100644 new mode 100755 index 74fe533bd4a5..59daf1531d2a --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -4040,7 +4040,7 @@ void SbiRuntime::StepPARAM( sal_uInt32 nOp1, sal_uInt32 nOp2 ) if( nDefaultId > 0 ) { OUString aDefaultStr = pImg->GetString( nDefaultId ); - p = new SbxVariable(); + p = new SbxVariable(pParam-> eType); p->PutString( aDefaultStr ); refParams->Put( p, i ); } -- cgit