C# Class IronRuby.Builtins.RubyClass

Inheritance: RubyModule, IDuplicable
ファイルを表示 Open project: jschementi/iron Class Usage Examples

Private Properties

Property Type Description
AddAsDependencyOf void
AddMethodsOverwriteExisting bool
BuildDelegateConstructorCall void
BuildOverriddenInitializerCall void
CacheFailure void
ClassInheritedEvent void
CreateDummySingleton RubyClass
Duplicate RubyClass
ForEachAncestor bool
GetAllocatorNewExpression System.Linq.Expressions.Expression
GetClrExtensionMethods IEnumerable
GetClrVectorFactories OverloadInfo[]
GetConstructor System.Reflection.ConstructorInfo
GetConstructors OverloadInfo[]
GetDeclaredClrMethods IEnumerable
GetDeclaredClrMethods System.Reflection.MemberInfo[]
GetDummySingletonClass RubyClass
GetSuperClass RubyClass
GetVisibleMethodCount int
IDuplicable object
InitializeDependencies void
InitializeDummySingleton void
InvalidateGroupsInSubClasses int
IsFailureCached bool
IsVisible bool
IsVisible bool
IsWriteable bool
MakeGroup IronRuby.Runtime.Calls.RubyMethodGroupInfo
MakeGroup IronRuby.Runtime.Calls.RubyOverloadGroupInfo
MarkNewException System.Linq.Expressions.Expression
MethodRemoved void
MethodUndefined void
MixinsUpdated void
PrepareExtensionMethodsUpdate void
PrepareMethodUpdate void
PrepareMethodUpdate void
ResolveMethodMissingForSite IronRuby.Runtime.Calls.RubyMemberInfo
ResolveOverriddenMethod IronRuby.Runtime.Calls.RubyMemberInfo
RubyClass System.Linq.Expressions
SetGlobalScope void
TryGetClrEvent bool
TryGetClrEvent bool
TryGetClrField bool
TryGetClrField bool
TryGetClrMember bool
TryGetClrMethod bool
TryGetClrProperty bool

Public Methods

Method Description
BuildAllocatorCall ( MetaObjectBuilder metaBuilder, CallArguments args, Func defaultExceptionMessage ) : bool
BuildClrObjectConstruction ( MetaObjectBuilder metaBuilder, CallArguments args, string methodName ) : void

Implements Class#clr_new feature.

BuildObjectAllocation ( MetaObjectBuilder metaBuilder, CallArguments args, string methodName ) : void

Implements Class#allocate feature.

BuildObjectConstruction ( MetaObjectBuilder metaBuilder, CallArguments args, string methodName ) : void

Implements Class#new feature.

BuildObjectConstructionNoFlow ( MetaObjectBuilder metaBuilder, CallArguments args, string methodName ) : void
CreateAnonymousClass ( IronRuby.Runtime.RubyScope scope, BlockParam body, RubyClass self, [ superClass ) : object
GetNonSingletonClass ( ) : RubyClass
GetUnderlyingSystemType ( ) : Type
InitializeClassCopy ( RubyClass rubyClass ) : void
IsException ( ) : bool
IsSubclassOf ( RubyClass super ) : bool

Returns true if this class is equal to super or it is its descendant.

MethodAdded ( string name ) : void
RubyClass ( RubyClass rubyClass ) : System.Linq.Expressions
TryGetClrConstructor ( IronRuby.Runtime.Calls.RubyMemberInfo &method ) : bool
TryGetClrMember ( string name, Type asType, IronRuby.Runtime.Calls.RubyMemberInfo &method ) : bool

Protected Methods

Method Description
EnumerateClrMembers ( Type type ) : IEnumerable
TryGetClrMember ( Type type, string name, bool mapNames, bool unmangleNames, IronRuby.Runtime.Calls.RubyMemberInfo &method ) : bool

Private Methods

Method Description
AddAsDependencyOf ( IList modules ) : void
AddMethodsOverwriteExisting ( Dictionary &methods, IEnumerable newOverloads, IronRuby.Runtime.Calls.RubyOverloadGroupInfo overloadOwners, bool specialNameOnly ) : bool
BuildDelegateConstructorCall ( MetaObjectBuilder metaBuilder, CallArguments args, Type type ) : void
BuildOverriddenInitializerCall ( MetaObjectBuilder metaBuilder, CallArguments args, IronRuby.Runtime.Calls.RubyMemberInfo initializer ) : void
CacheFailure ( Type type, string methodName, bool isStatic, int extensionVersion ) : void
ClassInheritedEvent ( RubyClass subClass ) : void
CreateDummySingleton ( ) : RubyClass
Duplicate ( object singletonClassOf ) : RubyClass

Duplicates this class object. When duplicating singleton class a new "singletonClassOf" reference needs to be provided. NOT thread safe.

ForEachAncestor ( bool>.Func action ) : bool
GetAllocatorNewExpression ( CallArguments args, Func defaultExceptionMessage ) : Expression
GetClrExtensionMethods ( Type type, string name ) : IEnumerable
GetClrVectorFactories ( ) : OverloadInfo[]
GetConstructor ( Type type ) : ConstructorInfo
GetConstructors ( Type type ) : OverloadInfo[]
GetDeclaredClrMethods ( Type type, BindingFlags bindingFlags, string prefix, string name, string altName, bool specialNameOnly ) : IEnumerable
GetDeclaredClrMethods ( Type type, BindingFlags bindingFlags, string name ) : System.Reflection.MemberInfo[]
GetDummySingletonClass ( ) : RubyClass
GetSuperClass ( ) : RubyClass
GetVisibleMethodCount ( IEnumerable members, bool specialNameOnly ) : int
IDuplicable ( RubyContext context, bool copySingletonMembers ) : object
InitializeDependencies ( ) : void
InitializeDummySingleton ( ) : void
InvalidateGroupsInSubClasses ( string methodName, int maxLevel ) : int
IsFailureCached ( Type type, string methodName, bool isStatic, int extensionVersion ) : bool
IsVisible ( FieldInfo field ) : bool
IsVisible ( MethodAttributes attributes, Type declaringType, bool specialNameOnly ) : bool
IsWriteable ( FieldInfo field ) : bool
MakeGroup ( IEnumerable members, int visibleMemberCount, bool specialNameOnly, bool isDetached ) : RubyMethodGroupInfo
MakeGroup ( ICollection allMethods ) : IronRuby.Runtime.Calls.RubyOverloadGroupInfo
MarkNewException ( Expression expression ) : Expression
MethodRemoved ( string name ) : void
MethodUndefined ( string name ) : void
MixinsUpdated ( RubyModule oldMixins, RubyModule newMixins ) : void
PrepareExtensionMethodsUpdate ( List extensions ) : void

Invalidates - failure cache on RubyClass via incrementing extension version - groups - call sites via incrementing method version

PrepareMethodUpdate ( string methodName, IronRuby.Runtime.Calls.RubyMemberInfo method ) : void
PrepareMethodUpdate ( string methodName, IronRuby.Runtime.Calls.RubyMemberInfo method, int mixinsToSkip ) : void
ResolveMethodMissingForSite ( string name, RubyMethodVisibility incompatibleVisibility ) : IronRuby.Runtime.Calls.RubyMemberInfo
ResolveOverriddenMethod ( string name, int modulesToSkip ) : IronRuby.Runtime.Calls.RubyMemberInfo
RubyClass ( RubyContext context, string name, Type type, object singletonClassOf, Action methodsInitializer, Action constantsInitializer, Delegate factories, RubyClass superClass, RubyModule expandedMixins, TypeTracker tracker, RubyStruct structInfo, bool isRubyClass, bool isSingletonClass, ModuleRestrictions restrictions ) : System.Linq.Expressions
SetGlobalScope ( RubyGlobalScope value ) : void
TryGetClrEvent ( Type type, BindingFlags bindingFlags, string name, IronRuby.Runtime.Calls.RubyMemberInfo &method ) : bool
TryGetClrEvent ( Type type, BindingFlags bindingFlags, string name, string altName, IronRuby.Runtime.Calls.RubyMemberInfo &method ) : bool
TryGetClrField ( Type type, BindingFlags bindingFlags, bool isWrite, string name, IronRuby.Runtime.Calls.RubyMemberInfo &method ) : bool
TryGetClrField ( Type type, BindingFlags bindingFlags, bool isWrite, string name, string altName, IronRuby.Runtime.Calls.RubyMemberInfo &method ) : bool
TryGetClrMember ( Type type, string name, bool mapNames, bool unmangleNames, BindingFlags basicBindingFlags, IronRuby.Runtime.Calls.RubyMemberInfo &method ) : bool

Returns a fresh instance of RubyMemberInfo each time it is called. The caller needs to cache it if appropriate. May add or use method groups to/from super-clases if BindingFlags.DeclaredOnly is used.

TryGetClrMethod ( Type type, BindingFlags bindingFlags, bool specialNameOnly, string name, string clrNamePrefix, string clrName, string altClrName, IronRuby.Runtime.Calls.RubyMemberInfo &method ) : bool

There are basically 4 cases: 1) CLR method of the given name is not defined in the specified type. Do nothing, the method will be found as we traverse the hierarhy towards the Kernel module. 2) Otherwise 1) There is no RubyMemberInfo of given name present in the (type..Kernel] ancestors. We need to search all types in (type..Object] for CLR method overloads. 2) There is a RubyMemberInfo in a class, say C, in (type..Kernel]. We need to get CLR methods from (type..C) in addition to the members in the type. 1) C.HidesInheritedOverloads == true All overloads of the method we look for are in [type..C). 2) C.HidesInheritedOverloads == false All overloads of the method we look for are in [type..C) and in the RubyMemberInfo.

Doesn't include explicitly implemented interface methods. Including them would allow to call them directly (obj.foo) if the overload resolution succeeds. However, the interface methods are probably implemented explicitly for a reason: 1) There is a conflict in signatures -> the overload resolution would probably fail. 2) The class was designed with an intention to not expose the implementations directly.

TryGetClrProperty ( Type type, BindingFlags bindingFlags, bool isWrite, string name, string clrName, string altClrName, IronRuby.Runtime.Calls.RubyMemberInfo &method ) : bool

Method Details

BuildAllocatorCall() public method

public BuildAllocatorCall ( MetaObjectBuilder metaBuilder, CallArguments args, Func defaultExceptionMessage ) : bool
metaBuilder IronRuby.Runtime.Calls.MetaObjectBuilder
args IronRuby.Runtime.Calls.CallArguments
defaultExceptionMessage Func
return bool

BuildClrObjectConstruction() public method

Implements Class#clr_new feature.
public BuildClrObjectConstruction ( MetaObjectBuilder metaBuilder, CallArguments args, string methodName ) : void
metaBuilder IronRuby.Runtime.Calls.MetaObjectBuilder
args IronRuby.Runtime.Calls.CallArguments
methodName string
return void

BuildObjectAllocation() public method

Implements Class#allocate feature.
public BuildObjectAllocation ( MetaObjectBuilder metaBuilder, CallArguments args, string methodName ) : void
metaBuilder IronRuby.Runtime.Calls.MetaObjectBuilder
args IronRuby.Runtime.Calls.CallArguments
methodName string
return void

BuildObjectConstruction() public method

Implements Class#new feature.
public BuildObjectConstruction ( MetaObjectBuilder metaBuilder, CallArguments args, string methodName ) : void
metaBuilder IronRuby.Runtime.Calls.MetaObjectBuilder
args IronRuby.Runtime.Calls.CallArguments
methodName string
return void

BuildObjectConstructionNoFlow() public method

public BuildObjectConstructionNoFlow ( MetaObjectBuilder metaBuilder, CallArguments args, string methodName ) : void
metaBuilder IronRuby.Runtime.Calls.MetaObjectBuilder
args IronRuby.Runtime.Calls.CallArguments
methodName string
return void

CreateAnonymousClass() public static method

public static CreateAnonymousClass ( IronRuby.Runtime.RubyScope scope, BlockParam body, RubyClass self, [ superClass ) : object
scope IronRuby.Runtime.RubyScope
body IronRuby.Runtime.BlockParam
self RubyClass
superClass [
return object

EnumerateClrMembers() protected method

protected EnumerateClrMembers ( Type type ) : IEnumerable
type System.Type
return IEnumerable

GetNonSingletonClass() public method

public GetNonSingletonClass ( ) : RubyClass
return RubyClass

GetUnderlyingSystemType() public method

public GetUnderlyingSystemType ( ) : Type
return System.Type

InitializeClassCopy() public method

public InitializeClassCopy ( RubyClass rubyClass ) : void
rubyClass RubyClass
return void

IsException() public method

public IsException ( ) : bool
return bool

IsSubclassOf() public method

Returns true if this class is equal to super or it is its descendant.
public IsSubclassOf ( RubyClass super ) : bool
super RubyClass
return bool

MethodAdded() public method

public MethodAdded ( string name ) : void
name string
return void

RubyClass() public method

public RubyClass ( RubyClass rubyClass ) : System.Linq.Expressions
rubyClass RubyClass
return System.Linq.Expressions

TryGetClrConstructor() public method

public TryGetClrConstructor ( IronRuby.Runtime.Calls.RubyMemberInfo &method ) : bool
method IronRuby.Runtime.Calls.RubyMemberInfo
return bool

TryGetClrMember() protected method

protected TryGetClrMember ( Type type, string name, bool mapNames, bool unmangleNames, IronRuby.Runtime.Calls.RubyMemberInfo &method ) : bool
type System.Type
name string
mapNames bool
unmangleNames bool
method IronRuby.Runtime.Calls.RubyMemberInfo
return bool

TryGetClrMember() public method

public TryGetClrMember ( string name, Type asType, IronRuby.Runtime.Calls.RubyMemberInfo &method ) : bool
name string
asType System.Type
method IronRuby.Runtime.Calls.RubyMemberInfo
return bool