Skip to content

Commit

Permalink
v5.9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
objeck committed Jun 12, 2021
1 parent cb65309 commit 04baf5b
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions core/compiler/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,37 @@ void ContextAnalyzer::AnalyzeGenerics(Class* klass, const int depth)
}
}

/****************************
* Checks for virtual method
* implementations
****************************/
bool ContextAnalyzer::AnalyzeVirtualMethods(Class* impl_class, Class* virtual_class, const int depth)
{
// get virtual methods
vector<Method*> virtual_class_methods = virtual_class->GetMethods();
for(size_t i = 0; i < virtual_class_methods.size(); ++i) {
Method* virtual_method = virtual_class_methods[i];
if(virtual_method->IsVirtual()) {
const wstring virtual_method_name = virtual_method->GetEncodedName();
// search for implementation method via signature
const size_t offset = virtual_method_name.find(':');
if(offset != wstring::npos) {
const wstring encoded_name = impl_class->GetName() + virtual_method_name.substr(offset);
Method* impl_method = impl_class->GetMethod(encoded_name);
if(impl_method) {
AnalyzeVirtualMethod(impl_class, impl_method->GetMethodType(), impl_method->GetReturn(),
impl_method->IsStatic(), impl_method->IsVirtual(), virtual_method);
return true;
}
}

return false;
}
}

return true;
}

/****************************
* Checks for interface
* implementations
Expand Down Expand Up @@ -605,37 +636,6 @@ void ContextAnalyzer::AnalyzeInterfaces(Class* klass, const int depth)
klass->SetLibraryInterfaces(lib_interfaces);
}

/****************************
* Checks for virtual method
* implementations
****************************/
bool ContextAnalyzer::AnalyzeVirtualMethods(Class* impl_class, Class* virtual_class, const int depth)
{
// get virtual methods
vector<Method*> virtual_class_methods = virtual_class->GetMethods();
for(size_t i = 0; i < virtual_class_methods.size(); ++i) {
Method* virtual_method = virtual_class_methods[i];
if(virtual_method->IsVirtual()) {
const wstring virtual_method_name = virtual_method->GetEncodedName();
// search for implementation method via signature
const size_t offset = virtual_method_name.find(':');
if(offset != wstring::npos) {
const wstring encoded_name = impl_class->GetName() + virtual_method_name.substr(offset);
Method* impl_method = impl_class->GetMethod(encoded_name);
if(impl_method) {
AnalyzeVirtualMethod(impl_class, impl_method->GetMethodType(), impl_method->GetReturn(),
impl_method->IsStatic(), impl_method->IsVirtual(), virtual_method);
return true;
}
}

return false;
}
}

return true;
}

/****************************
* Analyzes virtual method, which
* are made when compiling shared
Expand Down

0 comments on commit 04baf5b

Please sign in to comment.