diff options
author | Tomoyuki Kubota <himajin100000@gmail.com> | 2019-09-17 21:24:50 +0900 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-09-17 16:33:33 +0200 |
commit | ff6383face219970a0435b008a0439643a61043e (patch) | |
tree | 6f8f9ae8f1736b477015b624b9901380f11cfa7b /basic | |
parent | d52010013b9cacdd8f71e62fef18c1e679e807f2 (diff) |
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic')
-rwxr-xr-x | basic/qa/basic_coverage/test_optional_paramter_type.vb | 33 | ||||
-rwxr-xr-x[-rw-r--r--] | basic/source/runtime/runtime.cxx | 2 |
2 files changed, 34 insertions, 1 deletions
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 index 74fe533bd4a5..59daf1531d2a 100644..100755 --- 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 ); } |