Пример #1
0
        public void ImplementIMixinTarget(string targetClassName)
        {
            ArgumentUtility.CheckNotNullOrEmpty("targetClassName", targetClassName);
            Assertion.IsNotNull(_initializationMethod, "AddInitializations must be called first.");
            Assertion.IsNotNull(_classContextField, "AddFields must be called first.");
            Assertion.IsNotNull(_extensionsField, "AddExtensionsField must be called first.");
            Assertion.IsNotNull(_firstField, "AddFields must be called first.");

            var noInitialization            = Expression.Empty();
            var classContextDebuggerDisplay = "Class context for " + targetClassName;
            // Initialize this instance in case we're being called before the ctor has finished running.
            var initialization = _expressionBuilder.CreateInitialization(_concreteTarget, _initializationMethod);

            ImplementReadOnlyProperty(_classContextField, noInitialization, s_classContextProperty, "ClassContext", classContextDebuggerDisplay);
            ImplementReadOnlyProperty(_extensionsField, initialization, s_mixinProperty, "Mixins", "Count = {__extensions.Length}");
            ImplementReadOnlyProperty(_firstField, initialization, s_firstNextCallProperty, "FirstNextCallProxy", "Generated proxy");
        }