コード例 #1
0
        private void MarkNewSlot(MethodSlotEntry slotMethod)
        {
            MethodState superMethodState = null;

            while (slotMethod != null)
            {
                var methodState = _state.GetMethod(slotMethod.Method);

                if (superMethodState != null && NeedsOverride(superMethodState, methodState))
                {
                    superMethodState.IsNewSlot = true;
                }

                superMethodState = methodState;
                slotMethod       = slotMethod.BaseMethod;
            }
        }
コード例 #2
0
        private void CollectSlot(MethodSlotEntry mainSlotMethod, MethodState mainMethodState, MethodSlotEntry slotMethod, bool isNewSlot)
        {
            if (mainSlotMethod == slotMethod)
            {
                isNewSlot = mainMethodState.IsNewSlot;
            }
            else
            {
                var methodState = _state.GetMethod(slotMethod.Method);
                var method      = slotMethod.Method;

                if (isNewSlot)
                {
                    // Add override to main method in slot.
                    mainMethodState.Overrides.Add(method);
                }
                else
                {
                    // Remove override method.
                    mainMethodState.Overrides.Remove(method);
                }

                if (slotMethod.Depth == 0)
                {
                    // Remove overrides of root overriden methods.
                    methodState.Overrides.Clear();
                }

                isNewSlot = methodState.IsNewSlot;
            }

            // Build base methods.
            if (slotMethod.BaseMethod != null)
            {
                CollectSlot(mainSlotMethod, mainMethodState, slotMethod.BaseMethod, isNewSlot);
            }
        }