Development

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • r45553 - trunk/mcs/class/corlib/System.Reflection

    2 answers - 6467 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Author: calberto
    Date: 2005-06-06 20:14:13 -0400 (Mon, 06 Jun 2005)
    New Revision: 45553
    Modified:
    Log:
    2005-06-07 Carlos Alberto Cortez <calberto.cortez (AT) gmail (DOT) com>
    * CustomAttributeData.cs: Implemented.
    * Implemented.
    * Implemented.
    Modified:
    2005-06-07 00:12:21 UTC (rev 45552)
    2005-06-07 00:14:13 UTC (rev 45553)
    @@ -1,3 +1,11 @@
    +2005-06-07 Carlos Alberto Cortez <calberto.cortez (AT) gmail (DOT) com>
    +
    +* CustomAttributeData.cs: Implemented.
    +
    +* Implemented.
    +
    +* Implemented.
    +
    2005-06-06 Zoltan Varga <vargaz (AT) freemail (DOT) hu>
    * Assembly.cs ExceptionHandlingClause.cs: Fix build.
    Modified:
    2005-06-07 00:12:21 UTC (rev 45552)
    2005-06-07 00:14:13 UTC (rev 45553)
    @@ -3,6 +3,7 @@
    //
    // Author:
    // Zoltan Varga (vargaz (AT) gmail (DOT) com)
    +// Carlos Alberto Cortez (calberto.cortez (AT) gmail (DOT) com)
    //
    // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
    //
    @@ -32,6 +33,7 @@
    using System.Collections.Generic;
    using ;
    using System.Runtime.InteropServices;
    +using System.Text;
    namespace System.Reflection {
    @@ -39,47 +41,87 @@
    [ComVisible (true)]
    #endif
    public sealed class CustomAttributeData {
    +ConstructorInfo ctorInfo;
    +IList<CustomAttributeTypedArgumentctorArgs;
    +IList<CustomAttributeNamedArgumentnamedArgs;
    -[MonoTD]
    +internal CustomAttributeData (ConstructorInfo ctorInfo, object [] ctorArgs, object [] namedArgs)
    +{
    +this.ctorInfo = ctorInfo;
    +
    +this.ctorArgs = Array.AsR<CustomAttributeTypedArgument
    +(ctorArgs != null ? UnboxValues<CustomAttributeTypedArgument(ctorArgs) : new CustomAttributeTypedArgument [0]);
    +
    +this.namedArgs = Array.AsR<CustomAttributeNamedArgument
    +(namedArgs != null ? UnboxValues<CustomAttributeNamedArgument(namedArgs) : new CustomAttributeNamedArgument [0]);
    +}
    +
    public ConstructorInfo Constructor {
    get {
    -throw new NotImplementedException ();
    +return ctorInfo;
    }
    }
    -[MonoTD]
    public IList<CustomAttributeTypedArgumentConstructorArguments {
    get {
    -throw new NotImplementedException ();
    +return ctorArgs;
    }
    }
    -[MonoTD]
    public IList<CustomAttributeNamedArgumentNamedArguments {
    get {
    -throw new NotImplementedException ();
    +return namedArgs;
    }
    }
    -[MonoTD]
    -public static IList<CustomAttributeDataGetCustomAttributes (Assembly yarget) {
    -throw new NotImplementedException ();
    +public static IList<CustomAttributeDataGetCustomAttributes (Assembly target) {
    +return (target);
    }
    -[MonoTD]
    public static IList<CustomAttributeDataGetCustomAttributes (MemberInfo target) {
    -throw new NotImplementedException ();
    +return (target);
    }
    -[MonoTD]
    public static IList<CustomAttributeDataGetCustomAttributes (Module target) {
    -throw new NotImplementedException ();
    +return (target);
    }
    -[MonoTD]
    public static IList<CustomAttributeDataGetCustomAttributes (ParameterInfo target) {
    -throw new NotImplementedException ();
    +return (target);
    }
    +
    +public override string ToString ()
    +{
    +StringBuilder sb = new StringBuilder ();
    +
    +sb.Append ("[" + ctorInfo.DeclaringType.Name + " (");
    +for (int i = 0; i < ctorArgs.Count; i++) {
    +sb.Append (ctorArgs [i].ToString ());
    +if (i + 1 < ctorArgs.Count)
    +sb.Append (", ");
    +}
    +
    +if (namedArgs.Count 0)
    +sb.Append (", ");
    +
    +for (int j = 0; j < namedArgs.Count; j++) {
    +sb.Append (namedArgs [j].ToString ());
    +if (j + 1 < namedArgs.Count)
    +sb.Append (", ");
    +}
    +sb.AppendFormat (")]");
    +
    +return sb.ToString ();
    +}
    +
    +static T [] UnboxValues<T(object [] values)
    +{
    +T [] retval = new T [values.Length];
    +for (int i = 0; i < values.Length; i++)
    +retval [i] = (T) values [i];
    +
    +return retval;
    +}
    }
    }
    Modified:
    2005-06-07 00:12:21 UTC (rev 45552)
    2005-06-07 00:14:13 UTC (rev 45553)
    @@ -3,6 +3,7 @@
    //
    // Author:
    // Zoltan Varga (vargaz (AT) gmail (DOT) com)
    +// Carlos Alberto Cortez (calberto.cortez (AT) gmail (DOT) com)
    //
    // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
    //
    @@ -37,20 +38,31 @@
    [ComVisible (true)]
    #endif
    public struct CustomAttributeNamedArgument {
    +CustomAttributeTypedArgument typedArgument;
    +MemberInfo memberInfo;
    -[MonoTD]
    +internal CustomAttributeNamedArgument (MemberInfo memberInfo, object typedArgument)
    +{
    +this.memberInfo = memberInfo;
    +this.typedArgument = (CustomAttributeTypedArgument) typedArgument;
    +}
    +
    public MemberInfo MemberInfo {
    get {
    -throw new NotImplementedException ();
    +return memberInfo;
    }
    }
    -[MonoTD]
    public CustomAttributeTypedArgument TypedValue {
    get {
    -throw new NotImplementedException ();
    +return typedArgument;
    }
    }
    +
    +public override string ToString ()
    +{
    +return memberInfo.Name + " = " + typedArgument.ToString ();
    +}
    }
    }
    Modified:
    2005-06-07 00:12:21 UTC (rev 45552)
    2005-06-07 00:14:13 UTC (rev 45553)
    @@ -3,6 +3,7 @@
    //
    // Author:
    // Zoltan Varga (vargaz (AT) gmail (DOT) com)
    +// Carlos Alberto Cortez (calberto.cortez (AT) gmail (DOT) com)
    //
    // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
    //
    @@ -37,20 +38,37 @@
    [ComVisible (true)]
    #endif
    public struct CustomAttributeTypedArgument {
    +Type argumentType;
    +object value;
    -[MonoTD]
    +internal CustomAttributeTypedArgument (Type argumentType, object value)
    +{
    +this.argumentType = argumentType;
    +this.value = value;
    +}
    +
    public Type ArgumentType {
    get {
    -throw new NotImplementedException ();
    +return argumentType;
    }
    }
    -[MonoTD]
    public object Value {
    get {
    -throw new NotImplementedException ();
    +return value;
    }
    }
    +
    +public override string ToString ()
    +{
    +string val = value.ToString ();
    +if (argumentType == typeof (string))
    +return "\"" + val + "\"";
    +if (argumentType == typeof (Type))
    +return "typeof (" + val + ")";
    +
    +return val;
    +}
    }
    }
    Mono-patches maillist - Mono-patches (AT) lists (DOT) ximian.com
  • No.1 | | 6783 bytes | |

    Hi,

    please do not commit such patches to corlib without first testing them.

    There is an open bug report (#75136) about this issue, but we can't just
    keep the build broken until that's fixed.

    Thanks,
    Martin

    Mon, 2005-06-06 at 20:14 -0400, Carlos Alberto Cortes wrote:
    Author: calberto
    Date: 2005-06-06 20:14:13 -0400 (Mon, 06 Jun 2005)
    New Revision: 45553

    Modified:

    Log:
    2005-06-07 Carlos Alberto Cortez <calberto.cortez (AT) gmail (DOT) com>

    * CustomAttributeData.cs: Implemented.

    * Implemented.

    * Implemented.

    Modified:

    2005-06-07 00:12:21 UTC (rev 45552)
    2005-06-07 00:14:13 UTC (rev 45553)
    @@ -1,3 +1,11 @@
    +2005-06-07 Carlos Alberto Cortez <calberto.cortez (AT) gmail (DOT) com>
    +
    +* CustomAttributeData.cs: Implemented.
    +
    +* Implemented.
    +
    +* Implemented.
    +
    2005-06-06 Zoltan Varga <vargaz (AT) freemail (DOT) hu>

    * Assembly.cs ExceptionHandlingClause.cs: Fix build.

    Modified:

    2005-06-07 00:12:21 UTC (rev 45552)
    2005-06-07 00:14:13 UTC (rev 45553)
    @@ -3,6 +3,7 @@
    //
    // Author:
    // Zoltan Varga (vargaz (AT) gmail (DOT) com)
    +// Carlos Alberto Cortez (calberto.cortez (AT) gmail (DOT) com)
    //
    // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
    //
    @@ -32,6 +33,7 @@
    using System.Collections.Generic;
    using ;
    using System.Runtime.InteropServices;
    +using System.Text;

    namespace System.Reflection {

    @@ -39,47 +41,87 @@
    [ComVisible (true)]
    #endif
    public sealed class CustomAttributeData {
    +ConstructorInfo ctorInfo;
    +IList<CustomAttributeTypedArgumentctorArgs;
    +IList<CustomAttributeNamedArgumentnamedArgs;
    -[MonoTD]
    +internal CustomAttributeData (ConstructorInfo ctorInfo, object [] ctorArgs, object [] namedArgs)
    +{
    +this.ctorInfo = ctorInfo;
    +
    +this.ctorArgs = Array.AsR<CustomAttributeTypedArgument
    +(ctorArgs != null ? UnboxValues<CustomAttributeTypedArgument(ctorArgs) : new CustomAttributeTypedArgument [0]);
    +
    +this.namedArgs = Array.AsR<CustomAttributeNamedArgument
    +(namedArgs != null ? UnboxValues<CustomAttributeNamedArgument(namedArgs) : new CustomAttributeNamedArgument [0]);
    +}
    +
    public ConstructorInfo Constructor {
    get {
    -throw new NotImplementedException ();
    +return ctorInfo;
    }
    }
    -[MonoTD]
    public IList<CustomAttributeTypedArgumentConstructorArguments {
    get {
    -throw new NotImplementedException ();
    +return ctorArgs;
    }
    }
    -[MonoTD]
    public IList<CustomAttributeNamedArgumentNamedArguments {
    get {
    -throw new NotImplementedException ();
    +return namedArgs;
    }
    }
    -[MonoTD]
    -public static IList<CustomAttributeDataGetCustomAttributes (Assembly yarget) {
    -throw new NotImplementedException ();
    +public static IList<CustomAttributeDataGetCustomAttributes (Assembly target) {
    +return (target);
    }
    -[MonoTD]
    public static IList<CustomAttributeDataGetCustomAttributes (MemberInfo target) {
    -throw new NotImplementedException ();
    +return (target);
    }
    -[MonoTD]
    public static IList<CustomAttributeDataGetCustomAttributes (Module target) {
    -throw new NotImplementedException ();
    +return (target);
    }
    -[MonoTD]
    public static IList<CustomAttributeDataGetCustomAttributes (ParameterInfo target) {
    -throw new NotImplementedException ();
    +return (target);
    }
    +
    +public override string ToString ()
    +{
    +StringBuilder sb = new StringBuilder ();
    +
    +sb.Append ("[" + ctorInfo.DeclaringType.Name + " (");
    +for (int i = 0; i < ctorArgs.Count; i++) {
    +sb.Append (ctorArgs [i].ToString ());
    +if (i + 1 < ctorArgs.Count)
    +sb.Append (", ");
    +}
    +
    +if (namedArgs.Count 0)
    +sb.Append (", ");
    +
    +for (int j = 0; j < namedArgs.Count; j++) {
    +sb.Append (namedArgs [j].ToString ());
    +if (j + 1 < namedArgs.Count)
    +sb.Append (", ");
    +}
    +sb.AppendFormat (")]");
    +
    +return sb.ToString ();
    +}
    +
    +static T [] UnboxValues<T(object [] values)
    +{
    +T [] retval = new T [values.Length];
    +for (int i = 0; i < values.Length; i++)
    +retval [i] = (T) values [i];
    +
    +return retval;
    +}
    }

    }

    Modified:

    2005-06-07 00:12:21 UTC (rev 45552)
    2005-06-07 00:14:13 UTC (rev 45553)
    @@ -3,6 +3,7 @@
    //
    // Author:
    // Zoltan Varga (vargaz (AT) gmail (DOT) com)
    +// Carlos Alberto Cortez (calberto.cortez (AT) gmail (DOT) com)
    //
    // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
    //
    @@ -37,20 +38,31 @@
    [ComVisible (true)]
    #endif
    public struct CustomAttributeNamedArgument {
    +CustomAttributeTypedArgument typedArgument;
    +MemberInfo memberInfo;
    -[MonoTD]
    +internal CustomAttributeNamedArgument (MemberInfo memberInfo, object typedArgument)
    +{
    +this.memberInfo = memberInfo;
    +this.typedArgument = (CustomAttributeTypedArgument) typedArgument;
    +}
    +
    public MemberInfo MemberInfo {
    get {
    -throw new NotImplementedException ();
    +return memberInfo;
    }
    }
    -[MonoTD]
    public CustomAttributeTypedArgument TypedValue {
    get {
    -throw new NotImplementedException ();
    +return typedArgument;
    }
    }
    +
    +public override string ToString ()
    +{
    +return memberInfo.Name + " = " + typedArgument.ToString ();
    +}
    }

    }

    Modified:

    2005-06-07 00:12:21 UTC (rev 45552)
    2005-06-07 00:14:13 UTC (rev 45553)
    @@ -3,6 +3,7 @@
    //
    // Author:
    // Zoltan Varga (vargaz (AT) gmail (DOT) com)
    +// Carlos Alberto Cortez (calberto.cortez (AT) gmail (DOT) com)
    //
    // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
    //
    @@ -37,20 +38,37 @@
    [ComVisible (true)]
    #endif
    public struct CustomAttributeTypedArgument {
    +Type argumentType;
    +object value;
    -[MonoTD]
    +internal CustomAttributeTypedArgument (Type argumentType, object value)
    +{
    +this.argumentType = argumentType;
    +this.value = value;
    +}
    +
    public Type ArgumentType {
    get {
    -throw new NotImplementedException ();
    +return argumentType;
    }
    }
    -[MonoTD]
    public object Value {
    get {
    -throw new NotImplementedException ();
    +return value;
    }
    }
    +
    +public override string ToString ()
    +{
    +string val = value.ToString ();
    +if (argumentType == typeof (string))
    +return "\"" + val + "\"";
    +if (argumentType == typeof (Type))
    +return "typeof (" + val + ")";
    +
    +return val;
    +}
    }

    }

    Mono-patches maillist - Mono-patches (AT) lists (DOT) ximian.com

    Mono-devel-list mailing list
    Mono-devel-list (AT) lists (DOT) ximian.com
  • No.2 | | 7050 bytes | |

    Hey Martin,

    thanks for the info.

    I will try to commit this patch when the problem is fixed.

    Carlos.

    El mar, 07-06-2005 a las 05:37 +0200, Martin Baulig :
    Hi,

    please do not commit such patches to corlib without first testing them.

    There is an open bug report (#75136) about this issue, but we can't just
    keep the build broken until that's fixed.

    Thanks,
    Martin

    Mon, 2005-06-06 at 20:14 -0400, Carlos Alberto Cortes wrote:
    Author: calberto
    Date: 2005-06-06 20:14:13 -0400 (Mon, 06 Jun 2005)
    New Revision: 45553

    Modified:

    Log:
    2005-06-07 Carlos Alberto Cortez <calberto.cortez (AT) gmail (DOT) com>

    * CustomAttributeData.cs: Implemented.

    * Implemented.

    * Implemented.

    Modified:

    2005-06-07 00:12:21 UTC (rev 45552)
    2005-06-07 00:14:13 UTC (rev 45553)
    @@ -1,3 +1,11 @@
    +2005-06-07 Carlos Alberto Cortez <calberto.cortez (AT) gmail (DOT) com>
    +
    +* CustomAttributeData.cs: Implemented.
    +
    +* Implemented.
    +
    +* Implemented.
    +
    2005-06-06 Zoltan Varga <vargaz (AT) freemail (DOT) hu>

    * Assembly.cs ExceptionHandlingClause.cs: Fix build.

    Modified:

    2005-06-07 00:12:21 UTC (rev 45552)
    2005-06-07 00:14:13 UTC (rev 45553)
    @@ -3,6 +3,7 @@
    //
    // Author:
    // Zoltan Varga (vargaz (AT) gmail (DOT) com)
    +// Carlos Alberto Cortez (calberto.cortez (AT) gmail (DOT) com)
    //
    // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
    //
    @@ -32,6 +33,7 @@
    using System.Collections.Generic;
    using ;
    using System.Runtime.InteropServices;
    +using System.Text;

    namespace System.Reflection {

    @@ -39,47 +41,87 @@
    [ComVisible (true)]
    #endif
    public sealed class CustomAttributeData {
    +ConstructorInfo ctorInfo;
    +IList<CustomAttributeTypedArgumentctorArgs;
    +IList<CustomAttributeNamedArgumentnamedArgs;
    -[MonoTD]
    +internal CustomAttributeData (ConstructorInfo ctorInfo, object [] ctorArgs, object [] namedArgs)
    +{
    +this.ctorInfo = ctorInfo;
    +
    +this.ctorArgs = Array.AsR<CustomAttributeTypedArgument
    +(ctorArgs != null ? UnboxValues<CustomAttributeTypedArgument(ctorArgs) : new CustomAttributeTypedArgument [0]);
    +
    +this.namedArgs = Array.AsR<CustomAttributeNamedArgument
    +(namedArgs != null ? UnboxValues<CustomAttributeNamedArgument(namedArgs) : new CustomAttributeNamedArgument [0]);
    +}
    +
    public ConstructorInfo Constructor {
    get {
    -throw new NotImplementedException ();
    +return ctorInfo;
    }
    }
    -[MonoTD]
    public IList<CustomAttributeTypedArgumentConstructorArguments {
    get {
    -throw new NotImplementedException ();
    +return ctorArgs;
    }
    }
    -[MonoTD]
    public IList<CustomAttributeNamedArgumentNamedArguments {
    get {
    -throw new NotImplementedException ();
    +return namedArgs;
    }
    }
    -[MonoTD]
    -public static IList<CustomAttributeDataGetCustomAttributes (Assembly yarget) {
    -throw new NotImplementedException ();
    +public static IList<CustomAttributeDataGetCustomAttributes (Assembly target) {
    +return (target);
    }
    -[MonoTD]
    public static IList<CustomAttributeDataGetCustomAttributes (MemberInfo target) {
    -throw new NotImplementedException ();
    +return (target);
    }
    -[MonoTD]
    public static IList<CustomAttributeDataGetCustomAttributes (Module target) {
    -throw new NotImplementedException ();
    +return (target);
    }
    -[MonoTD]
    public static IList<CustomAttributeDataGetCustomAttributes (ParameterInfo target) {
    -throw new NotImplementedException ();
    +return (target);
    }
    +
    +public override string ToString ()
    +{
    +StringBuilder sb = new StringBuilder ();
    +
    +sb.Append ("[" + ctorInfo.DeclaringType.Name + " (");
    +for (int i = 0; i < ctorArgs.Count; i++) {
    +sb.Append (ctorArgs [i].ToString ());
    +if (i + 1 < ctorArgs.Count)
    +sb.Append (", ");
    +}
    +
    +if (namedArgs.Count 0)
    +sb.Append (", ");
    +
    +for (int j = 0; j < namedArgs.Count; j++) {
    +sb.Append (namedArgs [j].ToString ());
    +if (j + 1 < namedArgs.Count)
    +sb.Append (", ");
    +}
    +sb.AppendFormat (")]");
    +
    +return sb.ToString ();
    +}
    +
    +static T [] UnboxValues<T(object [] values)
    +{
    +T [] retval = new T [values.Length];
    +for (int i = 0; i < values.Length; i++)
    +retval [i] = (T) values [i];
    +
    +return retval;
    +}
    }

    }

    Modified:

    2005-06-07 00:12:21 UTC (rev 45552)
    2005-06-07 00:14:13 UTC (rev 45553)
    @@ -3,6 +3,7 @@
    //
    // Author:
    // Zoltan Varga (vargaz (AT) gmail (DOT) com)
    +// Carlos Alberto Cortez (calberto.cortez (AT) gmail (DOT) com)
    //
    // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
    //
    @@ -37,20 +38,31 @@
    [ComVisible (true)]
    #endif
    public struct CustomAttributeNamedArgument {
    +CustomAttributeTypedArgument typedArgument;
    +MemberInfo memberInfo;
    -[MonoTD]
    +internal CustomAttributeNamedArgument (MemberInfo memberInfo, object typedArgument)
    +{
    +this.memberInfo = memberInfo;
    +this.typedArgument = (CustomAttributeTypedArgument) typedArgument;
    +}
    +
    public MemberInfo MemberInfo {
    get {
    -throw new NotImplementedException ();
    +return memberInfo;
    }
    }
    -[MonoTD]
    public CustomAttributeTypedArgument TypedValue {
    get {
    -throw new NotImplementedException ();
    +return typedArgument;
    }
    }
    +
    +public override string ToString ()
    +{
    +return memberInfo.Name + " = " + typedArgument.ToString ();
    +}
    }

    }

    Modified:

    2005-06-07 00:12:21 UTC (rev 45552)
    2005-06-07 00:14:13 UTC (rev 45553)
    @@ -3,6 +3,7 @@
    //
    // Author:
    // Zoltan Varga (vargaz (AT) gmail (DOT) com)
    +// Carlos Alberto Cortez (calberto.cortez (AT) gmail (DOT) com)
    //
    // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
    //
    @@ -37,20 +38,37 @@
    [ComVisible (true)]
    #endif
    public struct CustomAttributeTypedArgument {
    +Type argumentType;
    +object value;
    -[MonoTD]
    +internal CustomAttributeTypedArgument (Type argumentType, object value)
    +{
    +this.argumentType = argumentType;
    +this.value = value;
    +}
    +
    public Type ArgumentType {
    get {
    -throw new NotImplementedException ();
    +return argumentType;
    }
    }
    -[MonoTD]
    public object Value {
    get {
    -throw new NotImplementedException ();
    +return value;
    }
    }
    +
    +public override string ToString ()
    +{
    +string val = value.ToString ();
    +if (argumentType == typeof (string))
    +return "\"" + val + "\"";
    +if (argumentType == typeof (Type))
    +return "typeof (" + val + ")";
    +
    +return val;
    +}
    }

    }

    Mono-patches maillist - Mono-patches (AT) lists (DOT) ximian.com

    Mono-devel-list mailing list
    Mono-devel-list (AT) lists (DOT) ximian.com

    Mono-devel-list mailing list
    Mono-devel-list (AT) lists (DOT) ximian.com

Re: r45553 - trunk/mcs/class/corlib/System.Reflection


max 4000 letters.
Your nickname that display:
In order to stop the spam: 2 + 1 =
QUESTION ON "Development"

EMSDN.COM