未验证 提交 2832987b 编写于 作者: A Aleksey Kliger (λgeek) 提交者: GitHub

[mono] Add accessors m_method_is_final and m_method_is_abstract (#54271)

* [metadata] Cleanup redundant logic

Follow-up to 4e03f366

* Add m_method_is_abstract and m_method_is_final accessors
上级 97c2e2f6
......@@ -217,6 +217,18 @@ m_method_is_virtual (MonoMethod *method)
return (method->flags & METHOD_ATTRIBUTE_VIRTUAL) != 0;
}
static inline gboolean
m_method_is_abstract (MonoMethod *method)
{
return (method->flags & METHOD_ATTRIBUTE_ABSTRACT) != 0;
}
static inline gboolean
m_method_is_final (MonoMethod *method)
{
return (method->flags & METHOD_ATTRIBUTE_FINAL) != 0;
}
static inline gboolean
m_method_is_icall (MonoMethod *method)
{
......
......@@ -2532,7 +2532,7 @@ method_is_reabstracted (MonoMethod *method)
/* only on interfaces */
/* method is marked "final abstract" */
/* FIXME: we need some other way to detect reabstracted methods. "final" is an incidental detail of the spec. */
return method->flags & METHOD_ATTRIBUTE_FINAL && method->flags & METHOD_ATTRIBUTE_ABSTRACT;
return m_method_is_final (method) && m_method_is_abstract (method);
}
static gboolean
......@@ -2540,7 +2540,7 @@ method_is_dim (MonoMethod *method)
{
/* only valid on interface methods*/
/* method is marked "virtual" but not "virtual abstract" */
return method->flags & method->flags & METHOD_ATTRIBUTE_VIRTUAL && !(method->flags & METHOD_ATTRIBUTE_ABSTRACT);
return m_method_is_virtual (method) && !m_method_is_abstract (method);
}
static gboolean
......@@ -2582,9 +2582,8 @@ set_interface_map_data_method_object (MonoMethod *method, MonoClass *iclass, int
* the method), then say the target method is null.
*/
if (method_is_reabstracted (method) &&
((foundMethod->flags & METHOD_ATTRIBUTE_ABSTRACT) ||
(mono_class_is_interface (foundMethod->klass) && method_is_dim (foundMethod))
))
(m_method_is_abstract (foundMethod) ||
(mono_class_is_interface (foundMethod->klass) && method_is_dim (foundMethod))))
MONO_HANDLE_ARRAY_SETREF (targets, i, NULL_HANDLE);
else if (mono_class_is_interface (foundMethod->klass) && method_is_reabstracted (foundMethod) && !m_class_is_abstract (klass)) {
/* if the method we found is a reabstracted DIM method, but the class isn't abstract, return NULL */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册