[introspection] Verify that variadic methods aren't public API.

This commit is contained in:
Rolf Bjarne Kvinge 2016-06-09 19:59:47 +02:00
Родитель ef55c7774f
Коммит 5cbc9ca2fe
1 изменённых файлов: 12 добавлений и 0 удалений

Просмотреть файл

@ -230,6 +230,11 @@ namespace Introspection {
if (exportAttribute == null)
continue;
string name = exportAttribute.Selector;
if (exportAttribute.IsVariadic) {
VariadicChecks (m);
continue;
}
if (Skip (t, m, name))
continue;
@ -245,6 +250,13 @@ namespace Introspection {
}
}
void VariadicChecks (MethodBase m)
{
if (m.IsPublic || m.IsFamily || m.IsFamilyOrAssembly) {
AddErrorLine ("Function '{0}.{1}' is exposed and variadic. Variadic methods need custom marshaling, and must not be exposed directly.", m.DeclaringType.FullName, m.Name);
}
}
void BasicChecks (MethodBase m, Type t, ref int n)
{
int native = 0;