<commit_before>﻿namespace JsGoogleCompile
{
    using System;
    using System.Linq.Expressions;

    /// <summary>
    /// Static class for helping with guards
    /// </summary>
    public static class Guard
    {
        /// <summary>
        /// Assert not null.
        /// </summary>
        /// <param name="variable">
        /// The selector.
        /// </param>
        /// <typeparam name="T">The type of variable we are checking </typeparam>
        /// <exception cref="ArgumentNullException">Exception thrown in the event of parameter being null</exception>
        public static void NotNull<T>(Expression<Func<T>> variable) where T : class 
        {
            var value = variable.Compile().Invoke();
            if (value == null)
            {
                string name = ((MemberExpression)variable.Body).Member.Name;
                throw new ArgumentNullException(name);
            }
        }
    }
}<commit_msg>New version of Guard<commit_after>﻿namespace JsGoogleCompile
{
    using System;
    using System.Linq.Expressions;
    using System.Reflection;

    /// <summary>
    /// Static class for helping with guards
    /// </summary>
    public static class Guard
    {
        /// <summary>
        /// Assert not null.
        /// </summary>
        /// <param name="variable">
        /// The selector.
        /// </param>
        /// <typeparam name="T">The type of variable we are checking </typeparam>
        /// <exception cref="ArgumentNullException">Exception thrown in the event of parameter being null</exception>
        public static void NotNull<T>(Expression<Func<T>> variable) where T : class 
        {
            var memberSelector = (MemberExpression)variable.Body;
            var constantSelector = (ConstantExpression)memberSelector.Expression;
            var value = ((FieldInfo)memberSelector.Member).GetValue(constantSelector.Value);
 
            if (value == null)
            {
                var name = ((MemberExpression)variable.Body).Member.Name;
                throw new ArgumentNullException(name);
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.11923990498812352, 'fraction_numerical': 0.0, 'mean_word_length': 1.908839779005525, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6239716', 'n_tokens_mistral': 526, 'n_tokens_neox': 511, 'n_words': 145}