コード例 #1
0
        private void ApplyAddAugment(object obj, AObject root, Augment augment, IReadOnlyState state)
        {
            var value = augment.ValueFunc(obj, state);

            if (ShouldIgnoreAugment(value))
            {
                return;
            }

            root[augment.Name] = augment.ValueFunc(obj, state);
        }
コード例 #2
0
        private void ApplyRemoveAugment(object obj, AObject root, Augment augment, IReadOnlyState state)
        {
            var value = augment.ValueFunc?.Invoke(obj, state);

            if (ShouldIgnoreAugment(value))
            {
                return;
            }

            root.Remove(augment.Name);
        }
コード例 #3
0
        private void ApplyAugment(object obj, AObject root, Augment augment, IReadOnlyState state)
        {
            switch (augment.Kind)
            {
            case AugmentKind.Add:
                ApplyAddAugment(obj, root, augment, state);
                break;

            case AugmentKind.Remove:
                ApplyRemoveAugment(obj, root, augment, state);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }