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); }
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); }
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(); } }