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