Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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();
            }
        }