Kaydet (Commit) 7470c682 authored tarafından Tsutomu Uchino's avatar Tsutomu Uchino

#i63614# fix strange type missmatch when Iif runtime function is used

Second or later compilation uses value type returned by previous execution of code. 
Use the defined type as return value of the runtime function of Basic always. 
üst 04ab3dd0
......@@ -31,17 +31,22 @@ class SbxMethodImpl;
class SbxMethod : public SbxVariable
{
SbxMethodImpl* mpSbxMethodImpl; // Impl data
bool mbIsRuntimeFunction;
SbxDataType mbRuntimeFunctionReturnType;
public:
SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_METHOD,1);
TYPEINFO();
SbxMethod( const String& r, SbxDataType t )
: SbxVariable( t ) { SetName( r ); }
SbxMethod( const SbxMethod& r ) : SvRefBase( r ), SbxVariable( r ) {}
SbxMethod( const String& r, SbxDataType t, bool bIsRuntimeFunction=false )
: SbxVariable( t ), mbIsRuntimeFunction( bIsRuntimeFunction ), mbRuntimeFunctionReturnType( t ) { SetName( r ); }
SbxMethod( const SbxMethod& r )
: SvRefBase( r ), SbxVariable( r ), mbIsRuntimeFunction( r.IsRuntimeFunction() ) {}
SbxMethod& operator=( const SbxMethod& r )
{ SbxVariable::operator=( r ); return *this; }
sal_Bool Run( SbxValues* pValues = NULL );
virtual SbxClassType GetClass() const;
bool IsRuntimeFunction() const { return mbIsRuntimeFunction; }
SbxDataType GetRuntimeFunctionReturnType() const{ return mbRuntimeFunctionReturnType; }
};
#ifndef __SBX_SBXMETHODREF_HXX
......
......@@ -80,7 +80,7 @@ public:
SbxVariable* Execute( const String& );
// Manage elements
virtual sal_Bool GetAll( SbxClassType ) { return sal_True; }
SbxVariable* Make( const String&, SbxClassType, SbxDataType );
SbxVariable* Make( const String&, SbxClassType, SbxDataType, bool bIsRuntimeFunction = false );
virtual SbxObject* MakeObject( const String&, const String& );
virtual void Insert( SbxVariable* );
// AB 23.4.1997, Optimization, Insertion without check for duplicate Entries and
......
......@@ -169,7 +169,15 @@ SbiSymDef* SbiParser::CheckRTLForSym( const String& rSym, SbxDataType eType )
if( pVar->IsA( TYPE(SbxMethod) ) )
{
SbiProcDef* pProc_ = aRtlSyms.AddProc( rSym );
pProc_->SetType( pVar->GetType() );
SbxMethod* pMethod = (SbxMethod*) pVar;
if ( pMethod && pMethod->IsRuntimeFunction() )
{
pProc_->SetType( pMethod->GetRuntimeFunctionReturnType() );
}
else
{
pProc_->SetType( pVar->GetType() );
}
pDef = pProc_;
}
else
......
......@@ -715,7 +715,7 @@ SbxVariable* SbiStdObject::Find( const String& rName, SbxClassType t )
eCT = SbxCLASS_PROPERTY;
else if( nType & _METHOD )
eCT = SbxCLASS_METHOD;
pVar = Make( aName_, eCT, p->eType );
pVar = Make( aName_, eCT, p->eType, ( p->nArgs & _FUNCTION ) == _FUNCTION );
pVar->SetUserData( nIndex + 1 );
pVar->SetFlags( nAccess );
}
......
......@@ -376,7 +376,7 @@ SbxArray* SbxObject::FindVar( SbxVariable* pVar, sal_uInt16& nArrayIdx )
// Falls ein neues Objekt eingerichtet wird, wird es, falls es bereits
// eines mit diesem Namen gibt, indiziert.
SbxVariable* SbxObject::Make( const XubString& rName, SbxClassType ct, SbxDataType dt )
SbxVariable* SbxObject::Make( const XubString& rName, SbxClassType ct, SbxDataType dt, bool bIsRuntimeFunction )
{
// Ist das Objekt bereits vorhanden?
SbxArray* pArray = NULL;
......@@ -422,7 +422,7 @@ SbxVariable* SbxObject::Make( const XubString& rName, SbxClassType ct, SbxDataTy
pVar = new SbxProperty( rName, dt );
break;
case SbxCLASS_METHOD:
pVar = new SbxMethod( rName, dt );
pVar = new SbxMethod( rName, dt, bIsRuntimeFunction );
break;
case SbxCLASS_OBJECT:
pVar = CreateObject( rName );
......
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