diff options
| author | David Eriksson <eriksson@php.net> | 2001-02-20 15:35:56 +0000 |
|---|---|---|
| committer | David Eriksson <eriksson@php.net> | 2001-02-20 15:35:56 +0000 |
| commit | f9fe6880555ed9566c7e8fcfd5a23e4c7e34956e (patch) | |
| tree | 279ea0fdee2a240a04c7ef1ab9e75f44bb0d1240 | |
| parent | 10695935e0066b9495ae65a8e28d583dfd4eb145 (diff) | |
| download | php-git-f9fe6880555ed9566c7e8fcfd5a23e4c7e34956e.tar.gz | |
Patch for inherited interfaces by Daniel Stodden <stodden@in.tum.de>
| -rw-r--r-- | ext/satellite/typemanager.c | 66 |
1 files changed, 55 insertions, 11 deletions
diff --git a/ext/satellite/typemanager.c b/ext/satellite/typemanager.c index 0087489220..ede144b6fb 100644 --- a/ext/satellite/typemanager.c +++ b/ext/satellite/typemanager.c @@ -219,19 +219,63 @@ ExceptionType * TypeManager_FindException(/*TypeManager * pTypeManager, */ return pException; } + + +/* + find an operation in an interface tree, + recursing into inherited interfaces +*/ +static CORBA_boolean +findoperation_recurse( IDL_tree tree, const char *name, + IdlInfo *pIdlInfo ) +{ + IDL_tree inherited; + CORBA_boolean success; + + success = orbit_find_type( IDL_INTERFACE(tree).body, + name, IDLN_OP_DCL, + pIdlInfo ); + if ( success ) + return CORBA_TRUE; + + for ( inherited = IDL_INTERFACE(tree).inheritance_spec; + inherited != NULL; + inherited = IDL_LIST(inherited).next ) { + IDL_tree ident = IDL_LIST(inherited).data; + InterfaceType *iface; + + iface = TypeManager_FindInterface( IDL_IDENT(ident).repo_id ); + success = findoperation_recurse( iface->mIdlInfo.mType, + name, + pIdlInfo ); + orbit_delete( iface ); + + if ( success ) + return CORBA_TRUE; + + zend_error( E_WARNING, "operation %s not found in iface %s\n", + name, IDL_IDENT(ident).repo_id ); + } + + return CORBA_FALSE; +} + /* find an operation in an interface based on case-insensitive name */ -OperationType * InterfaceType_FindOperation(InterfaceType * pInterface, - const char * name) +OperationType * InterfaceType_FindOperation( InterfaceType * pInterface, + const char * name ) { - OperationType * pOperation = orbit_new(OperationType); - CORBA_boolean success = orbit_find_type( - pInterface->mIdlInfo.mType, name, IDLN_OP_DCL, &pOperation->mIdlInfo); - if (!success) - { - orbit_delete(pOperation); - pOperation = NULL; - } - return pOperation; + OperationType *pOperation = orbit_new(OperationType); + IDL_tree tree = pInterface->mIdlInfo.mType; + CORBA_boolean success; + + success = findoperation_recurse( tree, name, + &pOperation->mIdlInfo ); + + if ( success ) + return pOperation; + + orbit_delete(pOperation); + return NULL; } /* find an attribute in an interface based on case-insensitive name */ |
