Browse Source

PropertyInfo derives from System.Reflection.PropertyInfo

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5098 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 17 years ago
parent
commit
c07a414092
  1. 1
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj
  2. 134
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugPropertyInfo.cs
  3. 133
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/PropertyInfo.cs
  4. 3
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Object.cs

1
src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj

@ -223,7 +223,6 @@
<Compile Include="Src\Metadata\DebugMemberInfo.cs" /> <Compile Include="Src\Metadata\DebugMemberInfo.cs" />
<Compile Include="Src\Metadata\DebugMethodInfo.cs" /> <Compile Include="Src\Metadata\DebugMethodInfo.cs" />
<Compile Include="Src\Metadata\DebugParameterInfo.cs" /> <Compile Include="Src\Metadata\DebugParameterInfo.cs" />
<Compile Include="Src\Metadata\DebugPropertyInfo.cs" />
<Compile Include="Src\Metadata\DebugType-Helpers.cs" /> <Compile Include="Src\Metadata\DebugType-Helpers.cs" />
<Compile Include="Src\Metadata\DebugType.cs" /> <Compile Include="Src\Metadata\DebugType.cs" />
<Compile Include="Src\Metadata\DebugType2.cs" /> <Compile Include="Src\Metadata\DebugType2.cs" />

134
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugPropertyInfo.cs

@ -1,134 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Globalization;
using Debugger.Wrappers.CorDebug;
using Debugger.Wrappers.MetaData;
using ICSharpCode.NRefactory.Ast;
using Mono.Cecil.Signatures;
namespace Debugger.MetaData2
{
using System.Reflection;
public class DebugPropertyInfo : System.Reflection.PropertyInfo
{
public override Type DeclaringType {
get {
throw new NotSupportedException();
}
}
public override MemberTypes MemberType {
get {
throw new NotSupportedException();
}
}
// public virtual int MetadataToken { get; }
// internal virtual int MetadataTokenInternal { get; }
// public virtual Module Module { get; }
public override string Name {
get {
throw new NotSupportedException();
}
}
public override Type ReflectedType {
get {
throw new NotSupportedException();
}
}
// internal virtual bool CacheEquals(object o);
public override object[] GetCustomAttributes(bool inherit)
{
throw new NotSupportedException();
}
public override object[] GetCustomAttributes(Type attributeType, bool inherit)
{
throw new NotSupportedException();
}
public override bool IsDefined(Type attributeType, bool inherit)
{
throw new NotSupportedException();
}
public override PropertyAttributes Attributes {
get {
throw new NotSupportedException();
}
}
public override bool CanRead {
get {
throw new NotSupportedException();
}
}
public override bool CanWrite {
get {
throw new NotSupportedException();
}
}
// public override MemberTypes MemberType { get; }
public override Type PropertyType {
get {
throw new NotSupportedException();
}
}
public override MethodInfo[] GetAccessors(bool nonPublic)
{
throw new NotSupportedException();
}
// public virtual object GetConstantValue();
public override MethodInfo GetGetMethod(bool nonPublic)
{
throw new NotSupportedException();
}
public override ParameterInfo[] GetIndexParameters()
{
throw new NotSupportedException();
}
// public virtual Type[] GetOptionalCustomModifiers();
// public virtual object GetRawConstantValue();
// public virtual Type[] GetRequiredCustomModifiers();
public override MethodInfo GetSetMethod(bool nonPublic)
{
throw new NotSupportedException();
}
// public virtual object GetValue(object obj, object[] index);
public override object GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
{
throw new NotSupportedException();
}
// public virtual void SetValue(object obj, object value, object[] index);
public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
{
throw new NotSupportedException();
}
}
}

133
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/PropertyInfo.cs

@ -7,89 +7,132 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Reflection;
using Debugger.Wrappers.CorDebug; using Debugger.Wrappers.CorDebug;
using Debugger.Wrappers.MetaData; using Debugger.Wrappers.MetaData;
namespace Debugger.MetaData namespace Debugger.MetaData
{ {
/// <summary> public class DebugPropertyInfo : System.Reflection.PropertyInfo
/// Provides information about a property in a class
/// </summary>
public class PropertyInfo: MemberInfo
{ {
DebugType declaringType;
MethodInfo getMethod; MethodInfo getMethod;
MethodInfo setMethod; MethodInfo setMethod;
/// <summary> Gets a value indicating whether this member has the private access modifier</summary> internal DebugPropertyInfo(DebugType declaringType, MethodInfo getMethod, MethodInfo setMethod)
public override bool IsPrivate { {
get { return (getMethod ?? setMethod).IsPrivate; } if (getMethod == null && setMethod == null) throw new ArgumentNullException("Both getter and setter can not be null.");
}
this.declaringType = declaringType;
/// <summary> Gets a value indicating whether this member has the internal access modifier</summary> this.getMethod = getMethod;
public override bool IsInternal { this.setMethod = setMethod;
get { return (getMethod ?? setMethod).IsInternal; }
}
/// <summary> Gets a value indicating whether this member has the protected access modifier</summary>
public override bool IsProtected {
get { return (getMethod ?? setMethod).IsProtected; }
}
/// <summary> Gets a value indicating whether this member has the public access modifier</summary>
public override bool IsPublic {
get { return (getMethod ?? setMethod).IsPublic; }
} }
/// <summary> Gets a value indicating whether this property is static </summary> public override Type DeclaringType {
public override bool IsStatic {
get { get {
return (getMethod ?? setMethod).IsStatic; return declaringType;
} }
} }
/// <summary> Gets the metadata token associated with getter (or setter)
/// of this property </summary>
[Debugger.Tests.Ignore]
public override uint MetadataToken { public override uint MetadataToken {
get { get {
return (getMethod ?? setMethod).MetadataToken; return (getMethod ?? setMethod).MetadataToken;
} }
} }
/// <summary> The type of the property</summary> // public virtual Module Module { get; }
public DebugType Type {
public override string Name {
get { get {
return getMethod.ReturnType; return (getMethod ?? setMethod).Name.Remove(0,4);
} }
} }
/// <summary> Gets the name of this property </summary> public override Type ReflectedType {
public override string Name {
get { get {
return (getMethod ?? setMethod).Name.Remove(0,4); throw new NotSupportedException();
} }
} }
internal PropertyInfo(DebugType declaringType, MethodInfo getMethod, MethodInfo setMethod): base(declaringType) public override object[] GetCustomAttributes(bool inherit)
{ {
if (getMethod == null && setMethod == null) throw new ArgumentNullException("Both getter and setter can not be null."); throw new NotSupportedException();
this.getMethod = getMethod;
this.setMethod = setMethod;
} }
/// <summary> Get the get accessor of the property </summary> public override object[] GetCustomAttributes(Type attributeType, bool inherit)
public MethodInfo GetMethod { {
throw new NotSupportedException();
}
public override bool IsDefined(Type attributeType, bool inherit)
{
throw new NotSupportedException();
}
public override PropertyAttributes Attributes {
get { get {
return getMethod; throw new NotSupportedException();
} }
} }
/// <summary> Get the set accessor of the property </summary> public override bool CanRead {
public MethodInfo SetMethod {
get { get {
return setMethod; return getMethod != null;
} }
} }
public override bool CanWrite {
get {
return setMethod != null;
}
}
public override Type PropertyType {
get {
return getMethod.ReturnType;
}
}
public override MethodInfo[] GetAccessors(bool nonPublic)
{
throw new NotSupportedException();
}
// public virtual object GetConstantValue();
public override MethodInfo GetGetMethod(bool nonPublic)
{
return getMethod;
}
public override ParameterInfo[] GetIndexParameters()
{
throw new NotSupportedException();
}
// public virtual Type[] GetOptionalCustomModifiers();
// public virtual object GetRawConstantValue();
// public virtual Type[] GetRequiredCustomModifiers();
public override MethodInfo GetSetMethod(bool nonPublic)
{
return setMethod;
}
// public virtual object GetValue(object obj, object[] index);
public override object GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
{
throw new NotSupportedException();
}
// public virtual void SetValue(object obj, object value, object[] index);
public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
{
throw new NotSupportedException();
}
} }
} }

3
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Object.cs

@ -5,11 +5,12 @@
// <version>$Revision$</version> // <version>$Revision$</version>
// </file> // </file>
using ICSharpCode.NRefactory.Ast;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Debugger.MetaData; using Debugger.MetaData;
using Debugger.Wrappers.CorDebug; using Debugger.Wrappers.CorDebug;
using ICSharpCode.NRefactory.Ast;
using System.Reflection;
namespace Debugger namespace Debugger
{ {

Loading…
Cancel
Save