Author: hanya
Date: Thu Jan 8 16:28:11 2015
New Revision: 1650325
URL: http://svn.apache.org/r1650325
Log:
#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.
Modified:
openoffice/trunk/main/basic/inc/basic/sbxmeth.hxx
openoffice/trunk/main/basic/inc/basic/sbxobj.hxx
openoffice/trunk/main/basic/source/comp/parser.cxx
openoffice/trunk/main/basic/source/runtime/stdobj.cxx
openoffice/trunk/main/basic/source/sbx/sbxobj.cxx
Modified: openoffice/trunk/main/basic/inc/basic/sbxmeth.hxx
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/basic/inc/basic/sbxmeth.hxx?rev=1650325&r1=1650324&r2=1650325&view=diff
==============================================================================
--- openoffice/trunk/main/basic/inc/basic/sbxmeth.hxx (original)
+++ openoffice/trunk/main/basic/inc/basic/sbxmeth.hxx Thu Jan 8 16:28:11 2015
@@ -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
Modified: openoffice/trunk/main/basic/inc/basic/sbxobj.hxx
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/basic/inc/basic/sbxobj.hxx?rev=1650325&r1=1650324&r2=1650325&view=diff
==============================================================================
--- openoffice/trunk/main/basic/inc/basic/sbxobj.hxx (original)
+++ openoffice/trunk/main/basic/inc/basic/sbxobj.hxx Thu Jan 8 16:28:11 2015
@@ -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
Modified: openoffice/trunk/main/basic/source/comp/parser.cxx
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/basic/source/comp/parser.cxx?rev=1650325&r1=1650324&r2=1650325&view=diff
==============================================================================
--- openoffice/trunk/main/basic/source/comp/parser.cxx (original)
+++ openoffice/trunk/main/basic/source/comp/parser.cxx Thu Jan 8 16:28:11 2015
@@ -169,7 +169,15 @@ SbiSymDef* SbiParser::CheckRTLForSym( co
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
Modified: openoffice/trunk/main/basic/source/runtime/stdobj.cxx
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/basic/source/runtime/stdobj.cxx?rev=1650325&r1=1650324&r2=1650325&view=diff
==============================================================================
--- openoffice/trunk/main/basic/source/runtime/stdobj.cxx (original)
+++ openoffice/trunk/main/basic/source/runtime/stdobj.cxx Thu Jan 8 16:28:11
2015
@@ -715,7 +715,7 @@ SbxVariable* SbiStdObject::Find( const S
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 );
}
Modified: openoffice/trunk/main/basic/source/sbx/sbxobj.cxx
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/basic/source/sbx/sbxobj.cxx?rev=1650325&r1=1650324&r2=1650325&view=diff
==============================================================================
--- openoffice/trunk/main/basic/source/sbx/sbxobj.cxx (original)
+++ openoffice/trunk/main/basic/source/sbx/sbxobj.cxx Thu Jan 8 16:28:11 2015
@@ -376,7 +376,7 @@ SbxArray* SbxObject::FindVar( SbxVariabl
// 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 XubS
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 );