IronRuby.Builtins.RubyClass.GetUnderlyingSystemType C# (CSharp) Метод

GetUnderlyingSystemType() публичный Метод

public GetUnderlyingSystemType ( ) : Type
Результат System.Type
        public override Type/*!*/ GetUnderlyingSystemType() {
            if (_isSingletonClass) {
                throw RubyExceptions.CreateTypeError("A singleton class doesn't have underlying system type.");
            }

            if (_underlyingSystemType == null) {
                Interlocked.Exchange(ref _underlyingSystemType, 
                    RubyTypeDispenser.GetOrCreateType(
                        _superClass != null ? _superClass.GetUnderlyingSystemType() : typeof(BasicObject), 
                        GetImplementedInterfaces(),
                        _superClass != null && (_superClass.Restrictions & ModuleRestrictions.NoOverrides) != 0
                    )
                );
            }

            Debug.Assert(_underlyingSystemType != null);
            return _underlyingSystemType;
        }

Usage Example

Пример #1
0
        public static Proc /*!*/ CreateNew(CallSiteStorage <Func <CallSite, object, object> > /*!*/ storage,
                                           RubyScope /*!*/ scope, RubyClass /*!*/ self)
        {
            RubyMethodScope methodScope = scope.GetInnerMostMethodScope();

            if (methodScope == null || methodScope.BlockParameter == null)
            {
                throw RubyExceptions.CreateArgumentError("tried to create Proc object without a block");
            }

            var proc = methodScope.BlockParameter;

            // an instance of Proc class, the identity is preserved:
            if (self.GetUnderlyingSystemType() == typeof(Proc))
            {
                return(proc);
            }

            // an instance of a Proc subclass:
            var result = new Proc.Subclass(self, proc);

            var initialize = storage.GetCallSite("initialize", new RubyCallSignature(0, RubyCallFlags.HasImplicitSelf));

            initialize.Target(initialize, result);

            return(result);
        }
All Usage Examples Of IronRuby.Builtins.RubyClass::GetUnderlyingSystemType