Changeset 560 in dev for trunk/ab5.0/abdev/BasicCompiler_Common/src/Class.cpp
- Timestamp:
- May 5, 2008, 12:49:01 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/BasicCompiler_Common/src/Class.cpp
r559 r560 183 183 184 184 return true; 185 }186 187 void CClass::Implements( const CClass &interfaceClass, const Types &actualTypeParameters, std::vector<DynamicMethod::OverrideResult> &overrideResults )188 {189 ::Interface *pDestInterface = new ::Interface( &interfaceClass, actualTypeParameters );190 191 interfaces.push_back( pDestInterface );192 193 194 /////////////////////////////////////////////////////////////////195 // 基底クラスのメソッドからインターフェイスメソッドを再実装する196 /////////////////////////////////////////////////////////////////197 BOOST_FOREACH( CMethod *pMethod, GetDynamicMethods() )198 {199 DynamicMethod *pMethodForOverride = pDestInterface->GetDynamicMethods().FindForOverride( pDestInterface->GetActualTypeParameters(), &pMethod->GetUserProc() );200 if( pMethodForOverride )201 {202 DynamicMethod::OverrideResult result;203 result.enumType = pMethodForOverride->Override( &pMethod->GetUserProc(), pMethod->GetAccessibility(), false );204 result.pMethod = pMethod;205 overrideResults.push_back( result );206 207 // 実装元になるメソッドは呼び出し不可にしておく(オーバーロードの解決から除外する)208 pMethod->SetNotUseMark( true );209 }210 }211 212 213 /////////////////////////////////////////////////////////////////214 // キャストメソッドを追加(内部コードは自動生成すること)215 /////////////////////////////////////////////////////////////////216 if( interfaceClass.IsInterface() )217 {218 // Function Operator() As ITest219 220 char methodName[255] = { 1, ESC_OPERATOR, CALC_AS, '\0' };221 222 //関数ハッシュへ登録223 UserProc *pUserProc = new UserProc(224 NamespaceScopes(),225 NamespaceScopesCollection(),226 methodName,227 Procedure::Function,228 false,229 false,230 false );231 pUserProc->SetParentClass( this );232 233 Parameters params;234 params.push_back( new Parameter( "_System_LocalThis", Type( DEF_PTR_VOID ) ) );235 pUserProc->SetRealParams( params );236 237 pUserProc->SetReturnType( Type( DEF_OBJECT, interfaceClass ) );238 pUserProc->_paramStr = "";239 pUserProc->Using();240 compiler.GetObjectModule().meta.GetUserProcs().Insert( pUserProc, -1 );241 242 LexicalAnalyzer::AddMethod(this,243 pUserProc,244 Prototype::Public,245 0,246 false, // isConst247 false, // isAbstract248 false, // isVirtual249 false, // isOverride250 "",251 true, // isAutoGeneration252 -1253 );254 }255 185 } 256 186
Note:
See TracChangeset
for help on using the changeset viewer.