Merge pull request #49619 from KoBeWi/virtual_police

Validate that all virtual methods start with _
This commit is contained in:
Rémi Verschelde 2021-06-15 18:22:46 +02:00 committed by GitHub
commit a40522d738
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -665,7 +665,7 @@ void add_exposed_classes(Context &r_context) {
TEST_COND(exposed_class.find_property_by_name(method.name),
"Method name conflicts with property: '", String(class_name), ".", String(method.name), "'.");
// Classes starting with an underscore are ignored unless they're used as a property setter or getter
// Methods starting with an underscore are ignored unless they're virtual or used as a property setter or getter.
if (!method.is_virtual && String(method.name)[0] == '_') {
for (const List<PropertyData>::Element *F = exposed_class.properties.front(); F; F = F->next()) {
const PropertyData &prop = F->get();
@ -678,6 +678,10 @@ void add_exposed_classes(Context &r_context) {
} else {
exposed_class.methods.push_back(method);
}
if (method.is_virtual) {
TEST_COND(String(method.name)[0] != '_', "Virtual method ", String(method.name), " does not start with underscore.");
}
}
// Add signals