-
Notifications
You must be signed in to change notification settings - Fork 658
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
614 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Reflection; | ||
using System.Globalization; | ||
|
||
using ILRuntime.CLR.Method; | ||
using ILRuntime.CLR.TypeSystem; | ||
|
||
namespace ILRuntime.Reflection | ||
{ | ||
public class ILRuntimeConstructorInfo : ConstructorInfo | ||
{ | ||
ILMethod method; | ||
ILRuntimeParameterInfo[] parameters; | ||
public ILRuntimeConstructorInfo(ILMethod m) | ||
{ | ||
method = m; | ||
parameters = new ILRuntimeParameterInfo[m.ParameterCount]; | ||
for(int i = 0; i < m.ParameterCount; i++) | ||
{ | ||
parameters[i] = new ILRuntimeParameterInfo(m.Parameters[i]); | ||
} | ||
} | ||
|
||
internal ILMethod ILMethod { get { return method; } } | ||
public override MethodAttributes Attributes | ||
{ | ||
get | ||
{ | ||
return MethodAttributes.Public; | ||
} | ||
} | ||
|
||
public override Type DeclaringType | ||
{ | ||
get | ||
{ | ||
return method.DeclearingType.ReflectionType; | ||
} | ||
} | ||
|
||
public override RuntimeMethodHandle MethodHandle | ||
{ | ||
get | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
|
||
public override string Name | ||
{ | ||
get | ||
{ | ||
return method.Name; | ||
} | ||
} | ||
|
||
public override Type ReflectedType | ||
{ | ||
get | ||
{ | ||
return method.DeclearingType.ReflectionType; | ||
} | ||
} | ||
|
||
public override object[] GetCustomAttributes(bool inherit) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override object[] GetCustomAttributes(Type attributeType, bool inherit) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override MethodImplAttributes GetMethodImplementationFlags() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override ParameterInfo[] GetParameters() | ||
{ | ||
return parameters; | ||
} | ||
|
||
public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) | ||
{ | ||
var res = ((ILType)method.DeclearingType).Instantiate(false); | ||
method.DeclearingType.AppDomain.Invoke(method, res, parameters); | ||
return res; | ||
} | ||
|
||
public override bool IsDefined(Type attributeType, bool inherit) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override object Invoke(BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) | ||
{ | ||
var res = ((ILType)method.DeclearingType).Instantiate(false); | ||
method.DeclearingType.AppDomain.Invoke(method, res, parameters); | ||
return res; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Reflection; | ||
using System.Globalization; | ||
|
||
using ILRuntime.CLR.TypeSystem; | ||
|
||
namespace ILRuntime.Reflection | ||
{ | ||
public class ILRuntimeParameterInfo : ParameterInfo | ||
{ | ||
IType type; | ||
|
||
public ILRuntimeParameterInfo(IType type) | ||
{ | ||
this.type = type; | ||
} | ||
public override Type ParameterType | ||
{ | ||
get | ||
{ | ||
return type.ReflectionType; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.