diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-01-26 22:00:27 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-01-26 22:15:34 +0000 |
commit | 7c3ea0abeff6e0cb9e2893cec8ed63025a274117 (patch) | |
tree | ade14eff5fad5a796bcea0cc471a35d83d4c1320 /basic/source | |
parent | 6128d8379a29bb8ce50e34bfb4c7627459c2d796 (diff) |
Simplify SbiRuntime ctor
Change-Id: I18309ed4ed8ebb31b3bf9ffc676a2d501e2593b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146214
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basic/source')
-rw-r--r-- | basic/source/inc/runtime.hxx | 36 | ||||
-rw-r--r-- | basic/source/runtime/runtime.cxx | 20 |
2 files changed, 19 insertions, 37 deletions
diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx index d0922e6a0e0a..fedf68236ad5 100644 --- a/basic/source/inc/runtime.hxx +++ b/basic/source/inc/runtime.hxx @@ -226,31 +226,31 @@ class SbiRuntime SbxArrayRef refRedimpArray; // Array saved to use for REDIM PRESERVE SbxVariableRef refRedim; // Array saved to use for REDIM SbxVariableRef xDummyVar; // substitute for variables that weren't found - SbxVariable* mpExtCaller; // Caller ( external - e.g. button name, shape, range object etc. - only in vba mode ) - SbiForStack* pForStk; // FOR/NEXT-Stack - sal_uInt16 nExprLvl; // depth of the expr-stack - sal_uInt16 nForLvl; // #118235: Maintain for level + SbxVariable* mpExtCaller = nullptr; // Caller ( external - e.g. button name, shape, range object etc. - only in vba mode ) + SbiForStack* pForStk = nullptr; // FOR/NEXT-Stack + sal_uInt16 nExprLvl = 0; // depth of the expr-stack + sal_uInt16 nForLvl = 0; // #118235: Maintain for level const sal_uInt8* pCode; // current Code-Pointer const sal_uInt8* pStmnt; // beginning of the last statement - const sal_uInt8* pError; // address of the current error handler - const sal_uInt8* pRestart; // restart-address - const sal_uInt8* pErrCode; // restart-address RESUME NEXT - const sal_uInt8* pErrStmnt; // restart-address RESUME 0 + const sal_uInt8* pError = nullptr; // address of the current error handler + const sal_uInt8* pRestart = nullptr; // restart-address + const sal_uInt8* pErrCode = nullptr; // restart-address RESUME NEXT + const sal_uInt8* pErrStmnt = nullptr; // restart-address RESUME 0 OUString aLibName; // Lib-name for declare-call SbxArrayRef refParams; // current procedure parameters SbxArrayRef refLocals; // local variable SbxArrayRef refArgv; // #74254, one refSaveObj is not enough! new: pRefSaveList (see above) - short nArgc; - bool bRun; - bool bError; // true: handle errors - bool bInError; // true: in an error handler - bool bBlocked; // true: blocked by next call level, #i48868 + short nArgc = 0; + bool bRun = true; + bool bError = true; // true: handle errors + bool bInError = false; // true: in an error handler + bool bBlocked = false; // true: blocked by next call level, #i48868 bool bVBAEnabled; BasicDebugFlags nFlags; // Debugging-Flags - ErrCode nError; - sal_uInt16 nOps; // opcode counter - sal_uInt32 m_nLastTime; + ErrCode nError = ERRCODE_NONE; + sal_uInt16 nOps = 0; // opcode counter + sal_uInt32 m_nLastTime = 0; std::vector<SbxVariableRef> aRefSaved; // #74254 save temporary references std::vector<SbiGosub> pGosubStk; // GOSUB stack @@ -349,8 +349,8 @@ public: void SetVBAEnabled( bool bEnabled ); bool IsImageFlag( SbiImageFlags n ) const; sal_uInt16 GetBase() const; - sal_Int32 nLine,nCol1,nCol2; - SbiRuntime* pNext; // Stack-Chain + sal_Int32 nLine = 0, nCol1 = 0, nCol2 = 0; + SbiRuntime* pNext = nullptr; // Stack-Chain // tdf#79426, tdf#125180 - adds the information about a missing parameter static void SetIsMissing( SbxVariable* ); diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 3ef617d06e49..d19c5c4354f1 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -590,30 +590,12 @@ SbMethod* SbiInstance::GetCaller( sal_uInt16 nLevel ) SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, sal_uInt32 nStart ) : rBasic( *static_cast<StarBASIC*>(pm->pParent) ), pInst( GetSbData()->pInst ), - pMod( pm ), pMeth( pe ), pImg( pMod->pImage.get() ), mpExtCaller(nullptr), m_nLastTime(0) + pMod( pm ), pMeth( pe ), pImg( pMod->pImage.get() ) { nFlags = pe ? pe->GetDebugFlags() : BasicDebugFlags::NONE; pIosys = pInst->GetIoSystem(); - pForStk = nullptr; - pError = nullptr; - pErrCode = - pErrStmnt = - pRestart = nullptr; - pNext = nullptr; pCode = pStmnt = pImg->GetCode() + nStart; - bRun = - bError = true; - bInError = false; - bBlocked = false; - nLine = 0; - nCol1 = 0; - nCol2 = 0; - nExprLvl = 0; - nArgc = 0; - nError = ERRCODE_NONE; - nForLvl = 0; - nOps = 0; refExprStk = new SbxArray; SetVBAEnabled( pMod->IsVBACompat() ); SetParameters( pe ? pe->GetParameters() : nullptr ); |