tfpt review “/shelveset:Overrides4;REDMOND\tomat”
(reviewed by Curt)
OverloadResolver: If there are multiple overloads whose parameters are
equivalent with respect to the actual arguments and the overloads differ
in name then choose the one whose name matches the call site.
Improves implementation of CLR method overrides: a call site marked by
“virtual call” flag that invokes the overridden method using Ruby name
is emitted into the override. This site resolves the method starting
with the class whose underlying type defines the override stub. If it
finds a Ruby method it calls it. Otherwise it returns “ForwardToBase”
singleton. The override calls base method in such case. The virtual
lookup looks for Ruby methods of both mangled and unmangled names. E.g.
a CLR method FooBar could be overridden using foo_bar or FooBar names.
If both methods are present FooBar takes precedence.
Adds ModuleRestrictions on RubyModule. These are flags that determine
which CLR features are not available. There are two flags for now:
NoOverrides: CLR methods defined on the underlying type
cannot be overridden by a Ruby derived class. This flag is set on
built-in classes and modules. This restriction is necessary to avoid
accidental overrides of CLR methods defined on built-ins. For example,
adding “data” method on a subclass of Exception makes it override
Exception.Data property causing troubles in exception handling.
NoNameMangling: CLR methods defined on the underlying type
can only be called using CLR name, not Ruby name. This flag is also set
on built-ins (e.g. .add no longer works, .Add still works). This
restriction aims reducing the potential of name conflicts. For example,
if Array class includes a mixin that defines “add” method this method
won’t be called by .add because CLR Add method is already defined on
the Array class.
We might consider adding methods on Module that flip these flags (e.g.
clr_allow_overrides, clr_show_members) in future if it is found useful.
Includes IRubyObjectState interface in IRubyObject interface and emits
all its methods to generated types. Adds a generator that mixes an
implementation of IRubyObject to all precompiled built-in subclasses.